Give a promoted view back the time it saw a file #5
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/promoted-view-mtime"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Root cause
After a job touches a file whose content differs from its build snapshot, it may promote its upper as a new build layer without ever compiling that file.
promoterecords the view the job saw: the touched file is recorded at the touch time, while the layers below can still hold an artifact compiled from the older content.A later job at the same content saw only the source snapshot's single
SOURCE_MTIME_NStime. The guard inSnapshots::touchedrestored a same-content file's view time only when the source time was newer thanbuild.sealed_ns. Source snapshots are older than every build, so that was never true: the file kept the 2000-01-01 time, cargo compared it with the stale artifact's own old dep-info time, called it fresh, and kept the artifact.Fix
Restore a same-content file's view time whenever the view saw it later than the source snapshot (
seen > mine). The normal case still copies nothing: untouched files haveseen == mine == SOURCE_MTIME_NS. Dropping the old sealed-time condition is safe because subsequent promotion records a touched time later than every compile in the layers below.The regression test promotes a view after touching a file without a compile and then checks that the next job restores that view time. Separate cases cover unchanged files (no touched layer) and different content (made newer than the build).
Verification
snapshots::tests::on aarch64: 21 passed, 0 failed (cargo test -p t --bin t snapshots::tests::, runrf0de443706).[]instead of["dep.rs"](cargo test -p t --bin t snapshots::tests::a_promoted_view_restores_the_time_of_a_file_its_job_did_not_compile -- --exact, runr2bb3f81ef6).cargo clippy -p t --all-targets -- -D warningspasses.Operational notes
Deploy the new server and worker image to every node. Existing cached check results are keyed by source inputs, so they are not invalidated by this code change; after deployment, re-run the affected checks with
--forceon the fixed version to replace results produced by the stale build. Existing build snapshots need no manual deletion: the guard restores the recorded view time on use and cargo rebuilds the stale artifact. Views written by an older scheme may cause a one-time extra touch/rebuild until they are replaced or evicted normally.Pull request closed