Repository navigation
test(scripts): the CLI-version gate's rules, which have passed while wrong twice - #144
Merged
Merged
Conversation
…wrong twice The gate compares the version the plugin claims against the one the vendor publishes, and every copy in the tree against the constant. It runs on a schedule, and its failure mode is the worst kind: it PASSES while reading nothing. It has already done so twice. The first version only scanned for literals and could not see the constant at all; the second only scanned `opencode/<version>` and could not see a bare copy (three e2e comments were two patches stale while it reported OK). Both were found by a control run, not by a test. So the rules are now `scripts/vendor-version.ts` — a function of its input — and `test/vendor-version.test.ts` holds them: - the constant is FOUND, and its absence is `undefined` rather than a default, because "read nothing" and "passed" have to be distinguishable; - a bare mention matches `1.19.5` and `v1.19.5`, and does NOT match `opencode/1.19.5` — the look-behind whose absence made the second version double-count every prefixed copy; - a stale patch of the pinned series is caught while another major.minor is the literal scan's business; - the disagreement list names versions and files, sorted, and is empty when everything agrees. Planted the look-behind's removal — the exact historical bug — and the case fails. **The test had to build its stale versions at run time.** Writing `1.19.3` in the file makes the gate it describes fail, because the scan reads `test/` too; the digits are assembled from the series instead, and the file says in the first line why.
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.
The gate compares the version the plugin claims against the one the vendor publishes, and every copy in the tree against the constant. It runs on a schedule, and its failure mode is the worst kind: it passes while reading nothing.
It has already done so twice:
opencode/<version>and could not see a bare copy — three e2e comments were two patches stale while it reported OK.Both were found by a control run, not by a test. So the rules are now
scripts/vendor-version.ts— a function of its input — and the test holds them to:undefinedrather than a default, because "read nothing" and "passed" have to be distinguishable;1.19.5andv1.19.5, and does not matchopencode/1.19.5— the look-behind whose absence made the second version double-count every prefixed copy;Planted the look-behind's removal — the exact historical bug — and the case fails.
A detail worth keeping
The test had to build its stale versions at run time. Writing
1.19.3in the file makes the gate it describes fail, because the scan readstest/too. It caught that on the first run; the digits are now assembled from the series, and the file says why in its first line.vp checkcheck-vendor-version