Repository navigation
fix(ts): TypeId snapshots alike on every host - #633
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ile changes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 38 minutes. View limit details
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. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed head 6f13789 against base efa6300.
No actionable findings. The normalization is confined to the in-memory snapshot comparison and UPDATE_EXPECT output. It does not rewrite the translated output directory consumed by typecheck or the differential harness, so runtime TypeId equality, ordering, hashing, and Debug behavior are still exercised with the original hashes. The four changed snapshots retain repeated/distinct identities within each file, matching the helper's per-file numbering. The checked 32-byte prefix also guards the subsequent string slicing.
Direction: snapshot normalization is a reasonable boundary for this host-dependent representation; keep the differential execution unmasked. The matcher intentionally treats any quoted 32-digit lowercase hex literal as an ID, and per-file numbering does not itself check cross-file identity, so these snapshots complement rather than replace runtime differential coverage.
Verification limits: GitHub-only static inspection of all five changed files and the snapshot/typecheck/differential call paths. No Rust tests, profile-variation experiments, builds, or CI runs executed; the reported portability results were not independently reproduced. Rechecked open/non-draft state, full head/base and existing reviews immediately before posting.
(Written by review (OpenAI))

Problem
Since moq-dev/rust2#605, the
lang/dynsandlang/panics/hooksnapshots hold rustc's 128-bitTypeIdhashes, and localjust cion main fails on hosts whose cargo config differs from the one that wrote them (reported in moq-dev/rust2#632's Follow-ups).Cause, reproduced: not the checkout's path. One driver binary run from two checkouts at different paths gives the same
-C metadataand byte-identical output. Cargo hashes the build profile into a crate's-C metadata, which seeds itsStableCrateIdand so the hash of every type the crate defines. This host's~/.cargo/config.tomlsets[profile.dev] debug = false. Translating withCARGO_PROFILE_DEV_DEBUG=truereproduces the committed snapshots byte for byte, andbuild.incrementalchanges the hash too. Std's types (u8,&str) hash alike everywhere.Caused by
Approach
The snapshot comparison masks every
TypeId, a 32-hex string literal, as"<TypeId N>", numbered by first appearance in its file.UPDATE_EXPECTwrites the masked form, so a snapshot still shows which ids are equal. The translation still emits rustc's exact hash, so comparisons within a run,Debug'sTypeId(0x…)shape, and thetype_iddifferential tests are unchanged, and no differential assertion loosens.Decisions
.cargo/config.toml,CARGO_PROFILE_*in the environment, and each nightly bump (the rustc version seedsStableCrateIdtoo) would each need another pin, or churn these snapshots.quest startrefuses a quest that isn't on upstream main yet, so the claim is this PR from the quest's branch,quest/m0/typeid-snapshots.Impact
Alternatives
CARGO_PROFILE_DEV_*env: fragile, as above.-C metadatathroughRUSTFLAGS: rustc mixes it with cargo's own value rather than replacing it, so the profile still leaks through.Verification
CARGO_PROFILE_DEV_DEBUG=true, andCARGO_BUILD_INCREMENTAL=true.quest gate just cipasses in two checkouts at different paths.Follow-ups
🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with high effort)
Review
Rewritten by
quest reviewafter each round.01a1b4ee-1109-7f21-914c-ef4e73abf196, round 1The diff only normalizes snapshot TypeId literals, preserving equality within each file and leaving generated code and differential execution unchanged; no actionable defects were found, though tests were not run in the read-only environment.