Repository navigation
crates core
Active contributors: Vassiliy, Eduard, bondiano
sych-core defines what Sych knows and how deterministic decisions are made from supplied inputs. It contains no HTTP, SQL, process-launching or model SDK dependency; external operations are supplied through contracts. See crates/sych-core/Cargo.toml and crates/sych-core/src/lib.rs.
This page is a package map. The analysis algorithms belong in Review, fact provenance in Facts, and dispatch/budgets in Models.
crates/sych-core/src/lib.rs exposes some namespaces directly (analysis, api, broker, config, model, schedule, scm, publication, among others). Other implementation modules are private but re-export their types and functions at the crate root, such as ReviewResult, SourceSnapshot, SnapshotReader, plan and reduce. A source filename is not necessarily an import namespace.
| Abstraction | Contract | Integration |
|---|---|---|
SourceSnapshot, CodeRef, SourceSide
|
Pinned source identity and exact blob/line/hash coordinates | crates/sych-core/src/snapshot.rs |
SnapshotReader |
Read a pinned span, build a reference, search a side and read its diff | Defined in crates/sych-core/src/manifest.rs; implemented by adapters’ LocalSnapshot
|
Broker Operation / Ops
|
Closed set of bounded source, symbol and evidence requests, with explicit completeness |
crates/sych-core/src/broker/ops.rs; no shell, arbitrary URL or database operation |
ModelProvider |
One typed model request and reply; the transport owns neither retries nor budgeting |
crates/sych-core/src/model/contract.rs; implemented by provider adapters |
Ledger |
Atomic reservation, idempotent settlement and optional accepted-answer checkpoint |
crates/sych-core/src/model/budget.rs; implemented by storage |
ScmError, ProviderCapabilities, webhook signals |
Normalized SCM data and error semantics |
crates/sych-core/src/scm.rs; GitHub maps its responses to these contracts |
| Area | Source modules | Details |
|---|---|---|
| Source and identifiers |
crates/sych-core/src/snapshot.rs, crates/sych-core/src/manifest.rs, crates/sych-core/src/primitives.rs
|
Snapshot, diff, paths, digests, typed IDs and source reader |
| Policy/configuration |
crates/sych-core/src/config/mod.rs, crates/sych-core/src/policy.rs
|
Strict configuration decoding, effective config, rule definitions, hashes and provenance; Configuration |
| Planning and generic rules |
crates/sych-core/src/plan.rs, crates/sych-core/src/generic.rs
|
Review units, applicability, obligations and bundled rule IDs; Review |
| Assessments and context |
crates/sych-core/src/analysis/mod.rs, crates/sych-core/src/broker/mod.rs
|
Model-role contracts, accepted answers and bounded evidence packets; Review |
| Evidence and frozen inputs |
crates/sych-core/src/evidence.rs, crates/sych-core/src/freeze.rs
|
Trust, validity, completeness and manifests of expected/observed inputs; Data models |
| Reduction and results |
crates/sych-core/src/reduce.rs, crates/sych-core/src/result.rs, crates/sych-core/src/obligation.rs, crates/sych-core/src/finding.rs, crates/sych-core/src/status.rs
|
Assessments, findings, UNKNOWN reasons and independent result dimensions |
| Fact documents |
crates/sych-core/src/semantic.rs, crates/sych-core/src/syntax.rs, crates/sych-core/src/lint.rs, crates/sych-core/src/ci.rs, crates/sych-core/src/effects/mod.rs
|
Language/tool observations and bounded effect ledger; Facts |
| Model control | crates/sych-core/src/model/mod.rs |
Contracts, gateway, router, structured output, checkpoint dependencies and budget math; Models |
| Deployment checks |
crates/sych-core/src/deploy.rs, crates/sych-core/src/migration/mod.rs, crates/sych-core/src/terraform.rs, crates/sych-core/src/kubernetes.rs
|
Declared deployment model, schema changes and allowlisted infrastructure facts; Deployment checks |
| SCM and scheduling |
crates/sych-core/src/scm.rs, crates/sych-core/src/schedule.rs
|
Signals, capabilities and pure scheduling intent; Server |
| Publication and finding history |
crates/sych-core/src/publication/mod.rs, crates/sych-core/src/lineage.rs
|
Advisory publication representation and finding-revision decisions |
| Reader workflows |
crates/sych-core/src/tour.rs, crates/sych-core/src/handoff.rs
|
Saved-result tours and deterministic selected-finding handoffs; Tours and handoff |
| Policy suggestions | crates/sych-core/src/suggest.rs |
Feedback counts produce proposed rule edits, not automatic trusted policy changes |
| API and external schemas |
crates/sych-core/src/api.rs, crates/sych-core/src/schema.rs, crates/sych-core/src/version.rs
|
HTTP DTOs/OpenAPI, JSON Schema generation and version-aware decoding; API |
| Shared utilities |
crates/sych-core/src/hash.rs, crates/sych-core/src/glob.rs, crates/sych-core/src/path_class.rs, crates/sych-core/src/secrets.rs
|
Canonical hashes, matching, path classes and secret detection/redaction |
- Source references are constructed and checked by the harness, not accepted as invented model coordinates (
crates/sych-core/src/manifest.rs). - Target tip, diff base and head are different positions (
crates/sych-core/src/snapshot.rs). - Missing evidence remains explicit; execution, coverage, recommendation, publication and relevance are separate contracts (
crates/sych-core/src/status.rs). - External documents carry
schema_version;decoderejects unknown major versions (crates/sych-core/src/version.rs). - Repository text is model data, not a trusted instruction layer (
crates/sych-core/src/model/contract.rs).
The conventions page explains how these boundaries apply across packages.
| File | Change entry point |
|---|---|
crates/sych-core/src/lib.rs |
Public namespace and re-export changes |
crates/sych-core/src/manifest.rs |
Source-reader contract and location utilities |
crates/sych-core/src/model/contract.rs |
Provider request/reply contract |
crates/sych-core/src/model/budget.rs |
Budget admission and ledger contract |
crates/sych-core/src/schema.rs |
Register an external document schema |
crates/sych-core/src/api.rs |
HTTP DTO/OpenAPI changes |
crates/sych-core/tests/contracts.rs |
Generated contract checks |
crates/sych-core/tests/reduce.rs |
Reducer behavior contracts |
After a DTO change, run just schemas and cargo test --locked -p sych-core. Both commands are defined by justfile and the crate README. Extend the relevant pure contract tests before changing application orchestration.
Scope: tracked files under crates/sych-core/ at revision 00dc7637f89a47ee6fd4713204f8331418428370. There are 125 files, including 123 Rust files: 90 outside tests/ and 33 integration-test/support files. 57/123 (46.3%) are test-bearing files, detected by a #[test] or #[tokio::test…] attribute, including inline unit tests. This is not line coverage; root fixtures and consumer tests are excluded.
All-history git log origin/main --format='%an' -- crates/sych-core yields 3 distinct nonbot author display names after exact-name deduplication. Bot names and co-author trailers are excluded; aliases are not merged. The byline uses the most recent distinct names, shortened to first names/usernames, not an ownership assignment.