fix(pre-commit): make just pre-commit pass on a clean clone #58
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/pre-commit-clean-clone"
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?
Root cause
On a clean clone
just pre-commitaborted before any check ran. The privateensure-envrecipe rancp .env.{{ mode }} .env(mode defaults tostandalone), but.env.standaloneis not committed: only.env.standalone.exampleand.env.saas.exampleare tracked. Thecpfailed withcp: cannot stat '.env.standalone': No such file or directoryand the recipe exited non-zero.A second clean-clone blocker surfaced once the env copy was fixed: the dev image build and the pre-commit recipe referenced Cargo features
standalone/saasthat do not exist.Cargo.tomldefines onlydefault,server, andweb; deployment mode is resolved at runtime fromOIDC_ISSUER, not at compile time (see the project CLAUDE.md "Configuration" section). The Docker dependency prebuild rancargo build --features standalone,serverand failed the image build witherror: the package 'rusty-links' does not contain this feature: standalone.Fix
Repoint
ensure-envto the committed template:cp .env.{{ mode }}.example .env.Drop the non-existent
standaloneCargo feature from the devDockerfile(the dependency prebuild now usescargo build --features server, anddx serveuses--features server), and remove the now-unusedFEATURESbuild arg fromcompose.dev.yml.Collapse the two invalid wasm checks (
--features standalone,weband--no-default-features --features saas,web) in thepre-commitrecipe into the singlecargo check --features web --target wasm32-unknown-unknownthat the canonical CI runs in.forgejo/workflows/check.yml.Verification
just pre-commitfrom a no-.envstate now exits 0 with all five steps green:cargo fmt --check,cargo clippy --all-targets -- --deny warnings,cargo check --features web(wasm32),cargo build --all-targets, andcargo test --lib(6 passed, 0 failed). Final output:[pre-commit] all checks passed. The installed git pre-commit hook re-ran the same recipe on commit and also passed.Note (out of scope, pre-existing)
The standalone
check-web-standalone,check-web-saas, anddev-ssorecipes injustfilestill reference the same non-existentstandalone/saasfeatures. They are not on thejust pre-commitpath, so they are left untouched here to keep this change minimal and on-theme for DEV-370.Refs DEV-370.
ensure-env copied the uncommitted .env.standalone, which does not exist in a fresh checkout (only .env.standalone.example and .env.saas.example are committed), so cp failed and aborted the recipe before any check ran. Repoint it to the committed .env.{{ mode }}.example template. The pre-commit recipe and the dev Docker build also referenced non-existent standalone/saas Cargo features. The project has only default, server, and web features; deployment mode is resolved at runtime from OIDC_ISSUER, not at compile time. cargo build --features standalone,server failed the image build with "the package 'rusty-links' does not contain this feature: standalone". Drop the bogus feature from the Dockerfile prebuild, the dx serve CMD, and the compose FEATURES build arg, and collapse the two invalid wasm checks into the single cargo check --features web that the canonical CI (.forgejo/workflows/check.yml) runs. Verified: just pre-commit now exits 0 with all five steps green (fmt, clippy, cargo check --features web wasm, build --all-targets, test --lib: 6 passed) and prints "[pre-commit] all checks passed". #DEV-370