Files
archie/internal/app/archied/composition_order_test.go
T
sam 7299b923f6 feat(workflow): remove the superseded adversarial-self-review system
docs/prds/pr-review-agent.md's own header already declared this
superseded (docs/architecture/adversarial-review.md, docs/prds/
operator-pr-review.md, docs/prds/review-calibration.md); this executes
that removal per the maintainer's explicit decision, so no reference
to the old path remains:

- internal/domain/workflow/review.go, review_findings.go,
  review_report_md.go and their tests: Reviewer, ReviewRequest,
  StageReview, StagePostReviewComments, ReviewReport/ReviewFinding and
  friends. ReviewComment relocated into workflow.go (still used by
  Forger.CreateReviewComments and the new pr-review pipeline).
- internal/app/agentworker/review.go: the ai-sdk-backed subagentReviewer.
- internal/app/archied/pr_review.go: the synchronous operator-review
  path (prReviewer, gateway.ChatPRReviewer wiring). The review_pr chat
  tool now self-omits (nil reviewer) until the operator trigger is
  rebuilt to enqueue an async pr-review task instead of reviewing
  synchronously in the chat turn.
- config.Repo.ReviewEnabled and its dashboard exposure.
- Two composition-order tests and one dashboard test that existed only
  to pin the deleted path.

Also splits PRReview()'s Stage list into prReviewDecisionStages()
(phases 1-8) and stagePROutput() (phase 9), so a future caller can
splice the decision phases before a PR exists and defer posting until
after -- needed for the "archie's own PRs" trigger, not wired here: it
needs the same stage-loop-around-StageOpenPR semantics this pass
couldn't fully verify in the time available (does an Outcome-setting
stage like StageOpenPR end the compiled-workflow-definition engine the
same way it ends workflow.Run's literal loop?). Carries ScoredFinding.
Adversary through synthesis so that trigger's blocking-finding check
doesn't need to cross-reference back into the pre-synthesis slice.

Not built in this pass, left as a precise continuation (see the bead
comment): the watched-repositories and operator triggers, both blocked
on the same real question -- how a forge-reading credential reaches
PRSource's real implementation when the pr-review pipeline's Stage.Run
bodies execute inside the sandboxed archie-agent process, which holds
none today.
2026-09-28 12:55:05 +10:00

35 lines
1.5 KiB
Go

package archied
import (
"go/parser"
"go/token"
"testing"
)
// TestStartGatewayRuntimeSetsUpMemoryBeforeGatewayChat pins the ordering
// docs/prds/memory-engine-unification.md §4's "Prerequisite" note requires.
// startGatewayRuntime (gateway.go) constructs the only chat turn runner in
// production via setupGatewayChat, and a turn runner captures b.memEngines at
// construction time via boot.memoryStore(). Built the other way round it
// captures a nil engine and the chat <memory> block never appears, silently,
// because renderMemory treats a nil engine the same as a failed read. Nothing
// at runtime observes the order, so it is asserted by source position, the
// same way TestSetupBackendsRegistersContainerCleanupAfterNATS in
// bootstrap_nats_test.go pins cleanup ordering for the same reason.
func TestStartGatewayRuntimeSetsUpMemoryBeforeGatewayChat(t *testing.T) {
fileset := token.NewFileSet()
file, err := parser.ParseFile(fileset, "gateway.go", nil, 0)
if err != nil {
t.Fatal(err)
}
run := methodBody(t, file, "startGatewayRuntime")
memoryEngine := methodCallPosition(run, "setupMemoryEngine")
chat := methodCallPosition(run, "setupGatewayChat")
if memoryEngine == token.NoPos || chat == token.NoPos {
t.Fatalf("startGatewayRuntime call positions: setupMemoryEngine=%v setupGatewayChat=%v, want both present", memoryEngine, chat)
}
if chat < memoryEngine {
t.Fatal("startGatewayRuntime wires setupGatewayChat before setupMemoryEngine; the turn runner would capture a nil memory engine")
}
}