Skip to content

fix(local): scope clean credit to the review contract - #552

Merged
HouMinXi merged 2 commits into
mainfrom
dot/70-local-contract-credit
Nov 22, 2026
Merged

HouMinXi merged 2 commits into
mainfrom
dot/70-local-contract-credit

Conversation

@HouMinXi

Copy link
Copy Markdown
Owner

Partial work for #70.

Behavior

  • Bind earned clean rounds to the explicit --contract input for single-repository LOCAL reviews that run L1 against WORKING through the subprocess outlet. Save the SHA-256 of the resolved body and exemptions in host round history, using the effective summary when L1 receives one. The contract text stays out of persisted state.
  • Revalidate the old receipts before comparing identities. When the identity changes or cannot be established, reset only the earned clean window used to resume review. Preserve findings, human dispositions, HOLD and ESCALATED behavior, historical rows, and receipt files. History replay respects the same boundary.
  • A receipt-backed transition between an identified WORKING review and an unbound LOCAL entry such as INDEX starts a new clean window. Stub reviews without L1, other review context, and general gate policy are outside scope. A Forge binary from before this change may refuse to verify a history containing a contract-bound reset because it replays the previous counting rules.

Offline verification

  • 91 focused tests passed, with 2 deselected. The suite covers same, changed, added, and removed contracts, switching between WORKING and INDEX, and a human-confirmed finding that remains frozen after a contract change. The five new test identities are registered.
  • 22 Git WORKING review and standalone verify pairs used offline L1 and Runtime responses. For the same contract, a no_json response failed the round and retained two earned rounds. One healthy restart earned the third round and standalone verify passed. A changed contract needed three new healthy rounds before standalone verify passed.
  • Ruff lint and formatting, py_compile, and git diff --check passed.

Bind WORKING review credit to the resolved contract passed to L1.
Reset earned credit when that input changes so resuming cannot combine
rounds earned under different contracts. Keep findings and HOLD decisions.
The round reservation helper runs after restoration in production.
Give the direct unit test the valid empty window that restoration
produces so it still exercises clearing the C3 strip set.
@HouMinXi
HouMinXi marked this pull request as ready for review November 22, 2026 05:30
@HouMinXi
HouMinXi merged commit 3fae8be into main Nov 22, 2026
13 checks passed
HouMinXi added a commit that referenced this pull request Nov 22, 2026
Cover identical summary, changed summary, and raw fallback with an unchanged source diff. Assert retained history and the three-round verification threshold.

Refs #70 and #552
HouMinXi added a commit that referenced this pull request Nov 27, 2026
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.

1 participant