//! Tell cargo which non-Rust inputs are baked into the binary. //! //! `include_dir!` and `sqlx::migrate!()` both embed directory contents at COMPILE time, and neither //! registers a rebuild dependency on its own. Cargo therefore reuses a cached binary when only //! those directories changed — the source files are untouched, so as far as cargo is concerned //! nothing happened. //! //! For the keepsake viewer that is a silent, shippable defect: run `npm run build` in //! `frontend/export-viewer`, then `cargo build`, and the resulting binary still carries the //! PREVIOUS `static/export-viewer/index.html`. The artifact on disk and the artifact in the binary //! disagree, `git status` is clean, and every check passes — while `Memories.zip` ships a stale //! viewer. Confirmed empirically: after replacing the file, the compiled-in copy did not change //! until a source file was touched. //! //! Production is mostly insulated because images are built from a clean context (no cache to //! reuse), but every incremental build — i.e. all local development and any test run that follows //! a viewer rebuild — hits it, and that includes the test that asserts the viewer is present. fn main() { // The compiled-in keepsake viewer (services/export.rs: `include_dir!`). println!("cargo:rerun-if-changed=static/export-viewer"); // The embedded migration set (db.rs: `sqlx::migrate!()`). Same mechanism, and the failure is // worse: a binary built from a stale snapshot boots against a database that has already run a // newer migration and crash-loops with VersionMissing. println!("cargo:rerun-if-changed=migrations"); }