Skip to content

Add spec-declared checksums for static tables; validate lockfile fast path - #32

Merged
frigusgulo merged 1 commit into
mainfrom
26-checksum-manifest
Jul 30, 2026
Merged

Add spec-declared checksums for static tables; validate lockfile fast path#32
frigusgulo merged 1 commit into
mainfrom
26-checksum-manifest

Conversation

@frigusgulo

Copy link
Copy Markdown
Collaborator

Summary

Phase 3 of 3 for #26. Re-opened as a fresh PR: this was #31, which GitHub auto-closed when its stacked base branch (#29's) was deleted on merge. Identical content, now based on main; CI already passed on this commit in #31.

Phase 2's (#29) sidecar hashes are computed from whatever was downloaded, so they cannot catch a cache poisoned before the sidecar was written. And the ResolvePipeline lockfile fast path — the mechanism that made a truncated table "resolved as satisfied on every later run" — trusted entries with only an existence check; its "will re-resolve on next run" log line was never true, since the fast path always returned.

Changes

  1. Spec-declared checksums. ResourceProductSpec and SearchTarget gain an optional checksum field (sha256:<hex> of the file as served), carried through ResourceCatalog.build. Intended for entries that resolve to exactly one file from an immutable source.

  2. WormHole treats a declared checksum as authoritative. Cache hits must match it — evicted and re-downloaded otherwise, even when the sidecar agrees with the corrupt content. Fresh downloads are verified against it (after the size check) with one retry before anything is cached.

  3. Lockfile fast-path validation. ResolvePipeline now validates each aggregate-lockfile entry against its per-file sidecar hash (aggregate entries carry no hash of their own), and when any required entry is missing or corrupt it falls through to a full re-resolution, overwriting the stale lockfile — making the existing log message true.

  4. All 12 PRIDE table products declare checksums in pride_table_config.yaml, computed from the files at the pinned commit b7451a8 (Pin PRIDE-PPPAR table source to commit SHA instead of floating master #27) and cross-checked against the GitHub Contents API sizes. The re-pin procedure comment now includes regenerating them.

Verification

  • 8 new tests: declared-checksum download/cache behavior (incl. the poisoned-cache-with-consistent-sidecar case), ResourceCatalog pass-through, and lockfile-entry validation. 430 non-integration tests pass; ruff check/format clean.
  • The shipped pride_table_config.yaml parses via ResourceSpec.from_yaml with all 12 checksums present.

Known limitation

A file found by local search (not via lockfile or download) is still trusted without a checksum comparison. With downloads verified at creation and the fast path validated, no new poisoned cache can be created; this residual applies only to pre-existing corrupt files placed by other means.

Closes #26.

🤖 Generated with Claude Code

… path

Builds on the download-integrity work: sidecar hashes are computed from
whatever was downloaded, so they cannot catch a cache that was poisoned
before the sidecar was written, and the ResolvePipeline lockfile fast
path trusted entries with only an existence check — its 'will re-resolve
on next run' log line was never true, since the fast path always
returned.

- ResourceProductSpec/SearchTarget gain an optional checksum field
  (sha256:<hex> of the file as served), carried through
  ResourceCatalog.build. Meaningful for entries that resolve to exactly
  one file from an immutable source.

- WormHole.download_one treats a declared checksum as authoritative:
  cache hits must match it (evict + re-download otherwise, even when
  the sidecar agrees with the corrupt content), and fresh downloads are
  verified against it with one retry before anything is cached.

- ResolvePipeline validates lockfile entries against their per-file
  sidecar hashes (aggregate entries carry no hash of their own) and
  falls through to full re-resolution when any required entry is
  missing or corrupt, overwriting the stale lockfile.

- pride_table_config.yaml declares checksums for all 12 table products,
  computed from the files at the pinned PRIDE-PPPAR commit b7451a8 and
  cross-checked against the GitHub Contents API sizes. The re-pin
  procedure note now includes regenerating them.

Part of #26 (phase 3 of 3).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@frigusgulo
frigusgulo merged commit 3298ee6 into main Jul 30, 2026
6 checks passed
@frigusgulo
frigusgulo deleted the 26-checksum-manifest branch July 30, 2026 22:38
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.

Pin PRIDE-PPPAR table source + vendor/validate tables (unpinned @master causes missing/corrupt tables)

1 participant