fix(pre-commit): make just pre-commit pass on a clean clone #58

Merged
David merged 1 commit from fix/pre-commit-clean-clone into main 2026-06-18 12:45:36 +02:00
Owner

Root cause

On a clean clone just pre-commit aborted before any check ran. The private ensure-env recipe ran cp .env.{{ mode }} .env (mode defaults to standalone), but .env.standalone is not committed: only .env.standalone.example and .env.saas.example are tracked. The cp failed with cp: cannot stat '.env.standalone': No such file or directory and 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 / saas that do not exist. Cargo.toml defines only default, server, and web; deployment mode is resolved at runtime from OIDC_ISSUER, not at compile time (see the project CLAUDE.md "Configuration" section). The Docker dependency prebuild ran cargo build --features standalone,server and failed the image build with error: the package 'rusty-links' does not contain this feature: standalone.

Fix

Repoint ensure-env to the committed template: cp .env.{{ mode }}.example .env.

Drop the non-existent standalone Cargo feature from the dev Dockerfile (the dependency prebuild now uses cargo build --features server, and dx serve uses --features server), and remove the now-unused FEATURES build arg from compose.dev.yml.

Collapse the two invalid wasm checks (--features standalone,web and --no-default-features --features saas,web) in the pre-commit recipe into the single cargo check --features web --target wasm32-unknown-unknown that the canonical CI runs in .forgejo/workflows/check.yml.

Verification

just pre-commit from a no-.env state 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, and cargo 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, and dev-sso recipes in justfile still reference the same non-existent standalone / saas features. They are not on the just pre-commit path, so they are left untouched here to keep this change minimal and on-theme for DEV-370.

Refs DEV-370.

## Root cause On a clean clone `just pre-commit` aborted before any check ran. The private `ensure-env` recipe ran `cp .env.{{ mode }} .env` (mode defaults to `standalone`), but `.env.standalone` is not committed: only `.env.standalone.example` and `.env.saas.example` are tracked. The `cp` failed with `cp: cannot stat '.env.standalone': No such file or directory` and 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` / `saas` that do not exist. `Cargo.toml` defines only `default`, `server`, and `web`; deployment mode is resolved at runtime from `OIDC_ISSUER`, not at compile time (see the project CLAUDE.md "Configuration" section). The Docker dependency prebuild ran `cargo build --features standalone,server` and failed the image build with `error: the package 'rusty-links' does not contain this feature: standalone`. ## Fix Repoint `ensure-env` to the committed template: `cp .env.{{ mode }}.example .env`. Drop the non-existent `standalone` Cargo feature from the dev `Dockerfile` (the dependency prebuild now uses `cargo build --features server`, and `dx serve` uses `--features server`), and remove the now-unused `FEATURES` build arg from `compose.dev.yml`. Collapse the two invalid wasm checks (`--features standalone,web` and `--no-default-features --features saas,web`) in the `pre-commit` recipe into the single `cargo check --features web --target wasm32-unknown-unknown` that the canonical CI runs in `.forgejo/workflows/check.yml`. ## Verification `just pre-commit` from a no-`.env` state 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`, and `cargo 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`, and `dev-sso` recipes in `justfile` still reference the same non-existent `standalone` / `saas` features. They are not on the `just pre-commit` path, so they are left untouched here to keep this change minimal and on-theme for DEV-370. Refs DEV-370.
fix(pre-commit): make just pre-commit pass on a clean clone
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 5m3s
Create release / Create release from merged PR (pull_request) Has been skipped
59df010c49
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
David merged commit cbb2cf7771 into main 2026-06-18 12:45:36 +02:00
David deleted branch fix/pre-commit-clean-clone 2026-06-18 12:45:36 +02:00
Sign in to join this conversation.
No reviewers
No labels
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
a8n-tools/rusty-links!58
No description provided.