Skip to content

Make Batch Review Requirements an executable per-batch protocol - #118

Merged
KimGLee merged 4 commits into
mainfrom
feat/batch-review-requirements
Aug 21, 2026
Merged

Make Batch Review Requirements an executable per-batch protocol#118
KimGLee merged 4 commits into
mainfrom
feat/batch-review-requirements

Conversation

@KimGLee

@KimGLee KimGLee commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Summary

Closes the gap behind #117: a Profile obligation could be declared but nothing made it a counted, per-batch, per-target duty. This PR ships the full chain — declaration, activation-time freezing, delivery, per-target evidence, exact-set aggregation, and enforcement at the correct boundary.

What changed

  • Profile interface: a new Batch Review Requirements registry section (template + typed IR in profile_contract.py). A configured row references a registered Judgment Item and closes every enum: target selector each-manifest-page | batch, trigger before-merge-ready, producer manual-attestation, receipt schema page-batch-judgment-v1, plus a resolvable pass-authority role. An absent section is the unregistered state; a requirement-free Profile's contract fingerprint stays byte-identical (the fingerprint includes the block only when non-empty).
  • Activation (card_activation.py): protocol card-first-readback-v2 expands the requirements against the frozen manifest into a deterministic expected set, freezes review_requirement_set_sha256 in the admission receipt, and delivers the readable plan inside the Bundle (batch_review_plan), so the executing Agent starts with its obligations in context. queued -> open recompiles to exact equality. v1 receipts replay under their own era.
  • Evidence (record_batch_judgment.py, new): one invocation answers one frozen record; validates target against the frozen expansion and reviewer against the registered role; binds the batch's current activation receipt, the target's semantic content fingerprint, and the authorized Profile contract fingerprint; rebuilds every binding under the runtime write lock immediately before publication.
  • Aggregation + enforcement: the batch-review wrapper additionally binds review_requirement_set_sha256, judgment_receipt_ids, judgment_record_set_sha256; update_queue refuses open -> merge-ready unless expected = actual exactly — one missing, extra, duplicated, forged, mis-roled, drifted, or reused record refuses the transition (check_queue.batch_review_judgment_errors).
  • Era and invalidation rules: page semantic drift invalidates that page's judgment; Profile revision invalidates the frozen expansion; a reopened batch re-judges under its new activation; pre-v2 activations impose no obligations and must carry no fields; sealed history replays under its producer era.
  • Prose/registry: K12/14 (wrapper binding + in-batch item), K12/17 (payload additions), K13/19 (new Frozen Review Plan section), K13 MOC row, K00/12 (producer cells 1.23.0 + batch-review row), K00/16 (two new leaf-size exceptions, K12/17 re-measure), receipt-schema template, Tools/README, seven Cards restamped (R07 names the per-record duty), example profile registers a worked requirement (agent-atlas-content-form-classification + content-reviewer), compiled CLI/MCP/host/metadata artifacts regenerated (45 tools).
  • Versions: check_queue 1.22.0 → 1.23.0 (receipt shape + validator); update_queue 1.7.0 → 1.8.0 (release identity; the transition receipt's 1.5.0 producer era is unchanged).

Validation

  • make check: green end to end
  • 11 new acceptance tests (BatchReviewRequirementTests): exact-set happy path; missing record; wrapper without bindings; duplicate; recording-time role refusal; forged role at merge; unregistered target; page drift after judgment; reused activation binding; requirement-free shape stability; legacy-era replay
  • full test_update_queue, test_check_queue, test_card_activation, test_profile_contract suites pass
  • example profile passes profile-load 2.0.0 with the configured requirement

Scope boundary

check_batch_close is deliberately untouched: the enforcement boundary is open -> merge-ready, and close-time replay keeps producer-era semantics. Natural-language applicability predicates are deliberately excluded from v1 of the registry. Extension Gates are unchanged — the two mechanisms are documented against each other in the template.

Fixes #117

A Profile could declare a Judgment Item, but nothing said whether it was
a standing per-batch, per-page obligation; the batch-review wrapper bound
only the Delta page receipt IDs; Extension Gates are property-state
transitions and the wrong shape for a content judgment that changes no
property; and check_batch_close runs after merge-ready, too late to be
the first gate. The first real adopter demonstrated the consequence: a
standing four-class content-form obligation, declared in prose since its
3.6.3, was skipped entirely on a closed batch with twelve gates green
(its register: the sorting duty knew it had exactly one chance, and
"not writing it down equals not checking" had no machine face).

This ships the chain that closes the gap:

  Profile Judgment Item
    -> declared as a Batch Review Requirement (new registry section)
    -> expanded deterministically at queued -> open (Frozen Review Plan,
       activation protocol card-first-readback-v2, delivered with the
       Card Activation Bundle, hash frozen in the admission receipt)
    -> answered per target through record_batch_judgment.py
       (manual-attestation class; binds the batch's current activation,
       the target's semantic content fingerprint, and the authorized
       Profile contract fingerprint)
    -> bound exactly by the batch-review wrapper
       (review_requirement_set_sha256, judgment_receipt_ids,
       judgment_record_set_sha256)
    -> enforced at open -> merge-ready: expected = actual, exact set.

One missing, extra, duplicated, forged, mis-roled, drifted, or reused
record refuses the transition. A requirement differs from an Extension
Gate on purpose — it proves a judgment happened for every applicable
target and writes nothing back; the two are documented against each
other in the template. First-version enums are closed (each-manifest-page
| batch, before-merge-ready, manual-attestation, page-batch-judgment-v1):
no natural-language applicability, so a declared rule can never again be
one the machine does not know when to apply.

Era rules: requirement-free Profiles keep their exact wrapper shape and
their contract fingerprints are byte-identical (the fingerprint includes
the requirement block only when non-empty); a v1 activation predates the
plan, imposes no obligations, must not carry the fields, and upgrades by
reactivation; a reopened batch gets a new activation receipt, so old
judgments fail their opening binding and the new attempt re-judges;
page edits invalidate per-target judgments through the semantic
fingerprint; Profile revisions invalidate the frozen expansion through
the set hash. Sealed history replays under its own producer era.

Versions: check_queue 1.22.0 -> 1.23.0 (v2 admission receipts, judgment
validator), update_queue 1.7.0 -> 1.8.0 (release identity only; the
transition receipt shape and its 1.5.0 producer era are unchanged).
K00/12 producer cells, K12/14, K12/17, K13/19 (new Frozen Review Plan
section), the K13 MOC row, the receipt-schema template, Tools/README,
and the example profile (judgment item, content-reviewer role,
configured requirement) move together; K00/16 registers the two new
leaf-size exceptions and re-measures K12/17; seven Cards restamped with
the R07 During loop naming the per-record judgment duty; compiled
CLI/MCP/host/metadata artifacts regenerated (45 tools).

Validation: make check green end to end; 11 new acceptance tests cover
the exact-set happy path, missing record, absent bindings, duplicate,
recording-time role refusal, forged role at merge, unregistered target,
page drift, reused activation binding, requirement-free shape stability,
and legacy-era replay; the full update_queue/check_queue/card_activation/
profile_contract suites pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@KimGLee KimGLee added bug Something isn't working enhancement New feature or request labels Aug 21, 2026
KimGLee and others added 3 commits August 21, 2026 19:26
CI caught three gaps the local run missed. The seventeen batch-review
finding codes join check_profile.FINDING_CATEGORIES, classified exactly
as their extension-gates siblings: the two blank-content findings are
semantic-unresolved, the fifteen structural/reference/enum findings are
mechanical. record_batch_judgment joins the README distribution
sentence. And the judgment validator treated a batch with no resolvable
activation receipt as an error, which re-judged sealed pre-delivery-era
fixtures; a batch activated before delivery receipts existed predates
the review era exactly as a v1 activation does — it owes nothing and
must carry nothing, and the runtime validator, not this gate, is what
keeps a current-era batch from shedding its activation receipt.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The finding-classification and pre-era commits changed check_profile and
check_queue, whose bytes the compiled CLI contract and metadata
execution contract bind. make check verified rc=0 end to end after
regeneration.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
BatchReviewRequirementTests subclasses UpdateQueueTests for its fixture
helpers, which reran all 85 inherited tests under the subclass — no new
coverage, roughly doubled runtime, and the s-z CI shard already sits
near its 15-minute budget; the 3.14 run went over and was canceled. The
inherited tests are now explicitly skipped on the subclass and keep
running exactly once, on the base class.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@KimGLee
KimGLee merged commit 26ad325 into main Aug 21, 2026
11 checks passed
@KimGLee
KimGLee deleted the feat/batch-review-requirements branch August 21, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make Batch Review Requirements an executable per-batch protocol

1 participant