Skip to content

test(persist): v2 forward-compat — load with PERSIST_FORMAT_VERSION+1 - #65

Merged
zzylol merged 1 commit into
mainfrom
eval/persist-format-v2-forward-compat
Apr 30, 2026
Merged

zzylol merged 1 commit into
mainfrom
eval/persist-format-v2-forward-compat

Conversation

@zzylol

@zzylol zzylol commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes the open item in TODO.md §4 ("Serialization format versioning tests") with a self-updating contract test.

The earlier modules covered the fallback policy with hardcoded v999 sentinels — useful but doesn't track if the version constant is bumped. This PR adds a mod v2_forward_compat that uses PERSIST_FORMAT_VERSION + 1 directly, so the moment we bump v1 → v2 the test exercises the v1-snapshot/v2-code path without anyone touching test code.

Three sites covered:

  1. SchemaRegistry — bumps the JSON's version field, asserts safe-fallback + rewrite at v_current with no schemas leaked from the bumped blob.
  2. BackfillRegistry — same contract; also asserts next_job_id field presence post-fallback (no data corruption).
  3. SimpleMapStore part meta.bin — no fallback (parts are opaque), so the contract is a clean PersistError::Format("unsupported version ...").

Test plan

  • cargo test --package query_engine_rust --lib tests::persist_format_versioning_tests::v2_forward_compat — 3 passed, 0 failed

🤖 Generated with Claude Code

TODO.md §4 calls for "v1 snapshot loaded by v2 code → migrate or safe
fallback, no crash, no data corruption." The existing module covered the
policy with hardcoded v999 sentinels; this PR pins the contract to the
**actual constant + 1** so the tests self-update if the version is bumped.

New `mod v2_forward_compat` adds three tests covering all three
persistence sites:

* schema_v1_with_future_version_falls_back_and_rewrites_clean —
  SchemaRegistry rewrite is at v_current with the new config's schemas
  and no leakage from the bumped blob.
* backfill_v1_with_future_version_falls_back_and_rewrites_clean —
  same contract for BackfillRegistry, including next_job_id field
  presence post-fallback.
* part_meta_with_future_version_returns_format_error —
  SimpleMapStore part meta.bin: no fallback (each part is opaque), so a
  clean PersistError::Format("unsupported version ...") is the contract.

All three pass:

    test tests::persist_format_versioning_tests::v2_forward_compat::part_meta_with_future_version_returns_format_error ... ok
    test tests::persist_format_versioning_tests::v2_forward_compat::backfill_v1_with_future_version_falls_back_and_rewrites_clean ... ok
    test tests::persist_format_versioning_tests::v2_forward_compat::schema_v1_with_future_version_falls_back_and_rewrites_clean ... ok
@zzylol
zzylol merged commit 101df65 into main Apr 30, 2026
@zzylol
zzylol deleted the eval/persist-format-v2-forward-compat branch April 30, 2026 13:18
zzylol added a commit that referenced this pull request Apr 30, 2026
* §4 Serialization format versioning tests — mark done with #65
  and document the three landed tests (schema / backfill / part_meta)
  including the no-data-corruption assertion. Adds a defense-in-depth
  follow-up note for a live-restart docker-compose variant.
* §1 Cold-query fallback latency follow-up — point at #66
  (benchmarks/run_full_eval.sh). The runner exists and can produce
  the ≤2× P99 number; only blocker now is the ASAP_COLD_STORE_ROOT
  CLI flag wiring in asap-query-engine main.rs (de-scoped per the
  paper review — flagged here so we don't lose the dependency chain).

§2 (accuracy profile) and §5 (correctness proofs) intentionally
untouched — those weren't in scope for this round.
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