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.
55 lines
1.8 KiB
Go
55 lines
1.8 KiB
Go
package archied
|
|
|
|
import (
|
|
"log/slog"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/samcharles93/archie-core/internal/config"
|
|
"github.com/samcharles93/archie-core/internal/secret"
|
|
)
|
|
|
|
// TestBuildTreesAndIdentitiesBuildsRootManagerAndIdentityRunners pins the
|
|
// daemon's tree composition, which the shared buildWorktreeManager must not
|
|
// change: the daemon still owns the process-wide manager *and* one runner per
|
|
// configured identity, each with its own WorkDir so concurrent identities
|
|
// never clone into the same directory. The Gateway takes only the manager, so
|
|
// this is the assertion that keeps the two roots apart.
|
|
func TestBuildTreesAndIdentitiesBuildsRootManagerAndIdentityRunners(t *testing.T) {
|
|
workDir := t.TempDir()
|
|
cfg := config.Config{
|
|
WorkDir: workDir,
|
|
BotUser: "archie-bot",
|
|
BotEmail: "bot@example.test",
|
|
Forge: config.Forge{Host: "https://forge.example.test"},
|
|
Identities: []config.IdentityConfig{{
|
|
Name: "archie",
|
|
BotUser: "archie-identity",
|
|
}},
|
|
}
|
|
b := &boot{
|
|
cfg: cfg,
|
|
token: "daemon-forge-token",
|
|
log: slog.New(slog.DiscardHandler),
|
|
secrets: secret.NewRegistry(),
|
|
}
|
|
|
|
if err := b.buildTreesAndIdentities(t.Context()); err != nil {
|
|
t.Fatalf("buildTreesAndIdentities = %v", err)
|
|
}
|
|
|
|
if b.trees == nil {
|
|
t.Fatal("b.trees = nil; the daemon would work no task")
|
|
}
|
|
if b.trees.WorkDir != workDir || b.trees.Token != b.token {
|
|
t.Errorf("root worktree manager = {WorkDir:%q Token:%q}, want {%q %q}", b.trees.WorkDir, b.trees.Token, workDir, b.token)
|
|
}
|
|
if got := len(b.identityRunners); got != 1 {
|
|
t.Fatalf("identityRunners = %d, want 1", got)
|
|
}
|
|
wantIdentityDir := filepath.Join(workDir, "identity-archie")
|
|
if got := b.identityRunners[0].Trees.WorkDir; got != wantIdentityDir {
|
|
t.Errorf("identity worktree manager WorkDir = %q, want %q", got, wantIdentityDir)
|
|
}
|
|
}
|