Stop telling a successor the tree is settled when every phase is stale
Run 8 rendered three phases as "verified at 14654d6cab63, stale because the tree is now at 56d9b9acdd59" and then printed "Every phase is verified" under them. The staleness was honest and the conclusion was not. Stale still counts as done. The usual reason a phase goes stale is the next phase's own commit, and treating that as unverified would send the implementer back to phase 1 after every commit. What the successor needed was the names: which phases were verified against code that has since changed, and an instruction to reverify what its work touches. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVbaKucEYBjMqVeUgJUsc1
This commit is contained in:
@@ -660,3 +660,39 @@ func TestLegacyPlanSaysProgressIsUnavailable(t *testing.T) {
|
||||
t.Fatal("the legacy plan text was lost")
|
||||
}
|
||||
}
|
||||
|
||||
// A successor must never be told the tree is settled when every verification
|
||||
// was earned against code that has since changed. Run 8 printed "Every phase
|
||||
// is verified" under three phases all rendered stale in the same block.
|
||||
func TestAllPhasesStaleIsNotReportedAsFinished(t *testing.T) {
|
||||
plan := &workphase.PlanDoc{Phases: []workphase.PlanPhase{
|
||||
{ID: "phase-1", Name: "one"}, {ID: "phase-2", Name: "two"},
|
||||
}}
|
||||
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.PlanPhaseVerified, AtSHA: strings.Repeat("a", 40)},
|
||||
{PlanRef: "ref-a", PhaseID: "phase-2", Status: domain.PlanPhaseVerified, AtSHA: strings.Repeat("a", 40)},
|
||||
}},
|
||||
}
|
||||
stale := renderPlanProgress(Input{
|
||||
Task: task, Phase: domain.WorkPhaseImplement, Plan: plan,
|
||||
Git: GitState{HeadSHA: strings.Repeat("b", 40)},
|
||||
})
|
||||
if strings.Contains(stale, "Every phase is verified at the current tree") {
|
||||
t.Error("a fully stale plan was reported as verified at the current tree")
|
||||
}
|
||||
for _, want := range []string{"phase-1, phase-2", "since changed"} {
|
||||
if !strings.Contains(stale, want) {
|
||||
t.Errorf("stale render missing %q:\n%s", want, stale)
|
||||
}
|
||||
}
|
||||
|
||||
current := renderPlanProgress(Input{
|
||||
Task: task, Phase: domain.WorkPhaseImplement, Plan: plan,
|
||||
Git: GitState{HeadSHA: strings.Repeat("a", 40)},
|
||||
})
|
||||
if !strings.Contains(current, "Every phase is verified at the current tree") {
|
||||
t.Errorf("a plan verified at HEAD was not reported as finished:\n%s", current)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user