fix: cross-validate snapshot digest against real OpenWiki functions#4
Merged
Conversation
scripts/snapshot.sh hashed a flat, find-based file listing, which diverges byte-for-byte from OpenWiki's createOpenWikiContentSnapshot (recursive per-directory walk framing subdirectories as "dir:<relpath>\0" and files as "file:<relpath>\0<bytes>\0"). Rewrite the walk to match the real algorithm exactly so snapshot digests are interchangeable with upstream. Add tests/parity-crossvalidate.test.ts, which runs wijzer's bash directly against the vendored real OpenWiki functions (getUpdateNoopStatus, shouldCheckUpdateNoop, createOpenWikiContentSnapshot, writeLastUpdateMetadata) over shared temp repos and asserts equivalence, documenting the two intended distribution-method deltas (shouldSkip<->noop field naming, timestamp precision). This is a stronger parity guarantee than the hand-ported tests/noop.test.ts, which is retired in this change. vitest.config.ts now also runs vendor/openwiki/test/update-noop.test.ts verbatim to prove the vendored copy is faithful. tests/state.test.ts drops two hand-shaped cross-compat tests now superseded by the real-function interchange test. PARITY.md documents the new re-validation procedure. Fixes wj-apo (OPT2+ P2B). Unblocks wj-o87 (P2D). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
scripts/snapshot.sh's digest computation, which hashed a flatfind-based file listing — diverging byte-for-byte from OpenWiki's
createOpenWikiContentSnapshot. The walk now recurses per-directory andframes entries exactly as upstream does (
dir:<relpath>\0,file:<relpath>\0<bytes>\0), so digests are interchangeable with realOpenWiki.
tests/parity-crossvalidate.test.ts: an executable parity spec thatruns wijzer's bash directly against the vendored real OpenWiki functions
(
getUpdateNoopStatus,shouldCheckUpdateNoop,createOpenWikiContentSnapshot,writeLastUpdateMetadata) over sharedtemp repos and asserts equivalence, documenting the two intended
distribution-method deltas (
shouldSkip<->noopfield naming, timestampprecision).
vitest.config.tsnow also runsvendor/openwiki/test/update-noop.test.tsverbatim, proving the vendored copy is a faithful executable oracle.
tests/noop.test.ts(superseded by the real-functioninterchange test) and drops two now-redundant hand-shaped cross-compat tests
from
tests/state.test.ts.PARITY.mddocuments the updated re-validation procedure referencingvendor/openwiki/as the executable oracle.Bead: wj-apo (OPT2+ P2B). Unblocks wj-o87 (P2D).
Commits
Test plan
npm test— 63 passed, 9 files)npm run lint— shellcheck)🤖 Generated with Claude Code