Skip to content

apps server findings and policy

bondiano edited this page Nov 12, 2026 · 1 revision

Findings and policy

Active contributors: Vassiliy Kuzenkov.

Finding lineage tracks whether an earlier issue persists, resolves or continues elsewhere. Human feedback and waivers add explicit judgments without rewriting immutable evidence; deterministic suggestions help maintainers propose policy changes through their own pull requests.

Lineage is a separate post-completion pass

Engine::lineage_once reads committed, unapplied review generations in order, loads each immutable result and diff manifest, and compares prior open findings through sych_core::lineage::decide. Storage::apply_lineage atomically marks the run applied, records its findings and appends lifecycle events. Playground runs are excluded.

flowchart LR
    Prior["Prior OPEN findings"] --> Decide["Pure lineage decision"]
    Result["New result and diff manifest"] --> Decide
    Decide --> Match["Same fingerprint: matched"]
    Decide --> Recheck["Comparable recheck: resolved"]
    Decide --> Gone["Deleted anchor: obsolete"]
    Decide --> Move["Unambiguous move: successor link"]
    Decide --> Open["Insufficient or partial recheck: stay open"]
    Move --> History["Append history and predecessor relationship"]
    Recheck --> History
    Gone --> History
    Open --> History
Loading
Evidence in the new revision Effect on an earlier open finding
Same fingerprint appears Match and refresh last-seen metadata
Anchored file deleted, not renamed OBSOLETE, not a claimed verified fix
Rename/copy to a new path with exactly one same-category/rule finding there Prior row becomes OBSOLETE with “continued as”; successor has predecessor_id
Ambiguous rename or move Remain OPEN
Partial review or file outside reviewed units Remain OPEN
Applicable rule reassessed and every applicable obligation supported RESOLVED with evidence IDs
Model finding's code changed, fully reviewed unit, no same-category finding at that path RESOLVED
Model finding's code unchanged Remain OPEN

The file-deletion and explicit-continuation checks precede the full-coverage resolution checks. Absence of a repeated diagnostic alone is not a fix. finding_events preserves state, reason, actor and evidence; dismissed findings are not silently reopened when the fingerprint appears again.

Feedback is not technical evidence

The API accepts USEFUL, NOT_USEFUL, FALSE_POSITIVE and WONT_FIX with scope and rationale from a caller with at least triage permission on that repository. Storage records actor and policy snapshot and appends an audit entry in the feedback transaction.

FALSE_POSITIVE and WONT_FIX move an open lifecycle row to DISMISSED; they do not change the underlying result, finding evidence or assessed obligation status. Other judgments record usefulness without that dismissal. This distinction is important when reading quality analytics.

Waivers are scoped risk acceptance

A maintainer can create a waiver with rule, nonempty paths, reason, owner and an expiry or completion condition, and can later revoke it. The caller identity supplies the author. Although a change ID identifies the request, the stored waiver belongs to its repository binding.

The worker loads active, unrevoked, unexpired waivers for later analysis and passes them as rule exceptions. Risk acceptance can lower the recommendation without turning a VIOLATED or UNKNOWN assessment into SUPPORTED. Existing results are not recomputed, and revocation affects subsequent reviews. An until condition is recorded as a condition; do not assume the server independently observes arbitrary completion conditions.

The same waiver validation is reused by a tour's RISK_DECISION exchange. That exchange is private, but the recorded waiver is still a repository-level decision. See Operator capabilities and auth.

Policy reading is reconstruction, not editing

crates/sych-app/src/server/policy.rs finds the repository's newest review with pinned policy, loads its policy snapshot, rereads trusted policy files from the source commit in the mirror and combines them with current server configuration. It returns source/hashes, redacted effective policy and matches_snapshot.

The effective policy can differ after a server configuration or engine change. Missing source or pruned artifacts produce POLICY_UNAVAILABLE; invalid policy produces POLICY_INVALID. Server settings and contract text are removed from this repository-scoped view. No handler writes .sych/.

Suggestions are deterministic proposed edits

Suggestions are recomputed on read from each actor's latest judgment per finding in the last 90 days and the reconstructed policy. crates/sych-core/src/suggest.rs uses policy, counts, dates and safe directory globs, never feedback rationale text.

Kind Current source rule
EXCEPTION At least five judgments against the rule in a directory, and at least 60% of its judgments are FALSE_POSITIVE or WONT_FIX; no live configured exception already covers all judged paths
DEMOTE A required rule has at least ten judgments, at least 50% FALSE_POSITIVE; proposed YAML sets required: false and increments rule version

The distinction between five adverse judgments and five total judgments matters: the implementation uses the adverse-count threshold. Directory exceptions propose a 90-day expiry from the current UTC day. Stable fingerprints include repository, rule ID/version, kind and directory scope, so a rule-version change produces a different suggestion identity.

Readers can inspect the proposed YAML and supporting counts/findings. Maintainers can record DISMISSED or DONE, optionally with a repository PR URL for DONE. Decisions are stored/audited and overlaid on future reads; they do not apply the edit, create a pull request or verify that a linked PR implemented it. Policy changes remain a person's pull request against trusted target policy.

Key source files

File Responsibility
crates/sych-core/src/lineage.rs Pure continuity and comparable-recheck decisions
crates/sych-app/src/server/findings.rs Ordered lineage pass and GitHub permission helpers
crates/sych-storage/src/lineage.rs Transactional lifecycle, feedback and waiver records
crates/sych-app/src/server/api.rs Feedback validation and shared waiver checks/recording
crates/sych-app/src/server/views.rs Finding/history reads, waiver listing and revocation
crates/sych-app/src/server/policy.rs Pinned-source policy reconstruction and redaction
crates/sych-core/src/suggest.rs Count thresholds, stable fingerprints and proposed YAML
crates/sych-app/src/server/suggestions.rs Read-time computation, decision authorization and PR-link checks
crates/sych-storage/src/suggestions.rs Latest judged findings and stored suggestion decisions

Change entry points

  • Modify lineage decisions in core, using crates/sych-core/tests/lineage.rs before storage changes.
  • Preserve dismissal, history and permission behavior with crates/sych-app/tests/findings.rs.
  • Modify thresholds or YAML generation in core; use its inline tests plus crates/sych-app/tests/suggestions.rs for visibility/decision paths.
  • Change policy reconstruction with crates/sych-app/tests/policy.rs, including unavailable mirrors and hash mismatch.

For file/test counts and deduplicated contributor history, see the server inventory. External DTOs and roles are detailed in the API reference.

Clone this wiki locally