Fix validation bugs and add regression test suite#15
Open
ryanmurf wants to merge 1 commit into
Open
Conversation
- Report a clear rules error for invalid datePublic strings instead of
RangeError('Invalid time value')
- Skip entries with a missing/non-string lang in unique-English check
instead of throwing TypeError
- Fix timeline array error message and handle entries missing 'time'
- Extend rules to ADP containers for parity with CNA: descriptions,
unique-English, datePublic, timeline, and packageURL paths
- Honor warning dateStart/dateEnd so only currently-active registry
warnings surface in diagnostics
- Retry default schema validator creation after a failed load instead
of caching the rejected promise forever
- Add node:test suite (29 tests) with a dedicated regression test per
fix; typecheck tests via tsconfig.test.json; make the local smoke
test's warning window relative to the current date
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.
Fixes six bugs in the validation pipeline and warning registry, and adds a typechecked
node:testsuite (29 tests) with a dedicated regression test for each fix.Bug fixes
datePublicstrings produced a misleading error —new Date('garbage').toISOString()threwRangeError: Invalid time value; now reported as a clear rules-validation error (datePublic must be a valid date).langcrashed the unique-English check —entry.lang.toLowerCase()threw aTypeErrorwhen an entry had nolang; non-string values are now skipped (schema validation covers structure).Time must be a date stringfor a non-array), and entries missingtimewere handled unsafely; both fixed.containers.adp.*; descriptions, unique-English,datePublic, andpackageURLrules now cover ADP containers for parity with CNA (all fields confirmed present in the bundled 5.2.0 schema).Diagnosticsregardless ofdateStart/dateEnd; warnings are now filtered to the active window.Validateinstances; creation is now retried after a failure.Tests
test/validate.test.tsandtest/warnings.test.tsusing Node's built-innode:testrunner viatsx(29 tests): schema pass/fail, every business rule including all PURL edge cases (version,versqualifier, encoded colon, empty/./..subpaths), each ADP-parity path, warning active-window filtering, and the validator-cache retry.tsconfig.test.json;npm testnow runs typecheck + the suite.scripts/test-local.mjswarning fixture now derives its active window from the current date instead of hardcoded dates that would start failing in 2027.No public API changes; bundled schemas and dependencies untouched.
npm test,npm run build, andnode scripts/test-local.mjsall pass.