From 6c815b2958cbd2a6bd479a2f64919f637a2edd51 Mon Sep 17 00:00:00 2001 From: weichen Date: Fri, 25 Sep 2026 20:17:20 +0000 Subject: [PATCH] =?UTF-8?q?fix(land):=20=E9=80=82=E9=85=8D=20dev=20?= =?UTF-8?q?=E7=8E=B0=E8=A1=8C=E7=BB=93=E6=9E=84=20=E2=80=94=20gov()/author?= =?UTF-8?q?izer()=20=E8=AE=BF=E9=97=AE=E5=99=A8=E3=80=81=E5=8E=BB=20app/do?= =?UTF-8?q?cnotify=20stream=20=E4=BE=9D=E8=B5=96=EF=BC=88arch=20=E5=9F=BA?= =?UTF-8?q?=E7=BA=BF=EF=BC=89=E3=80=81=E6=B5=8B=E8=AF=95=20stub=20?= =?UTF-8?q?=E9=87=8D=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/app/docnotify/lifecycle.go | 12 +----------- internal/coordinator/docgov_dialogue_test.go | 4 ++-- internal/server/handlers_docgov.go | 2 +- internal/server/trace_handlers.go | 4 ++-- 4 files changed, 6 insertions(+), 16 deletions(-) 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)