Skip to content

Weak evidence yields a plan, not an edit (#146) - #162

Open
QuintinBotes wants to merge 1 commit into
mainfrom
goal/146-weak-evidence-plan-only
Open

QuintinBotes wants to merge 1 commit into
mainfrom
goal/146-weak-evidence-plan-only

Conversation

@QuintinBotes

Copy link
Copy Markdown
Owner

Weak evidence now yields a plan, not an edit.

  • Plan: every slice records gaps (its source findings' uncertainties, evidence that is not observed, lexical reads and analysis-coverage holes in its scope) and evidence_strength (lowest finding confidence, inferred vs total evidence entries).
  • Risk: low finding confidence, or more than half the supporting evidence inferred, raises risk one level above what the other factors gave; the reason says weak evidence: ....
  • Apply: a non-test slice whose scope modules were mostly read lexically is refused with the new UK_INSUFFICIENT_EVIDENCE (exit 3, HTTP 403). The message names the gap and both ways forward: a SCIP index then re-map, or a person sets evidence.allow_weak: [CMP-n] (or true) and runs unknot config accept in a terminal. An unaccepted edit is inert (the existing acceptance path already strips evidence).
  • Org policy: evidence.allow_weak: false forbids it; an org true is ignored. Org evidence lists now replace the repository's list by list instead of replacing the whole block.

New module runtime/policy/evidence.mjs; small hooks in plan/campaign.mjs, policy/risk.mjs, apply/apply.mjs, policy/merge.mjs, core/errors.mjs; schemas and docs updated. Nothing in runtime/graph changed.

Acceptance scenarios

Scenario Evidence
1. Slice has gaps from finding uncertainties, evidence gaps, and coverage holes in scope tests/integration/weak-evidence.test.mjs "a slice carries the gaps…"; mews copy: plan --findings F-0002 gives 4 gaps (uncertainty, no confidence, 1/1 modules read lexically, csharp analysis-coverage hole)
2. Mostly inferred or low-confidence evidence raises risk at least one level, reason names it "low confidence or mostly inferred evidence raises risk one level…" (low→medium, medium→high); mews copy: F-3701 (confidence low) planned as medium: weak evidence: source finding confidence is low
3. Lexical scope: apply refuses with UK_INSUFFICIENT_EVIDENCE, naming the gap and both ways forward "apply refuses a lexically read slice…" (real map of a C# fixture, then startApply); a different campaign's opt-in still refuses, this campaign's opt-in reaches PATCHING
4. Same slice with a syntax adapter proceeds as today "the same slice in a repository with a syntax adapter proceeds as before" (same detector's finding, TypeScript)
5. Deletion-lane or proven-deletion slices stay blocked on weak evidence The C# slice in scenario 3 is a proven deletion (approvals: ['any-approver'], so lane-eligible) and is refused; the existing proven-deletion*.test.mjs and lane.test.mjs pass unchanged
Edge: test-only slice allowed on weak evidence "a test-only slice is applied on weak evidence" (C# repo)
Edge: org can forbid allow_weak "an organization can forbid allow_weak, never grant it"
SC-001 (mews copy) Covered in part. On a copy of MewsSystems/mews (30.8k files, C# read lexically), the branch's gate refuses two refactoring slices with UK_INSUFFICIENT_EVIDENCE and allows a tests slice; allow_weak: [CMP-1] lifts the refusal. The full unknot apply CLI could not run there because the copy's config is unaccepted (plan mode), and accepting the config and approving both need a person at a TTY. The CLI path is covered by the fixture test for scenario 3.

Check

npm test: 3681 tests, 3665 pass, 7 fail, 9 skipped. The 7 failures are the known local-only tests/unit/daemon/remote.test.mjs TLS failures ("CA signature digest algorithm too weak", LibreSSL), which also fail on clean main.

Secret scan: gitleaks could not run in this agent's sandbox and trufflehog is not installed. The diff adds no credentials; the test passphrase also appears in the existing tests.

Closes #146

🤖 Generated with Claude Code

Every slice records gaps (its findings' uncertainties and non-observed
evidence, lexical reads and analysis-coverage holes in its scope) and
evidence_strength; low confidence or mostly inferred evidence raises risk
one level. apply refuses with UK_INSUFFICIENT_EVIDENCE a non-test slice
whose scope was mostly read lexically, unless a person opts the campaign
in with evidence.allow_weak in the accepted config; org policy can forbid it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weak evidence yields a plan, not an edit

1 participant