Skip to content

fix(lang): key the removed-phase entry by the name that was removed - #649

Merged
haribo merged 1 commit into
developfrom
fix/637-pre-check-key
Sep 10, 2026
Merged

fix(lang): key the removed-phase entry by the name that was removed#649
haribo merged 1 commit into
developfrom
fix/637-pre-check-key

Conversation

@haribo

@haribo haribo commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Summary

removedPhases turns a retired phase name into an actionable error. Its first entry was keyed
"check" — a valid phase, matched one case earlier in the same switch
(def_parser.go:78 before :80) — so the entry was unreachable, and pre-check, the name it
was written for, got the generic expected a phase, got "pre-check".

Keyed "pre-check" now, with the reason on the map so the next reader does not re-derive it.

The sharper half: a test that could not fail

TestPhases_RemovedNamesRefused asserted strings.Contains(err.Error(), "check") for input
pre-check. The generic message contains the input, so it contained check: the test passed
with no removedPhases entry at all, which is exactly the state it was in.

Both wanted substrings now appear only in the actionable message — rename the phase and
removed (ADR-0035). The post case was already sound ("removed" is absent from the generic
message); it was checked rather than assumed, as the issue asked.

Test plan

Mutation-tested in both directions, on the corrected assertion:

drop the pre-check entry     → FAIL  control_test.go:456: pre-check: expected a phase, got "pre-check"
re-key it "check" (the bug)  → FAIL  same
restored                     → ok

The four surviving phases still parse (same test). go test ./... and test/lint.sh green.

Closes #637

@haribo
haribo force-pushed the fix/637-pre-check-key branch from 956a05d to 8f9f38c Compare September 10, 2026 09:37
@haribo
haribo merged commit 1029ad1 into develop Sep 10, 2026
8 checks passed
@haribo
haribo deleted the fix/637-pre-check-key branch September 10, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant