Files
nessarandClaude Opus 5.5 98a8a14343
CI / core (pull_request) Successful in 1m44s
CI / core (push) Successful in 1m48s
Add Rule #3: tests observe, they don't shape
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3BEKJ9v922udzup4Qn
2026-11-25 19:34:12 +01:00

3.1 KiB

Rule #1: fluid and light

The app must stay as fluid and light as possible: it never feels slow and never makes the computer feel slow. This comes before features. Budgets, reference machine and how to measure: docs/performance.md.

  • Write every change to be light: no avoidable work per frame, per hover or while idle, no polling where an event exists, background work at low priority, memory in proportion to what is shown. Do not run the probes or benchmarks for a change unless the user asks.
  • Budgets are checked by a full benchmark before each major release: every probe, on a release build (scripts/prod), on the reference machine, numbers recorded in docs/performance.md. Debug numbers never count. A release over a budget does not ship. When a budget is beaten durably, lower it (ratchet); never raise it.
  • Do not modify GPUI or gpui-component to meet a budget: reduce the app's own rendering cost (ADR-0004).
  • A part of the page gets its own view for a reason: it owns state that changes on its own (the champion table: sort, selection, scroll, hover), or it is a cached view with a structural test (docs/performance.md), its gain checked at the next release benchmark. Other parts render as functions in their parent's render.

Rule #2: focused modules

When adding behavior or tests would grow a Rust file and leave it above 500 lines, counting inline tests, extract a cohesive responsibility or test suite into a focused module in the same change. Use Rust modules and render functions for these splits and follow Rule #1 for GPUI view boundaries.

Rust test layout

  • Keep small unit-test suites next to the implementation in an inline #[cfg(test)] mod tests { ... }. The child module can access private items in its parent.
  • Move larger unit-test suites to a child file such as src/ring/tests.rs, declared with #[cfg(test)] mod tests;. Split suites by behavior as they grow.
  • Group integration tests by behavior in the package's top-level tests/ directory and exercise the public API.
  • When documenting a runnable API example, use a Rust code block in the item's /// comments so cargo test checks it.

Rule #3: tests observe, they don't shape

Production code does not exist to satisfy a test. Tests go through the same paths production uses; when a test needs a way in, that is a design seam with a production meaning (an injected clock, a trait with a real implementation), not a test hook.

  • No cfg(test) / cfg!(test) branches inside production logic, no flags or parameters only tests set, no visibility widened only for tests.
  • Exception: passive instrumentation under #[cfg(test)] (counters, recorded events) that guards a Rule #1 structural test, never read by production code and never changing its behaviour.

Agent skills

Issue tracker

Issues are tracked on the self-hosted Gitea (nessar/arena-tracker) via the tea CLI. See docs/agents/issue-tracker.md.

Triage labels

Default five-role vocabulary (needs-triage, needs-info, ready-for-agent, ready-for-human, wontfix). See docs/agents/triage-labels.md.

Domain docs

Single-context: one CONTEXT.md + docs/adr/ at the repo root. See docs/agents/domain.md.