Repository navigation
features review planning and reduction
Active contributors: Vassiliy Kuzenkov (also recorded as bondiano).
The pure planner fixes scope and obligations from the pinned diff, trusted policy and collected facts. The reducer accepts only admissible assessments and reports coverage separately from the risk recommendation; models do not write the final result.
plan in crates/sych-core/src/plan.rs groups changed files by the directory of their reporting path. That path is the new path when present, otherwise the old path for a deletion. Unit IDs derive from snapshot identity and directory title; obligation IDs derive from snapshot, rule ID and rule version.
All files still belong to units even when their content is excluded or unreviewed:
| Classification | Examples | Effect |
|---|---|---|
| Declared excluded | Binary, LFS pointer, symlink, submodule, trusted generated file | Listed in scope.excluded; not silently erased from scope |
| Unreviewed | Secret/non-UTF-8 path, non-UTF-8 content, unread or oversized blob | Listed in unreviewed; prevents complete coverage |
| Generated claim in this change | GENERATED_IN_CHANGE |
Content hidden from models, but remains unreviewed rather than becoming a trusted exclusion |
| Source-file cap | LIMIT_MAX_SOURCE_FILES |
Further reviewable files remain listed; limit_reached is set |
The planner records diff omissions separately. A generated-file classification must not let HEAD exempt its own change from honest coverage reporting. See Evidence and context for the content and search exclusions that follow.
Each repository invariant rule gets one obligation. Preference rules do not become obligations. An invariant with no matching unit is deterministically NOT_APPLICABLE, unless diff omissions make that conclusion unsafe, in which case it is UNKNOWN/DIFF_INCOMPLETE.
Matching considers both old and new paths. It also follows collected semantic caller/reference links from changed constructs into the rule's paths. A helper moved outside a configured path can therefore retain the invariant through its old path or a BASE/HEAD semantic link. This is distinct from the exact-text moved-block recognition used in context rendering.
For a matched rule:
- An unresolved
applies_to.change_kindsrestriction staysUNKNOWN/CHANGE_KIND_UNRESOLVED; the planner does not guess semantic classification. - Otherwise the obligation starts
UNKNOWN/NOT_ASSESSED. - Explicit acceptance criteria are retained individually; an empty criteria list falls back to the trimmed rule statement.
- Acceptable evidence kinds, violation severity, matching exceptions and trusted contract text/hashes travel with the obligation.
Shipped generic rules are activated only for enabled review profiles and matching changes/facts. A repository rule with the same ID replaces its shipped twin. Migration, Terraform and Kubernetes rules can bind domain-specific evidence and locations; see Deployment checks. Only the shipped TEST-INTEGRITY obligation receives about_tests, which permits tests to be the subject of its evidence. Giving a repository rule the same name does not set that flag.
Risk is the maximum of matched unit hints and rule violation severity. Path hints include HIGH migrations/SQL, CI configuration, infrastructure and authentication-related paths; dependency/build, test and policy paths contribute MEDIUM hints, as do renames. These hints prioritize analysis; they are not findings.
The first gate is criterion-level validation in crates/sych-core/src/analysis/assess.rs:
| Proposed result | Minimum checked condition |
|---|---|
SUPPORTED |
Every criterion has exactly one MET result and anchored evidence; no NOT_MET contradiction |
VIOLATED |
At least one anchored NOT_MET criterion |
NOT_APPLICABLE |
Nonblank basis |
UNKNOWN |
A reason and the next evidence needed |
An unknown obligation/ref/evidence/criterion ID or an anchor outside all shown spans on that file and side makes the assessment UNKNOWN/INVALID_REFERENCE. Missing or repeated criterion results become unknown, not the first result arbitrarily winning. A MET/NOT_MET without an anchor also becomes unknown.
Support resting only on test-path anchors is UNKNOWN/TEST_ORACLE_ONLY unless this is the shipped rule about tests themselves. A violation whose NOT_MET HEAD anchors all overlap unseen changed code is downgraded to UNKNOWN/SEMANTIC_GAP; a violation demonstrated elsewhere can stand.
Before reduction, context_limited in crates/sych-core/src/broker/limited.rs merges assessments of packet chunks in this precedence order:
flowchart LR
Chunks["Per-chunk assessments"] --> Violation{"Any VIOLATED?"}
Violation -->|Yes| V["Keep violation"]
Violation -->|No| Unknown{"Unknown or required context missing?"}
Unknown -->|Yes| U["UNKNOWN"]
Unknown -->|No| S["SUPPORTED before NOT_APPLICABLE"]
Evidence comes from the deciding chunks; limitations are retained. REQUIRED_OVER_BUDGET forces UNKNOWN/CONTEXT_LIMIT unless another chunk establishes a violation. Designated unseen-code/effect-ledger gaps prevent SUPPORTED, becoming UNKNOWN/SEMANTIC_GAP.
The second gate is evidence_problem in crates/sych-core/src/reduce.rs. Every cited item for a non-UNKNOWN assessment must exist in the run, be VALID and belong to the plan's source snapshot. At least one cited item must have an acceptable evidence kind. SUPPORTED additionally requires acceptable COMPLETE_FOR_QUERY evidence not classified as AUTHOR_CLAIM. A rejected proposal becomes UNKNOWN/INSUFFICIENT_EVIDENCE.
An assessment for an unplanned rule is ignored and reported. A deterministically nonapplicable obligation cannot be reopened by a model. An accepted violation gets a rule-violation finding if no linked finding of at least its configured severity already represents it; a linked LOW nit cannot hide a HIGH violation.
The reducer derives coverage as follows:
| Condition | Coverage |
|---|---|
INPUT_UNAVAILABLE execution outcome |
UNAVAILABLE |
LIMIT_REACHED or RETRIES_EXHAUSTED execution outcome |
PARTIAL |
PLAN_EXECUTED with planner limit, required UNKNOWN, task gap, unreviewed file or diff omission |
PARTIAL |
| Otherwise | COMPLETE_FOR_SCOPE |
Not every packet warning is itself a reducer task gap. context_gaps promotes discovery required-span cuts and designated unseen-code/effect gaps; query limitations and other omissions are also preserved in packet metadata. Read the actual result dimensions rather than treating PacketResolution as the coverage enum.
Recommendation is selected in order:
-
ATTENTION_REQUIREDif an open, unwaived finding meets the attention threshold, currently MEDIUM. -
NEEDS_EVIDENCEif an unwaived required obligation is UNKNOWN, or coverage is unavailable. -
NO_BLOCKING_FINDINGS_IN_SCOPEotherwise.
Thus partial coverage can coexist with NO_BLOCKING_FINDINGS_IN_SCOPE, for example a task gap without a blocking required UNKNOWN. It does not mean the whole change was proved safe. Open model questions are reported but do not independently lower coverage. Pending/unresolved candidates remain visible as unverified claims.
waive in crates/sych-core/src/reduce.rs applies in-force exceptions to UNKNOWN or VIOLATED obligations only when one exception covers the whole required scope. For a violation with evidence anchors, those paths define scope; otherwise all paths in the obligation's units do. A waiver for one file does not lift a multi-file rule.
Expiration at or before now and incomplete path coverage are noted, not applied. An accepted waiver leaves status and coverage unchanged. It only changes whether that obligation or a finding linked entirely to waived obligations blocks the recommendation. See Server for recording risk decisions and Data models for their contracts.
| Source | Change here for |
|---|---|
crates/sych-core/src/plan.rs |
Unit grouping, exclusions, rule matching, applicability and risk hints |
crates/sych-core/src/generic.rs |
Shipped rule activation consumed by planning |
crates/sych-core/src/analysis/assess.rs |
Criterion contracts and invalid-reference handling |
crates/sych-core/src/broker/limited.rs |
Chunk precedence and context/unseen-code downgrades |
crates/sych-core/src/reduce.rs |
Evidence admissibility, fallback findings, waivers, coverage and recommendation |
crates/sych-app/src/review/outcome.rs |
Execution-outcome selection and reducer inputs |
crates/sych-core/tests/review.rs covers fixed scope, empty discovery, weak evidence, source caps and nonapplicability. crates/sych-core/tests/rules.rs covers generic activation, old/new/semantic applicability and trusted contracts. crates/sych-core/tests/reduce.rs covers waiver scope, linked-nit severity and consolidated quota gaps. Chunk and unseen-code regressions are in crates/sych-core/tests/broker/chunks.rs, crates/sych-core/tests/broker/syntax.rs and crates/sych-core/tests/broker/ledger.rs.
Domain source/test counts and author-count definitions are in Review analysis. Keep planning deterministic and preserve all result dimensions when extending these entry points.