test(lint): pin block-style branch/path scoping for WP001 (oleks/pipetree#22) #23
Reference in New Issue
Block a user
Delete Branch "test/pipetree-22-blockstyle-fixtures"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes oleks/pipetree#22. Test-only — no parser or rule code is touched.
Why now
Every
branch:in the corpus was flow-style[main](4x) or scalarmain(2x). Zero block-style:The parser handles it correctly, but nothing pinned that. It matters because
278a567on oleks/emmett deleted the hand-rolledcheck-woodpecker-redundant-triggers.xshand cut the pre-pushWPRslot over topipetree lint— and block-style scoping is the exact input that defeated that predecessor (oleks/emmett#385), where it parsed as an unscoped trigger and hard-failed correctly-scoped configs. pipetree is now the sole guard for this class, so a silent regression lands straight in everyone's pre-push hook.What's here
Two
_cleanfixtures, both wired intoTestWP001_CleanCases:wp001_blockbranch_clean.yaml— blockbranch:, modelled on the real config that surfaced #385 (~/projects/gitea-mcp)wp001_blockpath_clean.yaml— blockpath:with two entries, so a first-item-wins parse can't pass by accidentThe part worth reviewing: rule silence is not enough
I added a separate
TestWP001_BlockStyleScopingParsesAsScopedasserting the constraint actually lands inCondition.Fields, because the fixtures alone would not have caught the regression they exist for.A parser that drops the list value still leaves the
branchkey in the condition, so WP001 sees a non-eventkey and stays quiet either way. Silence can't distinguish "scoping understood" from "scoping lost".This isn't theoretical — I verified by mutation. Making
scalarOrListreject non-flow sequences (simulating #385) gives:Only the new parse test fails. The mutation was reverted;
git diffconfirms no parser code is in this branch.Golden file
verdicts.jsonregenerated viago test ./internal/oracle -run TestGolden -updateagainst the realwoodpecker-cli, not hand-edited — the oracle corpus is globbed, so new fixtures would otherwise trip its drift guard (corpus has 26 fixtures but golden records 24). Woodpecker's own parser independently reports both fixturesvalid: true,has_when: true,steps: 1. No existing entry changed (+12 lines, 0 deletions).Verification
go test ./...green.go vetclean on the touched packages.Every `branch:` in the corpus was flow-style `[main]` or scalar `main`; no fixture used the block form branch: - main so the parser's handling of it was correct but unpinned. That matters now because oleks/emmett 278a567 deleted the hand-rolled xonsh check and cut the pre-push WPR slot over to `pipetree lint` -- and block-style scoping is the exact input that defeated that predecessor (oleks/emmett#385), where it read as an unscoped trigger and hard-failed correctly-scoped configs. pipetree is now the sole guard for the class, so a silent regression here would land straight in everyone's pre-push hook. Adds two `_clean` fixtures (block `branch:`, and block `path:` with two entries so a first-item-wins parse cannot pass by accident), both wired into TestWP001_CleanCases. The verdict assertion alone is NOT sufficient, which is the reason for the separate TestWP001_BlockStyleScopingParsesAsScoped: a parser that drops the list value still leaves the `branch` KEY in the condition, so WP001 sees a non-`event` key and stays quiet whether or not the scoping survived. Silence cannot tell "understood" from "lost". Verified by mutation rather than by assertion alone -- making scalarOrList reject non-flow sequences (simulating oleks/emmett#385) leaves TestWP001_Fires, _EventListFires, _CleanCases and _RemediationCarriesClass2Caveat all PASSING and fails only the new parse test. The mutation was reverted; the diff here touches no parser code. verdicts.json regenerated with the real woodpecker-cli via `-update`, not hand-written: the oracle corpus is globbed, so new fixtures would otherwise drift it out of sync. Woodpecker's own parser independently reports both as valid with a when-block and one step, and no existing entry changed.Closing as superseded — not merging.
d078f88("test: pin block-style trigger scoping, the shape that broke the predecessor") landed onmainfrom a parallel session and closed oleks/pipetree#22 at 23:01, while this PR sat open.It's a strict superset of this branch, and it would conflict outright — we independently created the same two fixture filenames (
wp001_blockbranch_clean.yaml,wp001_blockpath_clean.yaml) and both regeneratedverdicts.json.What landed has everything here plus more:
d078f88branch:/ blockpath:fixturespush.Fields[key], not just rule silence)wp001_blockevent_fires.yamlTestBlockStylePathSatisfiesWP022)Worth recording that the other session reached the same core conclusion I did — that asserting WP001's silence is not sufficient, because a parser that drops the value leaves the
branchkey in place and the rule stays quiet either way, so the test must assert the parsedFields. Two independent derivations of that is decent evidence it's the right shape for this test.Nothing here is worth rebasing on top. Branch deleted.
Pull request closed