fix(lang): key the removed-phase entry by the name that was removed - #649
Merged
Conversation
haribo
force-pushed
the
fix/637-pre-check-key
branch
from
September 10, 2026 09:37
956a05d to
8f9f38c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
removedPhasesturns 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:78before:80) — so the entry was unreachable, andpre-check, the name itwas 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_RemovedNamesRefusedassertedstrings.Contains(err.Error(), "check")for inputpre-check. The generic message contains the input, so it containedcheck: the test passedwith no
removedPhasesentry at all, which is exactly the state it was in.Both wanted substrings now appear only in the actionable message —
rename the phaseandremoved (ADR-0035). Thepostcase was already sound ("removed"is absent from the genericmessage); it was checked rather than assumed, as the issue asked.
Test plan
Mutation-tested in both directions, on the corrected assertion:
The four surviving phases still parse (same test).
go test ./...andtest/lint.shgreen.Closes #637