Testing & contributing
How the code is tested, the checks every change must pass, and conventions.
Run the checks
cargo fmt --all
cargo clippy --workspace --all-targets # zero warnings
cargo test --workspace
cd frontend && pnpm exec tsc --noEmit && pnpm test && pnpm buildWhat's tested
| Area | Tests |
|---|---|
backend/core | Repository detection (npm, Python, Go and Rust manifests; scoped families; false-positive guards; README as a weak signal), catalog loading (ISO 42001 has 27 clauses and 38 controls), placeholder rendering, every requirement reachable from a task, unique task keys, training tasks present, annex chunking, levels, streaks |
backend/llm | Request mapping for OpenAI-compatible and Anthropic APIs (tool round-trips, native content replay, no sampling parameters), provider config and offline fallback, Shadow never leaks the company name or emails and restores streamed answers |
backend/agent | The tool loop runs tools and stops on a question; tool names are unique and labelled; the offline guide asks onboarding questions in order and proposes the right framework |
backend/server | Password hashing, ledger tamper detection, and an end-to-end journey over real HTTP: setup → onboarding through cards → framework approval → roadmap → task completion and XP → policy draft, publish and acknowledgement → evidence upload → invite and training completion → role checks → audit room → ledger verification. A second journey connects GitHub against a mock API: wrong tokens are refused, the token is never returned, archived repos are skipped, AI systems, vendors and data types land in the inventory and profile without duplicates on rescan, inventory evidence is linked to ISO 42001 tasks, every policy is bootstrapped with the scope appendix, and disconnecting keeps the records. Also token encryption, website extraction and private-address refusal |
cli | .env rendering from the template, remote parsing, meridian.toml round-trips, policy file round-trips, command definitions |
frontend | Event-stream parsing at every possible chunk boundary; docs integrity (titles, groups, every internal link and anchor resolves); search index; branding colour maths; formatting. Plus strict TypeScript and a production build of every route |
CI runs all of this on every push and pull request (.github/workflows/ci.yml).
Working on Shadow at the same time
Shadow is a git dependency pinned to a commit in Cargo.toml. To build against a local Shadow checkout next to this repository, add a [patch] to a Cargo config file in the folder that contains both (outside the repository, so it is never committed; paths are relative to the folder that holds .cargo/):
# ../.cargo/config.toml
[patch."https://github.com/Tiny-Bubble-Company/shadow"]
shadow-core = { path = "shadow/crates/shadow-core" }Cargo rewrites the shadow-core entry in Cargo.lock while the patch is active, so don't commit that change. Once the Shadow change is pushed, bump the pin: set the new rev in Cargo.toml and run cargo update -p shadow-core. The Docker images read the commit from Cargo.lock, so nothing else changes.
Conventions
- Keep handlers thin; business rules belong in
meridian-core(pure) orserver/domain.rs(stateful). - Every consequential agent action goes through a card the user approves.
- If you change a request, response, card or event, update
docs/api.mdin the same change. - Content uses requirement IDs, short titles and original wording only. Never copy standard text.
