BUNYIP-58: force real bunyip-api rebuild, guard against oci-build stub leak #76
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/bunyip-58-oci-build-stub-leak"
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?
Fixes BUNYIP-58. The
bunyip-api/oci-build/Dockerfilestub-dependency cache could ship thefn main() {}stub instead of the real server: afterCOPY . ., host mtimes are older than the stub-built artifacts, so cargo judged the workspace up-to-date and skipped the rebuild. That is howv0.2.0shipped a 557 KB stub binary that execs, returns 0 immediately, never starts the server, and restart-loops silently on nc-01 (no logs, because it never reachesinit_tracing).Changes
COPY . .,find . -name '*.rs' -exec touch {} +so every source is newer than any cached artifact, forcing a real recompile regardless of host mtimes. More robust than the prior rm-the-fingerprints mitigation, which did not hold for v0.2.0.target/release/bunyip-apiis under 5 MB. A stub is ~0.5 MB; the real server is tens of MB. A future regression now fails loud at build time instead of silently in production.After merge
Rebuild and republish
v0.2.0(or publishv0.2.1and repin the deploy compose), verifying the binary is tens of MB. Then nc-01 bunyip-api starts and serves/v1/health. Size-check the sibling PSA tags (bunyip-web, mokosh-server, mokosh-apps) too; bunyip-web's oci-build does not use the stub trick, but the deployed tags should be confirmed.Verification
A freshly built image, run with no env, must exit non-zero with a missing-
DATABASE_URLerror (the realConfig::from_env), not a silent exit 0.#BUNYIP-58
The oci-build stub-dependency cache writes a `fn main() {}` stub, builds it to populate the dependency graph, then COPY . . the real source and rebuilds. COPY . . restores host mtimes older than the stub artifacts, so cargo could judge the workspace up-to-date and ship the stub. That is how v0.2.0 shipped a 557 KB stub that execs, returns 0, and never starts the server, restart-looping silently on nc-01. Touch all *.rs after COPY . . so every source is newer than any cached artifact, forcing a real recompile regardless of host mtimes. Add a post-build size guard that fails the build when the binary is under 5 MB (a stub is ~0.5 MB, the real server is tens of MB), so a regression fails loud at build time instead of silently in production. #BUNYIP-58 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>