GRI-1906: invalidate dummy-build cargo cache for shared/client in server Dockerfile #121

Merged
vivy merged 1 commit from fix/GRI-1906-docker-shared-cache into dev 2026-11-10 22:57:54 +00:00
Member

Summary

The server image's dependency-warming trick in packaging/server/Dockerfile
compiled shared and client against a stub (touch-only) lib.rs in the
first RUN, then deleted only the dummy sources and server's own
binary/deps before COPYing in the real sources. Cargo's mtime-based
fingerprint for shared/client survived into the final build, so it linked
the stub instead of recompiling against the real code — currently a hard
failure (the real shared has modules the stub never had), and a silent
stale-logic risk once that stops being true.

Fix: cargo clean --release -p shared -p client right after the dummy build,
before the dummy sources are deleted (it needs the still-present manifest to
resolve what -p shared even means). This forces the final RUN cargo build
to recompile shared/client from the real, just-COPY'd source, while
still reusing the warmed external-dependency cache for everything else.

Test plan

No Docker access on this account (docker.sock is root:docker, no sudo).
Reproduced the exact RUN sequence outside Docker instead, in a scratch
workspace mirroring the builder stage's file layout:

  • dummy build (stub lib.rs) succeeds, compiling shared from the stub
  • cargo clean --release -p shared -p client, then delete dummy src/
  • copy in the real crates/shared and crates/server sources
  • final cargo build --release --locked -p server prints Compiling shared v0.1.0 and Compiling server v0.1.0 (not just server), and
    succeeds — confirming shared is recompiled against the real source
    instead of linking the stub
## Summary The server image's dependency-warming trick in `packaging/server/Dockerfile` compiled `shared` and `client` against a stub (`touch`-only) `lib.rs` in the first `RUN`, then deleted only the dummy *sources* and `server`'s own binary/deps before `COPY`ing in the real sources. Cargo's mtime-based fingerprint for `shared`/`client` survived into the final build, so it linked the stub instead of recompiling against the real code — currently a hard failure (the real `shared` has modules the stub never had), and a silent stale-logic risk once that stops being true. Fix: `cargo clean --release -p shared -p client` right after the dummy build, before the dummy sources are deleted (it needs the still-present manifest to resolve what `-p shared` even means). This forces the final `RUN cargo build` to recompile `shared`/`client` from the real, just-`COPY`'d source, while still reusing the warmed external-dependency cache for everything else. ## Test plan No Docker access on this account (`docker.sock` is `root:docker`, no sudo). Reproduced the exact `RUN` sequence outside Docker instead, in a scratch workspace mirroring the builder stage's file layout: - [x] dummy build (stub `lib.rs`) succeeds, compiling `shared` from the stub - [x] `cargo clean --release -p shared -p client`, then delete dummy `src/` - [x] copy in the real `crates/shared` and `crates/server` sources - [x] final `cargo build --release --locked -p server` prints `Compiling shared v0.1.0` and `Compiling server v0.1.0` (not just `server`), and succeeds — confirming `shared` is recompiled against the real source instead of linking the stub
GRI-1906: invalidate the dummy-build cache for shared and client before the real sources land
Some checks failed
CI / the pre-push hook (pull_request) Successful in 10s
CI / cargo fmt (pull_request) Successful in 10s
CI / cargo deny (pull_request) Successful in 27s
CI / cargo deny advisories (pull_request) Failing after 35s
CI / repository boundary (pull_request) Successful in 7s
CI / cargo clippy (pull_request) Successful in 10m3s
CI / frontend-web (pull_request) Successful in 10m2s
CI / cargo test (pull_request) Successful in 11m26s
CI / CI (pull_request) Successful in 3s
CI / Notify gate failed (pull_request) Has been skipped
409474ddf1
vivy merged commit bb58677f94 into dev 2026-11-10 22:57:54 +00:00
vivy deleted branch fix/GRI-1906-docker-shared-cache 2026-11-10 22:57:55 +00:00
Sign in to join this conversation.
No reviewers
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
Grimoirix/grimoire-of-digital-signage!121
No description provided.