diff --git a/internal/app/docnotify/lifecycle.go b/internal/app/docnotify/lifecycle.go index efc93344..ea1268a1 100644 --- a/internal/app/docnotify/lifecycle.go +++ b/internal/app/docnotify/lifecycle.go @@ -8,7 +8,6 @@ import ( "chat-agent-system/internal/ctxmgr" "chat-agent-system/internal/docgov" "chat-agent-system/internal/notification" - "chat-agent-system/internal/stream" ) // LifecycleAction identifies a governance transition for routing. @@ -52,12 +51,11 @@ func RecipientForDocEvent(doc *docgov.DocumentRecord, eventType string) int64 { return 0 } -// EmitLifecycleParams carries optional chat/SSE side channels. +// EmitLifecycleParams carries optional chat side channels. type EmitLifecycleParams struct { Notify notificationEmitter Digest digestUpserter Chat *ctxmgr.ContextManager - Streamer *stream.Streamer Action LifecycleAction Doc *docgov.DocumentRecord ActorID int64 @@ -105,14 +103,6 @@ func EmitLifecycle(ctx context.Context, p EmitLifecycleParams) { "doc_id": p.Doc.DocID, "action": string(p.Action), "event": eventType, }) } - - if p.Streamer != nil { - p.Streamer.EmitGovernance(stream.GovernancePayload{ - DocID: p.Doc.DocID, Action: string(p.Action), CurrentState: string(p.Doc.CurrentState), - IsLocked: p.Doc.IsLocked, AuthorClaimed: p.Doc.AuthorClaimed, - NotificationTitle: title, NotificationMsg: body, - }) - } } func digestKindForEvent(eventType string) string { diff --git a/internal/coordinator/docgov_dialogue_test.go b/internal/coordinator/docgov_dialogue_test.go index e1e09c26..49775453 100644 --- a/internal/coordinator/docgov_dialogue_test.go +++ b/internal/coordinator/docgov_dialogue_test.go @@ -10,14 +10,14 @@ import ( "chat-agent-system/internal/intent" ) -type stubDocResolver struct { +type stubDocResolverDialogue struct { doc *coordinator.ResolvedDoc ok bool candidates []string err error } -func (s *stubDocResolver) ResolveDoc(context.Context, int64, string, string) (*coordinator.ResolvedDoc, bool, []string, error) { +func (s *stubDocResolverDialogue) ResolveDoc(context.Context, int64, string, string) (*coordinator.ResolvedDoc, bool, []string, error) { return s.doc, s.ok, s.candidates, s.err } diff --git a/internal/server/handlers_docgov.go b/internal/server/handlers_docgov.go index 75ead6ab..e20a06e2 100644 --- a/internal/server/handlers_docgov.go +++ b/internal/server/handlers_docgov.go @@ -386,7 +386,7 @@ func (s *Server) handleDocGovAddComment(w http.ResponseWriter, r *http.Request) // handleDocGovResolveComment marks a comment resolved or reopens it. func (s *Server) handleDocGovResolveComment(w http.ResponseWriter, r *http.Request) { - if s.gov == nil { + if s.gov() == nil { writeSafeError(w, r, http.StatusServiceUnavailable, "docgov engine not initialized") return } diff --git a/internal/server/trace_handlers.go b/internal/server/trace_handlers.go index 21c1c0c7..30a0b77f 100644 --- a/internal/server/trace_handlers.go +++ b/internal/server/trace_handlers.go @@ -265,7 +265,7 @@ func (s *Server) callerMayRequestReopen(r *http.Request, projectID, userID int64 func (s *Server) callerMayApproveReopen(ctx context.Context, projectID, userID int64, creator bool, req traceimpact.ReopenRequest) bool { hasActiveApprover := false userIsApprover := false - if s.gov != nil { + if s.gov() != nil { for _, taskKey := range req.DocTasks { docID := fmt.Sprintf("doc_proj%d_%s", projectID, taskKey) doc, err := s.gov().GetDocument(ctx, docID) @@ -291,7 +291,7 @@ func (s *Server) callerMayApproveReopen(ctx context.Context, projectID, userID i } func (s *Server) projectMemberActive(ctx context.Context, projectID, userID int64) bool { - if s.authorizer == nil || userID <= 0 { + if s.authorizer() == nil || userID <= 0 { return userID > 0 } rec, err := s.authorizer().GetProjectMember(ctx, projectID, userID)