Skip to content

fix: cross-validate snapshot digest against real OpenWiki functions#4

Merged
gpxl merged 1 commit into
mainfrom
claude/p2b-parity-crossvalidate
Jul 8, 2026
Merged

fix: cross-validate snapshot digest against real OpenWiki functions#4
gpxl merged 1 commit into
mainfrom
claude/p2b-parity-crossvalidate

Conversation

@gpxl

@gpxl gpxl commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fixes scripts/snapshot.sh's digest computation, which hashed a flat
    find-based file listing — diverging byte-for-byte from OpenWiki's
    createOpenWikiContentSnapshot. The walk now recurses per-directory and
    frames entries exactly as upstream does (dir:<relpath>\0,
    file:<relpath>\0<bytes>\0), so digests are interchangeable with real
    OpenWiki.
  • Adds tests/parity-crossvalidate.test.ts: an executable parity spec that
    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).
  • vitest.config.ts now also runs vendor/openwiki/test/update-noop.test.ts
    verbatim, proving the vendored copy is a faithful executable oracle.
  • Retires the hand-ported tests/noop.test.ts (superseded by the real-function
    interchange test) and drops two now-redundant hand-shaped cross-compat tests
    from tests/state.test.ts.
  • PARITY.md documents the updated re-validation procedure referencing
    vendor/openwiki/ as the executable oracle.

Bead: wj-apo (OPT2+ P2B). Unblocks wj-o87 (P2D).

Commits

  • 22f9e4b fix: cross-validate snapshot digest against real OpenWiki functions

Test plan

  • All tests pass (npm test — 63 passed, 9 files)
  • Lint clean (npm run lint — shellcheck)
  • Code-quality agent: PASS (scripts/snapshot.sh)
  • Manual verification

🤖 Generated with Claude Code

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>
@gpxl
gpxl merged commit f34a82d into main Jul 8, 2026
4 checks passed
@gpxl
gpxl deleted the claude/p2b-parity-crossvalidate branch July 8, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant