merge: candidate gate-unhook-docquery into local_dev
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
| owner | task | branch | worktree | mutex | status |
|
| owner | task | branch | worktree | mutex | status |
|
||||||
|---|---|---|---|---|---|
|
|---|---|---|---|---|---|
|
||||||
|
| Cursor | gate-unhook-docquery-2026-09-24 | fix/gate-unhook-docquery-2026-09-24 | .worktrees/gate-unhook-docquery-2026-09-24 | server+docquery | in_progress |
|
||||||
| Cursor | integrate-jev-assist-land-2026-09-24 | feature/integrate-jev-assist-land-2026-09-24 | .worktrees/integrate-jev-assist-land-2026-09-24 | git:dev | done |
|
| Cursor | integrate-jev-assist-land-2026-09-24 | feature/integrate-jev-assist-land-2026-09-24 | .worktrees/integrate-jev-assist-land-2026-09-24 | git:dev | done |
|
||||||
| Cursor | integrate-codegraph-fixup2-2026-09-24 | feature/integrate-codegraph-fixup2-2026-09-24 | (removed) | git:dev | done |
|
| Cursor | integrate-codegraph-fixup2-2026-09-24 | feature/integrate-codegraph-fixup2-2026-09-24 | (removed) | git:dev | done |
|
||||||
| Cursor | integrate-codegraph-governance-2026-09-24 | feature/integrate-codegraph-governance-2026-09-24 | (removed) | git:dev | done |
|
| Cursor | integrate-codegraph-governance-2026-09-24 | feature/integrate-codegraph-governance-2026-09-24 | (removed) | git:dev | done |
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"chat-agent-system/internal/docgov"
|
"chat-agent-system/internal/docgov"
|
||||||
"chat-agent-system/internal/docrevision"
|
"chat-agent-system/internal/docrevision"
|
||||||
|
"chat-agent-system/internal/workspace"
|
||||||
)
|
)
|
||||||
|
|
||||||
func setupLedger(t *testing.T, docID, body, workDir string) (*Service, *docgov.GovernanceEngine, *docrevision.Service) {
|
func setupLedger(t *testing.T, docID, body, workDir string) (*Service, *docgov.GovernanceEngine, *docrevision.Service) {
|
||||||
@@ -19,6 +20,7 @@ func setupLedger(t *testing.T, docID, body, workDir string) (*Service, *docgov.G
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
rev := docrevision.NewService(nil)
|
rev := docrevision.NewService(nil)
|
||||||
|
rev.SetDeliverableStore(workspace.DirDeliverable{})
|
||||||
if _, err := rev.OpenTemplateVersion(ctx, docID, body, docrevision.ActorSnapshot{}, 7, workDir); err != nil {
|
if _, err := rev.OpenTemplateVersion(ctx, docID, body, docrevision.ActorSnapshot{}, 7, workDir); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,65 +133,8 @@ func NewFromRuntime(rt *app.Runtime) *Server {
|
|||||||
s.initArtifactVault()
|
s.initArtifactVault()
|
||||||
s.wireFinalArtifactHooks()
|
s.wireFinalArtifactHooks()
|
||||||
s.startVaultPublisher()
|
s.startVaultPublisher()
|
||||||
if s.rev != nil && s.notifySvc != nil {
|
// Durable notify is live via events/docnotify consumer; do not assign OnOutbox here
|
||||||
rev := s.rev
|
// (see internal/app.bindDocumentNotify and unhook_test).
|
||||||
rev.OnOutbox = func(ctx context.Context, eventType string, payload map[string]any) error {
|
|
||||||
if !s.notifySvc.Available() {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
docID, _ := payload["doc_id"].(string)
|
|
||||||
projectID, _ := payload["project_id"].(int64)
|
|
||||||
risk, _ := payload["risk"].(string)
|
|
||||||
var recipient int64
|
|
||||||
if s.gov != nil {
|
|
||||||
if doc, err := s.gov.GetDocument(ctx, docID); err == nil && doc != nil && doc.AuthorID > 0 {
|
|
||||||
recipient = doc.AuthorID
|
|
||||||
projectID = doc.ProjectID
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if recipient == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
p := notification.DocumentEventPayload{
|
|
||||||
ProjectID: projectID, DocID: docID, RiskLevel: risk,
|
|
||||||
}
|
|
||||||
switch eventType {
|
|
||||||
case notification.EventDocAgentCandidateReady:
|
|
||||||
if v, ok := payload["candidate_id"].(int64); ok {
|
|
||||||
p.CandidateID = v
|
|
||||||
}
|
|
||||||
_, err := s.notifySvc.EmitDocumentEvent(ctx, eventType, notification.TypeDocAgentCandidateReady,
|
|
||||||
"智能体变更待确认", "文档有高风险智能体候选变更,请确认后生效。",
|
|
||||||
fmt.Sprintf("doc_candidate:%s:%d:%d", docID, p.CandidateID, recipient), recipient, p)
|
|
||||||
return err
|
|
||||||
case notification.EventDocAgentVersionCommitted:
|
|
||||||
if v, ok := payload["version_no"].(int); ok {
|
|
||||||
p.VersionNo = v
|
|
||||||
}
|
|
||||||
_, err := s.notifySvc.EmitDocumentEvent(ctx, eventType, notification.TypeDocAgentVersionCommitted,
|
|
||||||
"智能体版本已生效", "新的智能体文档版本已提交。",
|
|
||||||
fmt.Sprintf("doc_agent_version:%s:%d:%d", docID, p.VersionNo, recipient), recipient, p)
|
|
||||||
return err
|
|
||||||
case notification.EventDocDownstreamImpact:
|
|
||||||
impacted, _ := payload["impacted_doc_id"].(string)
|
|
||||||
p.ImpactedDocID = impacted
|
|
||||||
_, err := s.notifySvc.EmitDocumentEvent(ctx, eventType, notification.TypeDocDownstreamImpact,
|
|
||||||
"下游文档受影响", "上游文档变更,请复核关联文档。",
|
|
||||||
fmt.Sprintf("doc_impact:%s:%s:%d", docID, impacted, recipient), recipient, p)
|
|
||||||
return err
|
|
||||||
case notification.EventDocChangeReportDegraded:
|
|
||||||
if v, ok := payload["report_id"].(int64); ok {
|
|
||||||
p.ReportID = v
|
|
||||||
}
|
|
||||||
_, err := s.notifySvc.EmitDocumentEvent(ctx, eventType, notification.TypeDocChangeReportDegraded,
|
|
||||||
"变更报告未完整评估", "变更报告降级,受控文档暂不可送审。",
|
|
||||||
fmt.Sprintf("doc_report_degraded:%s:%d:%d", docID, p.ReportID, recipient), recipient, p)
|
|
||||||
return err
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user