Repository navigation
fix(sandbox): the collision warning names its winner when layers are copied - #3480
Conversation
…copied The warning for a path two rootfs layers ship with different contents names the layer whose file stays by the inode the assembled path carries. With the cache and the rootfs on different filesystems the link pass copies each file, a copy has an inode of its own, and the warning said `winner = "unknown"` every time. The first-linked file stays, so the winner of a copied file is the first layer, in link order, that ships the path. That layer is named when its file agrees with the placed one by the link pass's own comparison, and the winner stays unknown when it does not, since the placed file then came from somewhere other than the layers. Refs gominimal/inbox#1226 Co-Authored-By: Claude <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Approved: no findings at Nothing to do. Clobber: none. |
An unchecked comparison means only that two files have equal size above the compare limit, which proves nothing about which source placed the file. collision_winner now names the first shipping layer of a copied file only when the link pass's comparison calls the two the same, so the warning says unknown rather than a possibly wrong layer. A new test covers the unchecked branch with sparse files above the limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
norrietaylor
left a comment
There was a problem hiding this comment.
Re-reviewed the change since cc37ff6: 4803066 and the main merge (the merge tree matches the automatic merge, so it has no hand edits). collision_winner now names the first shipper of a copied file only on LinkCollision::Same. An Unchecked result (equal sizes above COLLISION_COMPARE_MAX) gives unknown instead of a possibly wrong layer, and the new sparse-file test reaches that branch and asserts it.
[low] The PR body still says the first shipper is named when its file matches "by the link pass's own comparison (same bytes, or same size above the compare limit)". Since 4803066, a match is same bytes only, and a copied file above 4 MiB always reports unknown. Please update that sentence so the squash message is accurate. The lab table's 128 of 128 was measured before this commit. It should still hold, because the colliding npm files and man page are under the limit, but it was not re-run on this head.
|
Body corrected: the first shipper is named only when its file has the same bytes as the placed one, and a copied file above the 4 MiB compare limit reports |
Follow-up to #3272 for gominimal/inbox#1226: the warning for a path two rootfs layers ship with different contents names the layer whose file stays, but only when the layers were hardlinked.
What was wrong.
collision_winnerfinds the winning layer by the inode the assembled path carries. With the package cache and the daemon's state on different filesystems the link pass copies each file, a copy has an inode of its own, and no layer matches. The record then sayswinner = "unknown". A week of lab telemetry (2026-11-09 to 11-16) had that in 42,112 of 42,112 records.The fix. The first-linked file stays, so the winner of a copied file is the first layer, in link order, that ships the path. That layer is named only when its file has the same bytes as the placed one, by the link pass's own comparison. A copied file above the compare limit (4 MiB) is not read, so its winner is reported as
unknownand never guessed. When the bytes differ, the placed file came from somewhere other than the layers and the winner staysunknown. The hardlink case is unchanged and is tried first, so nothing is read for it.Tests. A new unit test places a copy of the first shipper's file and expects that layer; a later layer with the same bytes does not become the winner; a placed file that is not the first shipper's has no winner. The two existing tests (hardlink, symlink) are unchanged.
Lab evidence. A new scenario runs a task with
node,pnpmandpython, whose layers collide on npm's files and node's man page, on machines where the cache and the state are on different filesystems, and reads each collision record'swinnerfrom the daemon's log.unknownunknownThe table was measured before the last commit, which stopped naming a layer for an unread file above the compare limit. It was not re-run on this head. The colliding files in these scenarios (npm files and a man page) are all under the limit, so the counts are expected to hold.
A named winner is checked on the machine: it is a directory, it is not the loser, and it ships the path. Lint (fmt, clippy) and the full pre-push run passed at the tip.
One file,
crates/sandbox/src/lib.rs.🤖 Generated with Claude Code
Summary by CodeRabbit