fix(dev): mount ./tests so pre-commit compiles integration tests (PMS-640) #434
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-640-precommit-compile-integration-tests"
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?
What
Mount
./testsinto the dev-composeserverservice sojust pre-commitcompiles thetests/*.rsintegration binaries.Why
The container
just pre-commitruns in mountedsrc/crates/Cargo.*/build.rs/migrationsbut not./tests, socargo {check,clippy} --all-targetsinside it saw no integration tests and compiled lib + bins only. A change that broke the shared harness (tests/common/mod.rs) - e.g. PMS-638 changingcreate_api_router'smailerparameter toArc<SharedMailer>- passed the local hook green and only failed in CI clippy, which checks out the full repo.Change
compose.dev.yml: add- ./tests:/app/teststo theserverservice volumes.justfile: note in thepre-commitcomment that--all-targetsnow covers the integration binaries (compile-only; the Postgres-backed run stays injust test-integration).Verification
Injected a type error into
tests/common/mod.rsand ranjust pre-commit: it now fails (exit 101,error[E0308]attests/common/mod.rs, "could not compile ... test 'tenants'/'notifications'/...") - the class of break that previously slipped through. Reverted the injection; the clean hook passes (compiling the integration tests).Fixes PMS-640.
The dev-compose `server` container that `just pre-commit` runs in mounted src/crates/Cargo/build.rs/migrations but not ./tests, so `cargo {check,clippy} --all-targets` inside it compiled lib + bins only, never the tests/*.rs integration binaries. A change that broke the shared harness (e.g. PMS-638 altering create_api_router's signature) passed the local hook and only failed in CI clippy. Mount ./tests into the service so --all-targets compiles the integration tests too; the Postgres-backed run stays compile-only here (just test-integration still owns the DB path). Verified by injecting a type error into tests/common/mod.rs and confirming pre-commit now fails on it. #PMS-640