From 3f7358d454a0950c88ca511ca6c9baaf0996213d Mon Sep 17 00:00:00 2001 From: weichen Date: Thu, 17 Sep 2026 13:15:05 +0000 Subject: [PATCH] feat(docgov): record duty_policy on lifecycle audit details Surface the document duty mode on submit/review/approve transitions for consistent logs under author_only. Co-authored-by: Cursor --- internal/docgov/state_machine.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/docgov/state_machine.go b/internal/docgov/state_machine.go index d75ac8ef..8dd09008 100644 --- a/internal/docgov/state_machine.go +++ b/internal/docgov/state_machine.go @@ -83,7 +83,7 @@ func (sm *StateMachine) TransitionSubmitForReview(doc *DocumentRecord, actorID i ActorRole: actorRole, FromState: fromState, ToState: toState, - Details: map[string]any{"timestamp": now}, + Details: map[string]any{"timestamp": now, "duty_policy": doc.DutyPolicy}, CreatedAt: now, }, nil } @@ -120,7 +120,7 @@ func (sm *StateMachine) TransitionReviewApprove(doc *DocumentRecord, actorID int ActorRole: actorRole, FromState: fromState, ToState: toState, - Details: map[string]any{"comment": comment, "timestamp": now}, + Details: map[string]any{"comment": comment, "timestamp": now, "duty_policy": doc.DutyPolicy}, CreatedAt: now, }, nil } @@ -169,6 +169,7 @@ func (sm *StateMachine) TransitionReviewReject(doc *DocumentRecord, actorID int6 Details: map[string]any{ "reject_reason": trimmedReason, "timestamp": now, + "duty_policy": doc.DutyPolicy, }, CreatedAt: now, }, nil @@ -207,8 +208,9 @@ func (sm *StateMachine) TransitionApproverApprove(doc *DocumentRecord, actorID i FromState: fromState, ToState: toState, Details: map[string]any{ - "comment": comment, - "timestamp": now, + "comment": comment, + "timestamp": now, + "duty_policy": doc.DutyPolicy, }, CreatedAt: now, }, nil @@ -276,6 +278,7 @@ func (sm *StateMachine) TransitionApproverReject(doc *DocumentRecord, actorID in "reject_reason": trimmedReason, "rollback_to": toState, "timestamp": now, + "duty_policy": doc.DutyPolicy, }, CreatedAt: now, }, nil