feat(manifest): add strict v1 compatibility foundation#27
Conversation
PR Summary by QodoBump ordvec to 0.7 (schema v2) and add reproducible bundle test
AI Description
Diagram
High-Level Assessment
Files changed (9)
|
Code Review by Qodo
1. Non-exclusive temp bundle dirs
|
| fn identical_inputs_produce_byte_identical_bundle() { | ||
| let bundle_a = temp_bundle("repro-a"); | ||
| let bundle_b = temp_bundle("repro-b"); | ||
| let _ = std::fs::remove_dir_all(&bundle_a); | ||
| let _ = std::fs::remove_dir_all(&bundle_b); | ||
|
|
||
| // Two independent builds from the same inputs. | ||
| write_idmap_bundle(&bundle_a); | ||
| write_idmap_bundle(&bundle_b); | ||
|
|
||
| let files_a = read_bundle_files(&bundle_a); | ||
| let files_b = read_bundle_files(&bundle_b); | ||
|
|
||
| // The manifest must be byte-identical: schema v2 emits no per-build | ||
| // UUIDs or timestamps. | ||
| let manifest_a = files_a | ||
| .get(std::path::Path::new(crate::artifacts::MANIFEST_FILE)) | ||
| .expect("bundle A has a manifest"); | ||
| let manifest_b = files_b | ||
| .get(std::path::Path::new(crate::artifacts::MANIFEST_FILE)) | ||
| .expect("bundle B has a manifest"); | ||
| assert_eq!( | ||
| manifest_a, manifest_b, | ||
| "manifest.json must be byte-identical across builds from identical inputs" | ||
| ); | ||
|
|
||
| // The whole bundle must be byte-identical: same set of files, each | ||
| // with identical bytes. | ||
| assert_eq!( | ||
| files_a.keys().collect::<Vec<_>>(), | ||
| files_b.keys().collect::<Vec<_>>(), | ||
| "both bundles must contain the same set of files" | ||
| ); | ||
| assert_eq!( | ||
| files_a, files_b, | ||
| "the entire .odb bundle must be byte-identical across builds from identical inputs" | ||
| ); | ||
|
|
||
| let _ = std::fs::remove_dir_all(&bundle_a); | ||
| let _ = std::fs::remove_dir_all(&bundle_b); | ||
| } |
There was a problem hiding this comment.
1. Non-exclusive temp bundle dirs 🐞 Bug ☼ Reliability
The new reproducibility test uses a predictable path under the shared OS temp directory and unconditionally calls remove_dir_all on it; this can lead to rare test flakiness (stale paths / PID reuse / external pre-creation) and makes cleanup unreliable when the test fails mid-assertion. Using an exclusive TempDir-style API would make the test isolated and self-cleaning.
Agent Prompt
## Issue description
The test `identical_inputs_produce_byte_identical_bundle` creates bundle directories by joining a formatted string onto `std::env::temp_dir()` and then recursively deletes those paths with `remove_dir_all`. This is not an exclusive/atomic temp directory creation pattern, so in unusual environments (stale leftovers, PID reuse, or external pre-creation) it can cause test flakiness and/or delete content the test didn’t create; additionally, cleanup won’t run if the test panics before the final `remove_dir_all` calls.
## Issue Context
This is test-only code, but it runs in CI and locally; failures or panics can leave behind temp directories and make later runs behave unexpectedly.
## Fix Focus Areas
- ordinaldb/src/manifest.rs[212-218]
- ordinaldb/src/manifest.rs[257-297]
### Suggested approach
- Replace `temp_bundle(...)` usage in this test with `tempfile::TempDir` (or similar) so directories are created uniquely and cleaned up via RAII even on panic.
- Optionally refactor `temp_bundle` (used by other tests) to return a `TempDir`/guard object instead of a plain `PathBuf`, or create a test-local helper for this specific test.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38c3dab490
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| ordvec = "0.6.0" | ||
| ordvec-manifest = { version = "0.6.0", default-features = false } | ||
| ordvec = "0.7.0" | ||
| ordvec-manifest = { version = "0.7.0", default-features = false } |
There was a problem hiding this comment.
Preserve schema-v1 bundle loading
Keep a compatibility path for schema-v1 manifests before switching the verifier to ordvec-manifest 0.7: existing bundles now reach the v2-only, unknown-field-denying parser through OrdinalIndex::load, so manifests containing schema_version: "ordvec.index_manifest.v1", manifest_id, created_at, and build.invocation_id are rejected. This breaks the explicitly supported migration exercised by test_committed_previous_layout_fixture_loads, whose committed fixture still has exactly that v1 manifest; users likewise cannot reopen or migrate bundles written by the previous release.
Useful? React with 👍 / 👎.
PR #27 review nit: the comment claimed the patch would be removed 'at the ordvec 0.6.0 publish' — a publish that never happened, and this PR bumped past it to 0.7.0. Restate it accurately: ordvec is unpublished, so the workspace tracks ordvec main (now 0.7.0, schema v2); remove the patch when ordvec is published. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| # ordvec is not yet published to crates.io, so the workspace builds against | ||
| # ordvec main (currently 0.7.0 — deterministic manifest schema v2). Remove this | ||
| # patch once ordvec is published, restoring crates.io version resolution. |
There was a problem hiding this comment.
1. Misleading patch removal comment 🐞 Bug ⚙ Maintainability
The comment says to remove the [patch.crates-io] override once “ordvec” is published, but the patch section also overrides ordvec-manifest; if the crates are not published to crates.io in lockstep, this wording can lead to premature patch removal and build breakage. This is a documentation hazard in a release-critical area (dependency source selection).
Agent Prompt
### Issue description
The comment above `[patch.crates-io]` refers only to `ordvec` being published, but the patch section overrides both `ordvec` and `ordvec-manifest`. This can mislead future maintainers into removing the patch when only one of the two crates is available on crates.io.
### Issue Context
The workspace uses git patches for both crates:
- `ordvec = { git = ..., branch = "main" }`
- `ordvec-manifest = { git = ..., branch = "main" }`
### Fix Focus Areas
- Cargo.toml[25-27]
### Suggested change
Update the comment to explicitly mention **both** `ordvec` and `ordvec-manifest` (and ideally the expectation that they are published together), e.g. “Remove these patches once both `ordvec` and `ordvec-manifest` are published to crates.io …”.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit 19ab391 |
19ab391 to
72a92e7
Compare
72a92e7
into
dogfood/read-verified-plan-reuse-report-rows
8310121 to
c043edb
Compare
What changed
ordinaldb-manifest0.2.0 as OrdinalDB's sole directordvec-manifestpolicy boundary.ordvecandordvec-manifest0.6.0 and pin both to merged ordvec SHA51ee981c87e9e4dad414106f8946f0464c721907in all five independently locked Cargo roots.ordinaldb::manifestload and verification APIs through one compatibility facade.manifest_idandcreated_at.Integration and release boundary