Files
logaritmisk 0209638552
CI / web (push) Has been cancelled
docs: consolidate frontend guardrails + test-harness gotchas
Adds web/GUARDRAILS.md capturing the recurring CI-guardrail and
test-harness lessons in one place: the check:size (250 KB-gz largest
chunk) and check:colors (design-token) guards, the jsdom/storybook
vitest split, MSW onUnhandledRequest:"error" overrides, RTL
accessible-name collisions, Storybook nested-router/portal handling,
and the components/ui code-style split. Wires a pointer from CLAUDE.md.

All claims verified against the live scripts, ci.yaml, and src/test/.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 09:21:16 +02:00

2.1 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Status

Rust (edition 2024) workspace + React SPA collection-management system. Backend crates: domain, db, api, auth, search, server (axum 0.8 + sqlx/Postgres + Meilisearch). Frontend in web/ (React 19 + Vite + pnpm). Tests need the docker-compose stack up (Postgres on :5442, Meilisearch on :7700); each #[sqlx::test] provisions its own temp DB.

Commands

just check                       # fmt + lint + test — the standard pre-commit gate
docker compose up -d             # start Postgres (:5442) + Meilisearch (:7700) for tests
cargo build --workspace          # build
cargo run -p server              # run the server (or: just run — loads .env)
cargo nextest run --workspace    # run all tests — PREFERRED (per-test isolation, live output, hang timeouts)
cargo nextest run -E 'test(<name>)'   # run tests matching a name substring
cargo test --workspace --doc     # doctests (nextest does not run these)
cargo +nightly fmt               # format — always nightly, not stable
cargo clippy --workspace --all-targets -- -D warnings   # lint before committing

(just test runs nextest + doctests; config in .config/nextest.toml.)

Conventions

  • CLI args & env vars: use clap with the derive feature.
  • Code navigation: prefer the insikt LSP server over grep/glob — it resolves macro-generated symbols that text search misses. (insikt runs standalone, not via the gateway MCP.)
  • Dependencies: manage via the cargo-mcp server rather than editing Cargo.toml by hand.
  • Formatting: cargo +nightly fmt (nightly toolchain required).
  • Frontend guardrails: before touching web/, read web/GUARDRAILS.md — it covers the CI gate (check:size 250 KB-gz budget, check:colors design-token enforcement) and the test-harness quirks (MSW onUnhandledRequest: "error", the jsdom/storybook vitest split, RTL accessible-name collisions, Storybook nested-router and portal handling, and the components/ui/ code-style split).