fix(hir): salt class-capture names on the module name, not the absolute path (#7177) - #7806
Merged
Merged
Conversation
proggeramlug
force-pushed
the
fix/7177-cap-salt-reproducible
branch
from
August 10, 2026 22:07
b289456 to
43ca8fe
Compare
📝 WalkthroughWalkthroughThe lowering context now derives capture salts from module names instead of absolute source paths. Module lowering uses the new salted constructor. Existing test-only paths retain path-based salting. New tests cover reproducibility, module isolation, inheritance sharing, and distinct captures. ChangesCapture salt stability
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
pull Bot
pushed a commit
to Mu-L/perry
that referenced
this pull request
Aug 11, 2026
Covers the 32 PRs admin-merged in one pass (audited in principle at the maintainer's direction): PerryTS#7768 PerryTS#7772 PerryTS#7779 PerryTS#7784 PerryTS#7785 PerryTS#7786 PerryTS#7788 PerryTS#7789 PerryTS#7797 PerryTS#7798 PerryTS#7801 PerryTS#7802 PerryTS#7804 PerryTS#7805 PerryTS#7806 PerryTS#7807 PerryTS#7808 PerryTS#7810 PerryTS#7811 PerryTS#7815 PerryTS#7816 PerryTS#7818 PerryTS#7819 PerryTS#7820 PerryTS#7821 PerryTS#7822 PerryTS#7823 PerryTS#7824 PerryTS#7825 PerryTS#7826 PerryTS#7827 PerryTS#7828. (PerryTS#7787 closed as already-landed via the PerryTS#7786 stack.) Per-change history lives in each PR's changelog.d fragment as usual. Claude-Session: https://claude.ai/code/session_01Y1QZ5wUP9gRSwpiweT4Wix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Class-capture symbol names no longer depend on the working directory (#7177) — the same source compiled from two different directories now produces byte-identical IR.
The per-module salt in
__perry_cap_<id>m<salt>was an FNV hash of the canonical absolute source path, so it changed with the checkout location. Reproducible builds were impossible by construction, and every IR/object A/B harness had to independently discover the dependency and pin cwd — #7176's byte-neutrality harness measured 29 of 29 same-compiler control runs differing once it used per-runmkdtempdirectories.Reproduced before touching anything: the same 8-line source compiled from two directories differed in exactly 4 lines of IR, all of them the salt string (
m000059ddd802vsm0000f0a10f23). Everything else — including theprog_tsmodule prefix on every other symbol — was already identical, which is the tell: the module NAME was reproducible all along, and only the salt reached past it to the filesystem.So the salt now keys on the module name. That is not merely convenient, it is the identity that already satisfies all three properties the salt needs:
perry_fn_<mod>__…,perry_global_<mod>__…), so it cannot vary with the checkout without breaking far more than this.a/util.tsandb/util.tsbecomea_util_tsandb_util_ts. Verified with two same-basename modules whose capture stashes must not merge: distinct salts, correct output.with_class_id_startkeeps its old path-based behaviour for the#[cfg(test)]lowering entry points that have no module name; the production path uses the newwith_class_id_start_salted.Verified: IR byte-identical across two working directories (was: 4 lines differing); same-basename modules keep distinct salts and match Node;
test_gap_cap_salt_reproducible_7177.tspasses byte-for-byte. The gap test deliberately covers the properties rather than the reproducibility itself — a.tstest cannot compile itself from two directories — pinning cross-module isolation, same-module inheritance sharing, and two distinct captures in one module, so a future re-keying that is too coarse or too fine fails rather than silently merging stashes.cargo test -p perry-hir293 passed,cargo test -p perry902 passed,test_gap_class24/24.Summary by CodeRabbit
Bug Fixes
Tests
Documentation