feat(validation): enforce label-to-score-band consistency - #79
Open
peterexcel494-oss wants to merge 2 commits into
Open
feat(validation): enforce label-to-score-band consistency#79peterexcel494-oss wants to merge 2 commits into
peterexcel494-oss wants to merge 2 commits into
Conversation
Extend validate-fixtures.mjs to compare each fixture's score against the documented band for its label (CONTRIBUTING.md: clean 0–25, suspicious 40–70, malicious 75–100). Intentional gaps (26–39 and 71–74) are preserved and not filled. Changes: - Export SCORE_BANDS constant with min/max for each label - Export scoreMatchesBand(label, score) helper used in the validator loop - Export bandRangeLabel(label) for human-readable error messages - Band-check loop in the main validator produces actionable errors that name the fixture ID, the actual score, and the expected range - Add scripts/validate-fixtures.test.mjs (node:test, 78 tests) covering boundary values, gap values, mismatched labels, and all three bands - Add 'test' script to package.json Closes Gryd-lock#62
Contributor
|
please one test failing |
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
Extends
scripts/validate-fixtures.mjsto enforce the documented score bands for each destination label, as specified in CONTRIBUTING.md. Before this change the validator confirmed scores were integers in 0–100 but never checked whether a score matched the band for its label — a fixture could be labelledcleanwith a malicious-range score and CI would not catch it.Changes
scripts/validate-fixtures.mjsSCORE_BANDSconstant mapping each label to its{ min, max }band:clean→ 0–25,suspicious→ 40–70,malicious→ 75–100scoreMatchesBand(label, score)— returnstruewhen score falls within the expected band for the given labelbandRangeLabel(label)— returns a human-readable range string (e.g."0–25") for use in error messagesscripts/validate-fixtures.test.mjs(new file)78 tests using Node's built-in
node:testrunner covering:SCORE_BANDSshape and values for all three labelsbandRangeLabeloutput and unknown input handlingscoreMatchesBandboundary values (min and max of each band)package.json"test": "node --test scripts/validate-fixtures.test.mjs"scriptAcceptance Criteria
npm run validateexits 0)Testing
Cross-Repository Impact
None. Fixture values in
destinations.jsonandscores.jsonare unchanged.Closes #62