These rules apply to every change made by any agent or contributor in this workspace. They are enforced at code-review and CI time.
- British English. All text output, documentation, comments, identifiers,
and generated content use UK spelling (
colour,organised,behaviour,catalogue,artefact,centre,licence, etc.). - No emoji. Anywhere in code, comments, docs, commit messages, PR descriptions, or generated content.
- No mocks in tests. Tests hit real services or are removed. Use
hermetic temp dirs, real binaries spawned with hermetic env vars, real
fixtures under
tests/fixtures/. Nevermockito,mockall, hand-rolled trait doubles, or stub databases in committed test code. - No dead code. No unreferenced symbols, no commented-out code, and no
#[allow(dead_code)]annotations that hide a real dead-code finding. See § No-dead-code policy below. - No
#[ignore]on tests. If a test cannot be made to pass, either fix the underlying failure or delete the test. A skipped test is a lie. - No timeout flag for cargo/make on macOS. macOS does not have GNU
timeout; rely on Rust's own test harness and CI walls instead. - Never overwrite
.envfiles. Useop injectorop run --no-maskingto compose secrets at runtime. - Never increase test timeouts to make a flaky test pass. Diagnose the root cause. The only acceptable exception is integration tests against an LLM or similarly slow external service.
- Use
terraphim-grepfirst for code/content search. Fall back torg/fd/fffonly when the query is purely about file names orterraphim-grepis unavailable. Never usegrep/find. - All task tracking lives in Gitea (
gtrCLI /gitea-robotMCP). Do not usebr/bd/.beads/or MCP Agent Mail for issue tracking. - Commit every successful change. Tests must be green before the commit.
Use
Refs #<id>orFixes #<id>in the subject to keep Gitea in sync.
dead_code lint findings must be resolved, not annotated away. The lint
fires when an item has no reachable user in the current compilation unit.
Allowed without justification: none. Every #[allow(dead_code)] needs a
comment explaining what is being suppressed and why.
Allowed with a justification comment:
- Cross-binary shared helpers in integration-test support modules.
Rust integration tests compile each
tests/*.rsfile as its own binary, so an item that is genuinely used by one binary appears unused in every binary that does not import it. The function is not dead — only the per-binary view of it is. The annotation must say:- which other binaries use the item,
- why those binaries cannot directly reach it through their
usechain, and - what refactor would remove the annotation entirely (e.g. moving the
helpers into a separate
*_test_supportcrate consumed viadev-dependency).
- Feature-gated public API. Items that exist only to be reached when
a non-default Cargo feature is enabled (
--features firecracker,--features server, etc.). Such items are dead in the defaultcargo check --no-default-featuresbuild and live in thecargo check --all-featuresbuild. The annotation must say:- the feature flag(s) under which the item is reachable,
- the names of the caller(s) that become reachable under that flag, and
- the URL/path of the feature declaration in
Cargo.toml.
Forbidden:
#[allow(dead_code)]on private items reachable through a public item used by the same binary (the warning cascades — if A is used, B is used).#[allow(dead_code)] // Will be used in Phase 2/3/...— speculative future-use is not a use. Delete the item or finish the work.#[allow(dead_code)] // Replaced by ...— delete the old implementation.- Project-wide
#![allow(dead_code)]or#![deny(warnings)]blanket overrides. #[allow(unused_imports)]for hygiene; clean up the import instead.
Verification: before merging any PR that touches tests/** or
src/**, run cargo check --tests --all-targets -p <changed-crate> and
confirm zero dead_code warnings. Add the same command to your pre-commit
check.
For any PR that changes Rust code, run, in order:
cargo fmt --check(style)cargo clippy --workspace --all-targets -- -D warnings(lints; on macOS usecargo clippydirectly — do not wrap intimeout).cargo test -p <changed-crate> --tests --no-fail-fast(tests).terraphim-grep "Reachable identifiers in changed files" --paths <files>(sanity check that no orphanpubitems were added).gtr comment --owner terraphim --repo terraphim-clients --index <id>with aprogress updatebody summarising what changed and what evidence confirms it works.
- One task per branch:
task/<gitea-index>-<short-title>. - One commit per logical change; the commit subject cites the issue.
- One PR per branch; squash-merge on the GitHub mirror.
- After merge:
gtr close-issue --owner terraphim --repo terraphim-clients --index <id>once CI is green. - For destructive ops (force-push, reset, drop table, etc.) confirm with the user before acting.