fix(land): 适配 dev 现行结构 — gov()/authorizer() 访问器、去 app/docnotify stream 依赖(arch 基线)、测试 stub 重名
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user