Skip to content

how to contribute patterns and conventions

bondiano edited this page Nov 12, 2026 · 1 revision

Patterns and conventions

Keep decisions in the pure core and side effects behind adapters or storage. Preserve evidence provenance and explicit gaps whenever extending a review path. The rules are defined by Cargo.toml, the crate READMEs and AGENTS.md.

Rust boundaries

crates/sych-core/src/lib.rs is the domain boundary: no HTTP, SQL, processes or model SDK. External operations live in crates/sych-adapters/src/lib.rs and crates/sych-storage/src/lib.rs; crates/sych-app/src/lib.rs composes them.

Use typed thiserror errors in libraries and attach operation context with anyhow in the application. crates/sych-app/src/command.rs formats the error chain; crates/sych-app/src/errors.rs maps failures to exit codes. Do not erase causes or turn an unavailable analysis into a pass.

Data contracts

External documents carry schema_version. decode in crates/sych-core/src/version.rs rejects unknown major versions before accepting a document. DTO changes must keep generated files in schemas/ synchronized using just schemas, declared in justfile.

Code locations come from pinned source, not model-supplied coordinates. Use CodeRef from crates/sych-core/src/snapshot.rs and preserve the distinction between DIFF_BASE, HEAD and TARGET_TIP.

Status and evidence

Do not combine execution, coverage, recommendation, publication or relevance into one success flag. Their separate enums are in crates/sych-core/src/status.rs. An UNKNOWN is useful information; an empty discovery result is not evidence that an obligation is supported.

The checks in crates/sych-core/src/reduce.rs require valid, snapshot-bound evidence of an acceptable kind. Author-written assertions do not become independent proof merely because they appear in a CI-shaped file.

Formatting and checks

Cargo.toml forbids unsafe code and denies ignored must-use values. Clippy all/pedantic, absolute paths and unwrap checks feed CI with warnings treated as errors. rustfmt.toml defines formatting; crates/sych-style/src/lib.rs adds the AST-aware blank-line-after-if rule.

Use just fmt for Rust formatting and just style-fix for the house-style fix. just check includes the dashboard workflow as well as Rust checks. Frontend module entry points and import boundaries are configured in web/package.json and the ESLint configuration under web/; see Dashboard.

Logs and untrusted text

The subscriber in crates/sych-app/bin/sych.rs writes to stderr under SYCH_LOG. Keep credentials, prompts and model responses out of logs. Redaction is implemented in crates/sych-core/src/secrets.rs; output escaping belongs to crates/sych-app/src/render.rs.

Repository text and model responses are data, not instructions. Trust server-owned configuration and accepted target-tip policy according to crates/sych-app/src/review/mod.rs, not proposed policy from head. See Security.

Change discipline

Follow Conventional Commits as required in README.md. AGENTS.md requires a branch from fresh origin/main, just check before pushing, a PR to main, green CI and the Sych review of every pushed head. Handle each real finding and UNKNOWN; explain false positives rather than bending code to the reviewer. The full cycle is in Development workflow.

Clone this wiki locally