Render a pending manual gate as stale when the tree has moved

f4dbcf7 taught the verified branch about staleness and left the pending one.
Run 10 showed a successor "automated checks passed at 94bd45c3b5d6" while HEAD
was 7d04aef: the automated half of that phase was established against code
that had since changed, and nothing said so.

A human about to confirm the manual steps of a phase deserves to know the
automated half no longer describes the tree.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CVbaKucEYBjMqVeUgJUsc1
This commit is contained in:
2026-08-28 15:55:29 +04:00
parent fda78cf6e6
commit d7e75e9e31
2 changed files with 33 additions and 0 deletions
+27
View File
@@ -707,3 +707,30 @@ func TestResearchBriefStatesTheFindingIDRule(t *testing.T) {
}
}
}
// A pending manual gate goes stale for the same reason a verified phase does.
// Run 10 rendered "automated checks passed at 94bd45c3b5d6" against a tree
// that had moved, because only the verified branch consulted Stale.
func TestPendingManualGateRendersStale(t *testing.T) {
plan := &workphase.PlanDoc{Phases: []workphase.PlanPhase{{ID: "phase-1", Name: "one"}}}
task := domain.Task{
ID: "t1", PlanRef: "ref-a",
PlanProgress: &domain.PlanProgress{PlanRef: "ref-a", Phases: []domain.PlanPhaseRecord{
{PlanRef: "ref-a", PhaseID: "phase-1", Status: domain.PlanPhaseAwaitingManual, AtSHA: strings.Repeat("a", 40)},
}},
}
got := renderPlanProgress(Input{
Task: task, Phase: domain.WorkPhaseImplement, Plan: plan,
Git: GitState{HeadSHA: strings.Repeat("b", 40)},
})
if !strings.Contains(got, "stale because the tree is now at") {
t.Errorf("a pending manual gate at a moved sha did not render stale:\n%s", got)
}
fresh := renderPlanProgress(Input{
Task: task, Phase: domain.WorkPhaseImplement, Plan: plan,
Git: GitState{HeadSHA: strings.Repeat("a", 40)},
})
if strings.Contains(fresh, "stale") {
t.Errorf("a pending manual gate at HEAD rendered stale:\n%s", fresh)
}
}