[shared] fix(unit): key a rust build cache on its toolchain #106

Merged
cjournois merged 1 commit from fix/ci-unit-rust-toolchain-cache into main 2026-11-13 22:55:17 +00:00
Collaborator

A rust toolchain bump fails test-coverage under the 95 floor (janus#124 on 1.100): the deps cache key hashed only lockfiles, so the 1.99-built target was restored and llvm-cov counted its stale test objects. Consumers: every rust unit on the unit/quality workflows (project/janus, cjournois/library ws, …); their next run after the bump starts from a cold target once.

Verified: just lint test passes; the new bats case fails before the fix. Locally, 1.100 over a 1.99 target gives 91.83% lines, a fresh target gives 97.17%.
Run: https://git.journois.com/project/janus/actions/runs/808

Session: c5bfd143-9ce1-4a61-807a-1fc6f70694eb

A rust toolchain bump fails `test-coverage` under the 95 floor (janus#124 on 1.100): the deps cache key hashed only lockfiles, so the 1.99-built `target` was restored and llvm-cov counted its stale test objects. Consumers: every rust unit on the unit/quality workflows (project/janus, cjournois/library `ws`, …); their next run after the bump starts from a cold `target` once. Verified: `just lint test` passes; the new bats case fails before the fix. Locally, 1.100 over a 1.99 target gives 91.83% lines, a fresh target gives 97.17%. Run: https://git.journois.com/project/janus/actions/runs/808 Session: c5bfd143-9ce1-4a61-807a-1fc6f70694eb
fix(unit): key a rust build cache on its toolchain
All checks were successful
ci: reusable-pipeline / CI Pipeline (pull_request) Successful in 1m0s
57e37dcf93
janus#124 (rust 1.100): test-coverage exits 1, lines under the 95 floor.
The deps key hashed only lockfiles, so the 1.99-built target was restored
and llvm-cov counted its stale test objects (repro: 91.83% vs 97.17% clean).
Rust key and fallback now carry a hash of mise.toml / rust-toolchain files.
Confidence: high; reproduced locally in CI's order.

Session: c5bfd143-9ce1-4a61-807a-1fc6f70694eb
Author
Collaborator

Addressed:

  • scripts/unit-facts.sh:68 — toolchain files are now collected in every directory from the unit up to the repo root (a pin in an intermediate dir was missed), and mise.local.toml / .tool-versions are hashed too.
  • tests/unit-facts.bats:179 — the rust restore prefix is pinned to rust-svc-<12 hex>-.
  • tests/unit-facts.bats:219 — new case: an intermediate pin changes the key (fails before this change), and a bun key ignores mise.toml.
  • docs/components/unit.md:56 — reworded to what the key covers: a change to those files; floating pins and an image's rust are not covered, and any tool change forces a cold rust build.

Session: c5bfd143-9ce1-4a61-807a-1fc6f70694eb

Addressed: - scripts/unit-facts.sh:68 — toolchain files are now collected in every directory from the unit up to the repo root (a pin in an intermediate dir was missed), and `mise.local.toml` / `.tool-versions` are hashed too. - tests/unit-facts.bats:179 — the rust restore prefix is pinned to `rust-svc-<12 hex>-`. - tests/unit-facts.bats:219 — new case: an intermediate pin changes the key (fails before this change), and a bun key ignores `mise.toml`. - docs/components/unit.md:56 — reworded to what the key covers: a change to those files; floating pins and an image's rust are not covered, and any tool change forces a cold rust build. Session: c5bfd143-9ce1-4a61-807a-1fc6f70694eb
bot-claude force-pushed fix/ci-unit-rust-toolchain-cache from 57e37dcf93
All checks were successful
ci: reusable-pipeline / CI Pipeline (pull_request) Successful in 1m0s
to 7e29f2da41
All checks were successful
ci: reusable-pipeline / CI Pipeline (pull_request) Successful in 1m0s
2026-11-13 09:25:49 +00:00
Compare
Author
Collaborator

Addressed:

  • scripts/unit-facts.sh:74 — the toolchain walk also stops at /, so an absolute UNIT_DIR no longer loops forever.
  • tests/unit-facts.bats:236 — new case: a root unit gets a toolchain key, and an absolute unit path returns (fails before this change).
  • docs/components/unit.md:56 — names what the key does not cover: mise's other config paths and pins below the unit.

Session: c5bfd143-9ce1-4a61-807a-1fc6f70694eb

Addressed: - scripts/unit-facts.sh:74 — the toolchain walk also stops at `/`, so an absolute `UNIT_DIR` no longer loops forever. - tests/unit-facts.bats:236 — new case: a root unit gets a toolchain key, and an absolute unit path returns (fails before this change). - docs/components/unit.md:56 — names what the key does not cover: mise's other config paths and pins below the unit. Session: c5bfd143-9ce1-4a61-807a-1fc6f70694eb
bot-claude force-pushed fix/ci-unit-rust-toolchain-cache from 7e29f2da41
All checks were successful
ci: reusable-pipeline / CI Pipeline (pull_request) Successful in 1m0s
to 44dd55b62c
All checks were successful
ci: reusable-pipeline / CI Pipeline (pull_request) Successful in 1m2s
ci: reusable-pipeline / CI Pipeline (push) Successful in 1m0s
2026-11-13 09:32:48 +00:00
Compare
bot-claude changed title from WIP: [shared] fix(unit): key a rust build cache on its toolchain to [shared] fix(unit): key a rust build cache on its toolchain 2026-11-13 09:38:31 +00:00
bot-claude left a comment

Verdict: pass-with-nits

A rust unit's deps key and restore prefix now carry a hash of the toolchain files from the unit up to the repo root, so a toolchain bump restores no target built under the old pin; other languages' keys are byte-identical to main's. CI and just lint test are green; each new bats case fails before its change.

Nits:

  • scripts/unit-facts.sh:74 — with an absolute UNIT_DIR the walk goes past the repo root to / (never misses a file, but docs/components/unit.md:56 says "up to the repo root"); stop at $PWD or reword.
  • docs/components/unit.md:56 — "a lockfile change restores the unit's latest entry" now means, for rust, the latest one with the same toolchain hash.
  • tests/unit-facts.bats:219 — one case covers two behaviours (intermediate pin, bun ignores the toolchain); could be split.
  • scripts/unit-facts.sh:72 — UNIT_DIR=./ hashes the root mise.toml twice; stable, cosmetic.

Session: c5bfd143-9ce1-4a61-807a-1fc6f70694eb

Verdict: pass-with-nits A rust unit's deps key and restore prefix now carry a hash of the toolchain files from the unit up to the repo root, so a toolchain bump restores no `target` built under the old pin; other languages' keys are byte-identical to main's. CI and `just lint test` are green; each new bats case fails before its change. Nits: - scripts/unit-facts.sh:74 — with an absolute `UNIT_DIR` the walk goes past the repo root to `/` (never misses a file, but docs/components/unit.md:56 says "up to the repo root"); stop at `$PWD` or reword. - docs/components/unit.md:56 — "a lockfile change restores the unit's latest entry" now means, for rust, the latest one with the same toolchain hash. - tests/unit-facts.bats:219 — one case covers two behaviours (intermediate pin, bun ignores the toolchain); could be split. - scripts/unit-facts.sh:72 — `UNIT_DIR=./` hashes the root `mise.toml` twice; stable, cosmetic. Session: c5bfd143-9ce1-4a61-807a-1fc6f70694eb
bot-claude removed their assignment 2026-11-13 09:38:31 +00:00
bot-claude 2026-11-13 09:38:32 +00:00
Author
Collaborator

Handing this over: two review rounds are done and only the nits above remain, so whether to take them is your call. CI on 44dd55b is green.

Needed from you: merge (or ask for the nits), then release. project/janus#124 and cjournois/library#287 (rust 1.100) go green once they run on the release, since their test-coverage fails only on the 1.99-built target this key change stops restoring.

Session: c5bfd143-9ce1-4a61-807a-1fc6f70694eb

Handing this over: two review rounds are done and only the nits above remain, so whether to take them is your call. CI on 44dd55b is green. Needed from you: merge (or ask for the nits), then release. project/janus#124 and cjournois/library#287 (rust 1.100) go green once they run on the release, since their `test-coverage` fails only on the 1.99-built `target` this key change stops restoring. Session: c5bfd143-9ce1-4a61-807a-1fc6f70694eb
cjournois deleted branch fix/ci-unit-rust-toolchain-cache 2026-11-13 22:55:17 +00:00
Sign in to join this conversation.
No reviewers
No labels
needs-human
No milestone
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
cjournois/reusable-pipeline!106
No description provided.