Repository navigation
fix(validate-members): hold sources.landscape.collectedAt to the snapshot - #1312
Merged
Merged
Conversation
…shot validate-members.mjs cross-checked the landscape provenance block in members.json against enduser-landscape.json on revision and sourceUrl only. collectedAt, the third field the generator writes from the same snapshot in the same statement, was held to nothing, and it is the one of the three the site renders: DirectoryFreshness formats it into the "last synced" note. A members.json whose collectedAt was stale or unparseable relative to the snapshot passed validation while the page printed a date the data did not support, or silently dropped the sentence. Fold collectedAt into the existing comparison. It sits on the snapshot root, not on snapshot.source, which is where generate-members.mjs copies it from. tests/validate-members-membership.test.mjs gains the case (a different valid timestamp, an unparseable one, null and absent all fail; the matching value passes) and its fixture now carries collectedAt like the generator's output. tests/e2e-data-fixture-validity.test.mjs records that the data-variant members.json overlay, which sets collectedAt to "not a timestamp" on purpose, now gains exactly this error, replacing the row's note that it should. Closes #1270 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Bob Killen <bkillen@linuxfoundation.org>
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.
Finding (#1270)
scripts/validate-members.mjscross-checksmembers.json'ssources.landscapeblock against the committedenduser-landscape.jsonsnapshot onrevisionandsourceUrlonly.collectedAt, written by the generator from the same snapshot in the same statement, was held to nothing, and it is the one field of the three the site renders (DirectoryFreshnessformats it into the "last synced" note). A stale or unparseablecollectedAtpassedvalidate:memberswhile the page printed a date the data did not support, or silently dropped the sentence.What changes
scripts/validate-members.mjs: the existing provenance comparison gainsdata.sources?.landscape?.collectedAt !== landscape.collectedAt. It compares against the snapshot root, notsnapshot.source, which is wheregenerate-members.mjscopies it from. Same error path and message as before (members.json.sources.landscape: landscape provenance must match enduser-landscape.json).tests/validate-members-membership.test.mjs: the fixture'ssources.landscapenow carriescollectedAtlike real generator output,run()takes a provenance override, and a new test pins that a different valid timestamp, an unparseable one,nulland absent all fail while the matching value passes.tests/e2e-data-fixture-validity.test.mjs: thedata-variant/members.jsonrow (which setscollectedAtto"not a timestamp"on purpose) now records the error it gains, replacing the comment that said closing this gap should produce exactly that.Verification
node --teston the three touched suites: 54 pass. With the validator change reverted, 2 fail (the new case and the fixture-validity row), so the tests pin the rule rather than restate it.npm run validate:memberson the committed data:Validated 101 members(the committedcollectedAtalready matches the snapshot).npm run test:unit:coverage:check: green, src 100/100 (the new||arm is covered).check:format: clean.Closes #1270