Skip to content

feat(flow): checkbox attestations declared in pack data and ticked only on a person's grant - #2501

Open
abrichr wants to merge 4 commits into
claude/gui-link-stepsfrom
claude/gui-attestations
Open

abrichr wants to merge 4 commits into
claude/gui-link-stepsfrom
claude/gui-attestations

Conversation

@abrichr

@abrichr abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member

What this adds

In the Set 4 v2 held-out run (#2464), attestation boxes were bound to intake facts, such as confirm_details: true or a derived flow.confirm_declarations. The run therefore ticked statements nobody had made for that case. Those boxes were also left out of the read-back as not checked. This change makes attestations general and fail-closed.

  • AttestationSpec (pack data). It names one checkbox or switch and the SHA-256 of its statement. By default the statement is the box's label. With statement_from="container", it is the text of the innermost container instead, for a box labelled "I agree" that sits under a paragraph.
  • AttestationGrant. It is handed to the run by the person who attests, for one statement digest. It is its own type: a bool, an intake value, a mapping or any derived fact passed as a grant raises TypeError.
  • check_pack. It refuses a pack whose field bindings name a declared attestation.
  • plan_checkboxes. It decides every checkbox and switch on the screen before anything is ticked:
    • field: a binding covers it.
    • tick: it is declared, the statement digest matches, a grant covers that digest, and the box is unticked.
    • leave: the pack lists it as left alone, and it shows the declared state.
    • stop: anything else. That covers an undeclared box, changed wording, a missing or mismatched grant, an attestation bound to a field, a box already ticked before the run, or two specs matching one box. apply_attestations refuses a plan that has any stop.
  • learn_attestations. It suggests candidates from a demonstration: boxes the demo ticked that no binding covers, and boxes it never touched. They are suggestions only and never written into a pack.
  • judge_attestations (@verdict_site). It settles the planned boxes against a fresh read. Each box must show the planned state, and its statement must still hash to the planned digest. A box the plan never saw is unexpected, an unread state is not checked, and an empty plan never passes.

The engine has no "I agree" word list. A box is an attestation only because the pack says so.

Tests

tests/gui/test_gui_attestations.py has 11 tests:

App kind What is checked
Web form (membership application) With a grant, the declaration is ticked, read back, and submitted, and the marketing box is left alone. With no grant, a grant for another digest, or an undeclared box, the run stops and nothing is ticked. Reworded text stops the run, and so does a new box ("binding arbitration"). An "I agree" box pins its paragraph, so a changed paragraph stops it. The demo suggests the declaration and the box to leave alone.
EMR-like chart (dialog) A medication-review attestation bound to a field is refused by check_pack, and the plan stops on it. With a grant, it is ticked inside the dialog and read back.
SaaS danger zone An ARIA switch attestation is toggled on a grant and read back. A switch already on before the run stops.
Spreadsheet-like grid (no browser) A "totals are final" box in a dialog settles against a fresh read. Someone ticking the box that was left alone afterwards is refuted.

The fail-open harness runs its generic mutations on judge_attestations. A hand-made fail-open copy that uses all() over ticks, ignores statements and ignores unplanned boxes fails M3, M5, M7, M8, M10, M15 and P0. While writing the spec, the harness found a real problem: a refuted box with a conflicting second read dropped to not checked. The fix keeps any refutation on top. The fold ratchet is unchanged.

Everything is synthetic, headless Chromium on the Mac, single-process.

The browser adapter now names ARIA checkbox, switch and radio widgets from their content, and keeps up to 2,000 characters of container text, so a whole statement can be pinned.

Base

The base is #2499 (links as steps), which sits on #2476. The form_tx reconciler is not wired up here. To adopt this, the form layer would drop its confirm_* fact bindings in favour of AttestationSpec plus grants on the run request, and call plan_checkboxes before each screen's commit.

…ly on a person's grant

gui.attestations plans every checkbox and switch on a screen: a field
binding's, an attestation to tick, a box the pack leaves alone, or a stop.
An undeclared box, a changed statement, a missing grant, an attestation bound
to a field or a box ticked before the run touched it all stop the run before
anything is ticked. Grants are their own type, so no intake value or derived
fact can tick one. judge_attestations settles the planned boxes against a
fresh read and is a registered verdict site.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: 580d532

Gemini run on 580d532 (model gemini-3.1-pro-preview, finish reason STOP). It was sent the full diff against the base branch, every changed Python file at head, the verdict kernel, the harness and the PR description.

Blockers

None.

Non-blocking

None.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: 95d0e65

Gemini run on 95d0e65 (model gemini-3.1-pro-preview, finish reason STOP). It was sent the full diff against the base branch, every changed Python file at head, the verdict kernel, the harness, the PR description and the round-one review (approved; the only change since is the merge of #2499's fix).

Blockers

None.

Non-blocking

  1. Multiple matches for one attestation spec: If a pack author writes a loose ControlSpec that matches multiple identical checkboxes on the screen, plan_checkboxes will plan a TICK for all of them using the same grant, and apply_attestations will tick all of them. This is safely caught and verified by judge_attestations (which tracks them as distinct obligations by their unique handles), but you may want to consider whether a single grant should be allowed to authorize multiple ticks if the UI duplicates a control.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: 95d0e65

Author declaration: Claude wrote the changes on this branch up to and including 95d0e65. The Gemini review above is the cross-vendor review for this head.

…n every one

One grant covers one box. A loose spec naming two identical boxes used to
plan a tick for both on one grant; now each is a stop and nothing is ticked.
From Gemini's non-blocking note on #2501.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: 77e7103

Gemini delta review on 77e7103 (model gemini-3.1-pro-preview, finish reason STOP). The only change since the approved head 95d0e65 is 77e7103: an attestation spec that matches more than one box now stops on every one of them (one grant covers one box), with a test. Gemini was sent that delta, its own earlier note, and the full PR diff and changed files for context.

Blockers

None.

Non-blocking

None.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: 77e7103

Author declaration: Claude wrote the changes on this branch up to and including 77e7103. The Gemini review above is the cross-vendor review for this head.

This branch has not been deployed

No deployments
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