Repository navigation
fix(ffi): write the generated crate's paths relative to its export - #917
Conversation
Quest-Claim: 334c59ed7b0257fe
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…plain Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Important
The code is sound, but the docs this PR rewrites now state a reproducibility property the change takes away: moving the export with the crate fixed no longer gives the same libraries.
Approach: sound for what it claims. Writing the generated manifest's paths relative to the export, and falling back to absolute where .. would read differently to cargo than to the file system, is the right way to make the export's own bytes independent of the checkout. But it moves the dependency on location around rather than removing it, and the docs don't say so.
Reviewed changes
This run reviewed the full PR: the relative-path writer in glue.rs, its tests, and the README and quest rewrites.
Pathsinglue.rs: names the facade, each[patch]path, and eachself.cratespath dependency relative to the export. It keeps absolute paths when the export's spelled path holds a symlink, or when no relative path exists.- TOML round-trip:
self.patchand each dependency's keys are now parsed and re-serialized rather than pasted in, so key order inside the reached-crate inline tables changes once. export_is_relocatable: exports one crate with a path dependency from two checkouts at different depths, with the export at<checkout>/outin each, and compares every file.- Quest and README: the quest is resized to
[M]and narrowed to the builder half (one fixed build path); the README's "Not yet" bullet now says what is fixed and what is not.
I checked the places that consume the manifest. package.py build and web both build export_dir/Cargo.toml in place, so relative paths resolve. The out/export/Cargo.toml copy is only compared, never built. Both CI rebuilds keep the export at the same depth relative to source/: export again, and web/export vs web-again/export. So CI is unaffected.
⚠️ The glue's version hash now depends on where the export sits relative to the crate
Before, the manifest named the facade by absolute path. Two exports of one checkout at different export paths wrote the same Cargo.toml, so they got the same 0.0.0+<hash> version and the same glue symbols (the old quest measured this on Linux and for the wheels). Now path = "../.." versus "../../../source/api" changes with the export's depth, so the version hash changes too. So does every glue symbol.
The facade's own symbols still hash its absolute path, so the built libraries gain nothing yet. The net change for binaries: "crate fixed, export anywhere" becomes "crate fixed, export at the same relative position". That is fine as a step toward the fixed-link design, but the README and quest should say it, and the quest's next implementer should not build on "the export can still move".
Technical details
# Document that the export's position relative to the crate is now part of the build's identity
## Affected sites
- quest/m1/ffi-packaging/relocatable.md:24-25: "So `reproduce` can still only move the export, as it could before." No longer true: moving the export to another depth relative to the crate changes the manifest, the version hash, and every glue symbol.
- ffi/release/README.md:199-201: "A rebuild must still keep the crate at the same path" leaves out that the export must also keep its path relative to the crate (or simply its own path, as a rerun does).
## Required outcome
- Both docs say that, until the builder builds through one fixed spelling, a rebuild keeps both the crate's path and the export's path (or at least the export's position relative to the crate).
- The quest's recommendation section still reads correctly: the fixed-name link to the common ancestor fixes the relative position too, so it covers this.
## Open questions for the human
- Is giving up "export anywhere, crate fixed" acceptable for consumers before the builder half lands? CI keeps the export at the same depth in both `reproduce` paths (`export`, and `web/export` vs `web-again/export`), so CI is unaffected.claude-opus-5-5 | 𝕏
|
quest land watch: ended this pull request's pick, disarming its auto-merge, since its head 134aea2 is held by finding by pullfrog[bot]: This is no longer true after this PR. With the crate fixed, an export at another depth now writes a different relative ` (#917 (comment)). Push a fix, or answer each by a thread reply or a comment linking its review or decision, then land it again. (written by quest land watch) |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the docs-only delta since the prior pullfrog review.
- README — the "Not yet" bullet now says the relocation holds while the export keeps its position relative to the crate, and that a rebuild keeps the export in place beside it.
- Quest —
relocatable.mdrecords that an export at another depth writes another relative path and hash, and thatreproducekeeps the export's depth below the common ancestor.
This addresses the earlier finding about the export's position becoming part of the build's identity.
claude-sonnet-5-5 | 𝕏
… writes #909's sdist keyed each local package by its absolute path and #917 made the generated manifest spell them relative to the export, so the sdist refused every export on a checkout without a symlink, and unreached_types expected the absolute spelling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since #917 the generated manifest names each local package relative to the export, which the sdist's relocation, keyed by absolute paths, refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claims quest/m1/ffi-packaging/relocatable.md.
Problem
The generated crate's version hashes its
Cargo.toml, which named the facade by absolute path, and cargo hashes that version into every symbol: two checkouts of one commit made different libraries.Approach
glue.rswrites each path in the generated manifest relative to the export: the facade, each[patch]path, and each path crate the glue reaches (Paths). Two exports of one commit at other paths are now byte for byte equal while each keeps its position relative to its crate; an export at another depth writes another relative path and so another version hash (documented in the quest andffi/release/README.md, after Pullfrog's finding).It keeps the absolute path where a relative one would read wrong: an export whose own path holds a symlink (cargo joins
..lexically, the file system does not), or one on another Windows drive from the crate.The quest is not finished, and its premise was half wrong. Cargo hashes a path package that lies outside the workspace root into its metadata by its absolute path, so the facade's own symbols still differ between checkouts, whatever the manifest says. I measured it: two copies of the repo at other paths, exports equal,
cargo build --releasewith--remap-path-prefixon both: every symbol equal except the five statics of the facade crate. Soreproducestill cannot move the source. The quest is rewritten to what remains (a fixed build path inpackage.py, which also covers the Windows GNUdlltoolpath) with a recommendation and the reason it needs CI on macOS and Windows to try.Impact
Cargo.tomltext changes (relativepath = "../..."), so every export's version hash (0.0.0+<hash>) and each symbol hash changes once. No migration.ffi/release/README.md's "Not yet" bullet now says what is fixed and what is not.Validation
export_is_relocatable(new): exports one crate with a path dependency from two checkouts at different depths and fails unless every file of the two exports matches. Checked that it fails with the relative path switched off.[patch]rewrite, thecratesdependency rewrite, and the symlink and..fallbacks.diff -rof the exports is empty (before,Cargo.tomlandCargo.lockdiffered). Built both with the remap flags: the.afiles differ only in the five facade statics, as above.just cipasses locally (clippy, fmt, the exporter's tests).Alternatives
/tmp, since cargo joins..lexically; it falls back to absolute instead.Decisions
Taken on my recommendation, the user being away:
cli.rs's other absolute paths (--with,--baseline, the roots) alone: they are inputs of the check, never written into the export, and the test shows the export unchanged by them.[M].package.py buildruns cargo. Alternative: a target directory under a fixed absolute root, which fixes only the dlltool path.Follow-ups
None new: the quest's remaining work is rewritten in place.
Models
Size: M
Implementer: Claude Code, claude-sonnet-5-5, unknown effort (arm B)
🤖 Generated with Claude Code
(Written by Claude Sonnet 5.5)
Review
Rewritten by
quest reviewafter each round.Head: 0680f68
Base: origin/main at dc27f60
Risk: medium,
the base has no RISK.md to name what is always high or customer-facing, so every change is mediumClassified: medium by default
Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1f8b2-9d19-7a11-ae8f-6f86805a10ce, round 3Score: 10/10,
The incremental changes accurately clarify the relative-position requirement in documentation and introduce no new issues.Rounds: 3; first round 2 (medium 2); findings 2 (medium 2): fixed 2, refuted 0, open 0
Findings: none
Summary by CodeRabbit
New Features
Documentation
Summary by CodeRabbit
New Features
Documentation