cargo/wrapper: since every compile writes binary dep-info, a library placed now makes cargo build what stands on it again; the place_all guard test fails on every node that runs 46a0c02e #103

Open
opened 2026-11-18 11:26:00 +00:00 by xemmerling · 0 comments
Owner

t's own test drivers::cargo::workspaces::a_unit_older_than_its_build_script_s_run_is_built_again fails in every run of test/t on a node whose build carries 46a0c02e and ade48349. It is the guard of node::daemon::place_all (9b1bd2ac): a hit placed now leaves what is built on it fresh. Main's check set on testing cannot be green while it fails. Production does not run this build yet.

The runs

run on testing commit under test testing's node ran the test
r10ded5bd6b, ended 08:40:46Z 86a540fc d748ed8d pass (as in six runs before it today)
r10c5469e43, 10:02Z, t's own probe 29050be8, a change of one module's doc text 86a540fc fail, the only failing test
rf437970801, r7ad931f215, r030ee1e194, r2ac31f4e0c 0a6fd80f to 3ef8dfa5 86a540fc to 3ef8dfa5 fail
rbcf01ddada, 11:21Z, the test asked alone 891ef349 3ef8dfa5 fail, in one second
forge run 1580 0a6fd80f no t node, the runner's own wrapper PASS, 2.0 s

Testing was pinned to 86a540fc at 08:41:24Z (infra, apps/t-testing). So the commit under test does not decide it, the node's build does: a doc-only commit fails it and the same test file passes on the forge.

The assert that fails is workspaces.rs:814, "placed now, both stay fresh": after a's and b's libraries are set to now, in that order, cargo check builds something again.

My reading (from the commits' texts, not proven by a run)

Since 46a0c02e and ade48349 the wrapper gives every compile -Zbinary-dep-depinfo (wrapper/find.rs, Planned::of adds it where cargo asked for none), and wrapper/depinfo.rs leaves the sysroot's crates out of the dep-info but keeps the build directory's. The test's inner cargo check runs under the job's wrapper, so b's dep-info names a's library. Cargo takes a unit as stale when a file its dep-info names is newer than the dep-info. The test sets a's library to now, which is later than b's dep-info, and b is built again.

Why it may matter beyond the test

If the reading holds, then in any build directory that outlives one job, a kept build or a session's, a dependency's library placed anew is newer than the dep-info of everything built on it, and cargo runs each of those units again: a lookup and a placement, or a compile, per unit above every placed one, in every job that places. That would sit on top of the cold compile cache the promote of this main starts with. I have not measured it on testing: its own builds are small and mostly clean. What would show it is the count of units cargo runs again in a second job on a kept build of tilo's size.

What I did and did not do

  • Told you by t send at 10:54Z and 10:58Z (the second corrects the first, which blamed 0a6fd80f).
  • Fixed the other red test of main, which was a separate fault: 6bcbb31d, Workspace::cargo no longer hands a test's cargo the job's CARGO_INCREMENTAL=0. Proven on testing: that test alone passes (rd9bcd6512f), and the whole check set on the candidate fails this test only (r22f70fb617).
  • Nothing on this one. Whether the test should model a placement that also renews dep-info, or placement and the wrapper should keep dependents fresh under binary dep-info, is yours.

12:25Z 11-18: the test is green by db6c0f5e; the cost beyond it measured on testing and not found

The test. db6c0f5e ("a test's cargo is run without the job's environment") runs the tests' cargo as a shell gives it, without RUSTC_WRAPPER and the rest of cache_env, so the test's cargo check writes plain dep-info and the placement stays fresh. Its message states the mechanism as read above. Testing's own run on it, re322767b41, passed all nine checks at 12:25Z: main's check set on testing is green again. The guard now holds for plain cargo; it no longer runs under the wrapper.

The cost I feared, measured. If a library placed now made cargo run everything above it again, a job on a kept build would ask the cache for far more units than it places. Cache asks and placements during each of testing's own head runs (Prometheus, sum(increase(…{namespace="t-testing"}[330s])) at the run's end):

run node's build cache asks misses placed node placements
re2b9bb6fbb, a kept build d748ed8d, before 159 107 47 281
r10ded5bd6b, an empty build d748ed8d, before 1,008 142 841 5,047
rf437970801, first after the key change 86a540fc 977 970 1 6
r030ee1e194, an empty build 29a82beb 976 115 852 5,110
r2ac31f4e0c, an empty build 3ef8dfa5 989 129 852 5,110
r485517a18a, a kept build 3ef8dfa5 169 120 44 266

A run on a kept build asked 159 units for 47 placed before the change and 169 for 44 after it; a run from an empty build asked about a thousand both times. No run asks again above what it placed, so for t's own build the cost is not there. One pair of kept-build runs is a small sample, and t's graph is a tenth of tilo's.

What the table does show is the cold start: in the first run after the key change 970 of 977 asks missed and every unit was compiled and stored again. On production that is every unit of tilo once.

What stays. The same reading on production after the promote of this main: asks against placements per job on a kept build of tilo's size and on a session's build. I do it then and close this issue with it, unless you see a reason it cannot differ there.

