You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ Read these for their respective domains:
46
46
47
47
Two hooks live in `.githooks/`, wired up by one `git config core.hooksPath .githooks` per clone:
48
48
49
-
-**`pre-commit`** — scans staged changes for secrets via `gitleaks`, then runs `cargo fmt --check`, `cargo clippy -- -D warnings`, and `cargo test --lib --bins`. Integration tests in `tests/` are deliberately excluded — they need Postgres and run in CI.
49
+
-**`pre-commit`** — scans staged changes for secrets via `gitleaks`, then runs `cargo fmt --check`, `cargo clippy -- -D warnings`, `cargo test --lib --bins`, and an OpenAPI drift check (regenerates `openapi.json` to a tempfile and diffs against the committed copy). Integration tests in `tests/` are deliberately excluded — they need Postgres and run in CI.
50
50
-**`commit-msg`** — validates the commit subject line against `.claude/rules/commits.md` (Conventional Commits 1.0). Pure bash, no commitlint dependency.
51
51
52
52
One-time setup per clone:
@@ -76,8 +76,11 @@ sqlx migrate run
76
76
# Audit dependencies
77
77
cargo audit
78
78
79
-
# Generate OpenAPI spec to stdout
80
-
cargo run --bin export_openapi > openapi.json
79
+
# Regenerate the committed OpenAPI spec (deterministic LF, no BOM,
80
+
# regardless of shell). Run this after any API change; the pre-commit
81
+
# hook and CI both fail if openapi.json drifts from what the code
82
+
# generates.
83
+
cargo run --bin export_openapi openapi.json
81
84
```
82
85
83
86
## Definition of done
@@ -86,7 +89,7 @@ A change is done when:
86
89
87
90
- Code compiles without warnings (treat warnings as errors locally and in CI)
88
91
- Tests pass, including negative and variant cases for the changed code
89
-
- New endpoints have utoipa annotations and appear in `openapi.json`
92
+
- New endpoints have utoipa annotations, `openapi.json` is regenerated, and the regenerated file is staged in the same commit as the code change
90
93
- New SQL queries are compile-time checked by sqlx and the `.sqlx` cache is committed
91
94
- Migration files are append-only if in `production` phase, freely editable in `pre-launch`
0 commit comments