t's own test `drivers::cargo::workspaces::a_unit_older_than_its_build_script_s_run_is_built_again` fails in every run of `test/t` on a node whose build carries 46a0c02e and ade48349. It is the guard of `node::daemon::place_all` (9b1bd2ac): a hit placed now leaves what is built on it fresh. Main's check set on testing cannot be green while it fails. Production does not run this build yet. ## The runs | run on testing | commit under test | testing's node ran | the test | |---|---|---|---| | r10ded5bd6b, ended 08:40:46Z | 86a540fc | d748ed8d | pass (as in six runs before it today) | | r10c5469e43, 10:02Z, t's own probe | 29050be8, a change of one module's doc text | 86a540fc | fail, the only failing test | | rf437970801, r7ad931f215, r030ee1e194, r2ac31f4e0c | 0a6fd80f to 3ef8dfa5 | 86a540fc to 3ef8dfa5 | fail | | rbcf01ddada, 11:21Z, the test asked alone | 891ef349 | 3ef8dfa5 | fail, in one second | | forge run 1580 | 0a6fd80f | no t node, the runner's own wrapper | PASS, 2.0 s | Testing was pinned to 86a540fc at 08:41:24Z (infra, `apps/t-testing`). So the commit under test does not decide it, the node's build does: a doc-only commit fails it and the same test file passes on the forge. The assert that fails is `workspaces.rs:814`, "placed now, both stay fresh": after `a`'s and `b`'s libraries are set to now, in that order, `cargo check` builds something again. ## My reading (from the commits' texts, not proven by a run) Since 46a0c02e and ade48349 the wrapper gives every compile `-Zbinary-dep-depinfo` (`wrapper/find.rs`, `Planned::of` adds it where cargo asked for none), and `wrapper/depinfo.rs` leaves the sysroot's crates out of the dep-info but keeps the build directory's. The test's inner `cargo check` runs under the job's wrapper, so `b`'s dep-info names `a`'s library. Cargo takes a unit as stale when a file its dep-info names is newer than the dep-info. The test sets `a`'s library to now, which is later than `b`'s dep-info, and `b` is built again. ## Why it may matter beyond the test If the reading holds, then in any build directory that outlives one job, a kept build or a session's, a dependency's library placed anew is newer than the dep-info of everything built on it, and cargo runs each of those units again: a lookup and a placement, or a compile, per unit above every placed one, in every job that places. That would sit on top of the cold compile cache the promote of this main starts with. I have not measured it on testing: its own builds are small and mostly clean. What would show it is the count of units cargo runs again in a second job on a kept build of tilo's size. ## What I did and did not do - Told you by `t send` at 10:54Z and 10:58Z (the second corrects the first, which blamed 0a6fd80f). - Fixed the other red test of main, which was a separate fault: 6bcbb31d, `Workspace::cargo` no longer hands a test's cargo the job's `CARGO_INCREMENTAL=0`. Proven on testing: that test alone passes (rd9bcd6512f), and the whole check set on the candidate fails this test only (r22f70fb617). - Nothing on this one. Whether the test should model a placement that also renews dep-info, or placement and the wrapper should keep dependents fresh under binary dep-info, is yours. ## 12:25Z 11-18: the test is green by db6c0f5e; the cost beyond it measured on testing and not found **The test.** db6c0f5e ("a test's cargo is run without the job's environment") runs the tests' cargo as a shell gives it, without `RUSTC_WRAPPER` and the rest of `cache_env`, so the test's `cargo check` writes plain dep-info and the placement stays fresh. Its message states the mechanism as read above. Testing's own run on it, re322767b41, passed all nine checks at 12:25Z: main's check set on testing is green again. The guard now holds for plain cargo; it no longer runs under the wrapper. **The cost I feared, measured.** If a library placed now made cargo run everything above it again, a job on a kept build would ask the cache for far more units than it places. Cache asks and placements during each of testing's own head runs (Prometheus, `sum(increase(…{namespace="t-testing"}[330s]))` at the run's end): | run | node's build | cache asks | misses | placed | node placements | |---|---|---|---|---|---| | re2b9bb6fbb, a kept build | d748ed8d, before | 159 | 107 | 47 | 281 | | r10ded5bd6b, an empty build | d748ed8d, before | 1,008 | 142 | 841 | 5,047 | | rf437970801, first after the key change | 86a540fc | 977 | 970 | 1 | 6 | | r030ee1e194, an empty build | 29a82beb | 976 | 115 | 852 | 5,110 | | r2ac31f4e0c, an empty build | 3ef8dfa5 | 989 | 129 | 852 | 5,110 | | r485517a18a, a kept build | 3ef8dfa5 | 169 | 120 | 44 | 266 | A run on a kept build asked 159 units for 47 placed before the change and 169 for 44 after it; a run from an empty build asked about a thousand both times. No run asks again above what it placed, so for t's own build the cost is not there. One pair of kept-build runs is a small sample, and t's graph is a tenth of tilo's. **What the table does show** is the cold start: in the first run after the key change 970 of 977 asks missed and every unit was compiled and stored again. On production that is every unit of tilo once. **What stays.** The same reading on production after the promote of this main: asks against placements per job on a kept build of tilo's size and on a session's build. I do it then and close this issue with it, unless you see a reason it cannot differ there.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
tilo/t#103
No description provided.