Skip to content

feat(flow): hub pages of section dialogs, with completion read per section from the hub - #2502

Merged
abrichr merged 22 commits into
mainfrom
claude/gui-hub-sections
Nov 24, 2026
Merged

abrichr merged 22 commits into
mainfrom
claude/gui-hub-sections

Conversation

@abrichr

@abrichr abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member

What this adds

Some held-out portals in the Set 4 v2 run (#2464) put the record behind a hub, a page of cards where each card's Edit button opens a dialog. Two things went wrong on those pages:

  • A wizard walk stopped on the hub with "next button missing".
  • The section dialog was handled through the confirmation-modal rules, which can stop on it or "confirm" it.

This change handles hubs as their own shape in the core engine.

  • classify_dialog. It sorts an open dialog by its contents, never its words:
    • A dialog with any editable control is a form dialog, even one titled "Confirm your email".
    • A form dialog belongs to a section only when exactly one declared section names it. Any other form dialog stops the run.
    • Only a dialog with no editable control can be a confirmation, and that stays with the caller's modal rules.
  • SectionSpec (pack data). It holds the section's opener on the hub, the dialog it opens, the save control inside the dialog, the card that shows its status, and the card tokens that mean done or pending.
  • learn_hub. It finds each open, fill and save cycle in a demonstration. The done tokens are those the card gained on save, minus every token of a value typed in the dialog, so case data never becomes a completion marker. A section whose card gained nothing is reported, not guessed.
  • run_section. It runs one section and stops when any of these checks fails:
    • no other dialog is open on the hub;
    • the card does not already show done;
    • exactly the declared form dialog opens, and opening it writes nothing;
    • the save control is inside that dialog;
    • on save, the dialog closes with the demonstrated number of writes;
    • the card then shows done on a fresh read of the hub.
  • judge_hub (@verdict_site). It settles the planned sections, fixed before any is opened, against a fresh read of the hub:
    • A card that shows not done is refuted.
    • A card that was not found or not read is not checked.
    • A section nobody planned is unexpected.
    • An open dialog, a partial read or an empty plan never passes.
  • expected_writes. It gives the planned sections' total save writes, so a caller whose write budget defaults to one commit can size it to the sections instead.

Tests

tests/gui/test_gui_hub.py has 10 tests:

App kind What is checked
EMR-like chart hub (Allergies, Medications) Sections are learned from one demo. The done token is the check mark the card gained and the pending token is "not"; the typed value is excluded. A replay with other values completes both sections, and the hub verdict holds. A save the server ignores is refuted. An empty value keeps the dialog open with its error, which is refuted. A card already done before the run stops. A different form dialog stops.
SaaS onboarding checklist A dialog titled "Confirm your email" that holds a code field is a form, not a confirmation. An alertdialog with only Leave and Stay is a confirmation. A section whose save button reads "Confirm" completes.
Desktop preferences window (accessibility tree, no browser) Learned and replayed with no browser. An OK button that saves nothing is refuted.

The fail-open harness runs its generic mutations on judge_hub. A hand-made fail-open copy that folds all() over the cards it found fails M1, M3, M5, M8, M10, M15 and P0. The fold ratchet is unchanged.

Everything is synthetic, headless Chromium on the Mac, single-process. No fixture copies a held-out portal.

Base

The base is #2501 (attestations), which sits on #2499 and #2476. The form_tx reconciler is not wired up here. To adopt this, its modal step would call classify_dialog first, so it never treats a form dialog as a confirmation. A pack's hub would become SectionSpec data walked with run_section, and max_commit_mutations would come from expected_writes.

Fail-open blockers kept coming back one PR at a time. This fixes the
classes once:

- openadapt_flow/verdict.py: obligations fixed from the plan, settle(),
  allow-list codes, run binding, trust labels. An empty set, a short read,
  a raised probe, another run's result or an unknown code never passes.
- tests/failopen: 13 generic mutations run against every @verdict_site.
  The self-test flags 14 historical bugs rebuilt from this repository's
  code and passes their fixes; three live sites on main are strict xfails
  owned by #2470, #2258 and the connector status follow-up.
- scripts/check_verdict_folds.py: fails CI when a file gains a
  hand-written fold; never on a drop.
- verify_run: an empty or unpaired effect list is INDETERMINATE, unknown
  and unchecked (latent behind min_length=1).

See packages/flow/docs/FAIL_CLOSED.md.
…rness

- settle matches on subject key and run binding; obligations dedupe on both
- a HELD token is bound to its subject, so replace() can't move it
- observe refuses to map an exception to Observed
- owned sites list their exact known failures (strict xfail per case)
- pre-fix controls are pinned copies, never live code; S3b shows the
  undo fix still passes an unlisted per-write code
- the ratchet compares per-kind totals, so moving code into a new module
  is not a new fold, judges each exit of an except, refuses a site id on
  two functions, and runs in the smoke job on every change
- HELD is minted only inside the kernel's constructors, so replace() can't
  copy or restore it; one result claimed by two obligations conflicts
- known failures carry the seed and lens, so a new case can't hide
- the ratchet checks every @verdict_site has a spec on every change, finds
  conditional sites, judges every branch of a returned value, and lowers
  the baseline per kind so a moved fold keeps its allowance
- M7 is out of P1; the S5 seeds plan 20 runs and a gate needing all 20
  passes
… lines on the kernel

- check_verdict_folds: count a broad handler that falls through, leaves by
  break, or names Exception in a tuple or by attribute (swallow_wide); add
  says_unchanged and empty_change_set for "nothing else changed" claims; a
  file that doesn't parse fails; a spec id is an id= or factory argument.
- verdict: count the obligations that claim a result, not repeats of it;
  add Result.nothing_else (any change refutes, zero holds only on a
  complete read).
- harness: three-level monotonicity (P6), M7 appends a separate equal
  copy, M3 says when the plan is kept, M15 partial "nothing else" read,
  M16 a result turned bad.
- hard_invariants and versions build verdicts with settle; versions no
  longer lets a duplicate or missing-history row hide another author.
- verify_run._aggregate/_observed settle against cfg.effects;
  receipt_record._line and _tally_lines move onto the kernel.
- wire_tap is a registered site now that #2470 merged.
- Baseline measured again after merging main; every kind is at or below
  a clean origin/main.
…ovenance boundary

A handler that only logs a not-checked word still swallows; only a call that
stores the value records it. M15 must not raise a refuted seed. Observed and
Result.held say the adapter establishes which run produced a read.
The empty-change test is read from either side, a [0:N] slice counts like
[:N], builtins.all/any count as folds, and an unplanned verdict beside a
refuted one makes _observed unknown.
…the step the demo saw writing

Adds openadapt_flow.gui, a neutral view of a screen (controls by role, name,
state and containers) with adapters for a browser page (links included), an
accessibility tree and a form_tx snapshot. gui.steps learns each clicked step's
role from what the backend counted in the demonstration (commit, navigate,
in place, unknown), never from its words, and judges a live step against it.
judge_step is a registered verdict site.
…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.
…ction from the hub

gui.hub classifies an open dialog by what is in it: one that holds an
editable control is a form, never a confirmation, and only a declared
section's dialog may be filled. run_section opens a section, fills and saves
it, and requires the dialog to close with the demonstrated writes and the
card to show done on a fresh read. learn_hub derives each section's opener,
dialog, save control and done tokens from a demonstration. judge_hub settles
the planned sections and is a registered verdict site.
… an in-place step that moves the screen

From Gemini's review of #2499. A navigation must be shown not to write, so
without a write count no step is judged and none is clicked. An in-place step
that moved the screen did something the demo did not.
…nting its own held result

From Gemini's review of #2502. Only judge_hub, a registered verdict site, can
say a section held; run_section now carries its status and verdict.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Gemini
Reviewed-Head: a0646e1

Gemini run on a0646e1 (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

  1. packages/flow/openadapt_flow/gui/hub.py:433
    Why it is a blocker: run_section calls Result.held directly but is not a @verdict_site. This violates the architectural rule that Result.held may only be minted inside a @verdict_site function with a fail-open spec. Bypassing the fail-open harness means a bug in run_section that creates a false pass would not be caught by the mutation tests.
    Fix: Do not call Result.held outside a @verdict_site. Change SectionOutcome to hold the HubVerdict (or just the Status and reason) instead of a Result, or have run_section return the HubVerdict directly.

Non-blocking

None.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: c992c1f

Gemini run on c992c1f (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 finding (fixed in c992c1f).

Blockers

None.

Non-blocking

None.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: c992c1f

Author declaration: Claude wrote the changes on this branch up to and including c992c1f. 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: 8925471

Gemini run on 8925471 (model gemini-3.1-pro-preview, finish reason STOP). Delta review: the only change since the approved head c992c1f is the merge of the base branch, bringing in #2501's 77e7103 (one spec matching several boxes stops on each). Gemini was sent that delta and confirmed it adds nothing else to this PR's diff.

Blockers

None.

Non-blocking

None.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

From: Claude
Reviewed-Head: 8925471

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

# Conflicts:
#	.github/workflows/ci.yml
#	CAPABILITIES.md
#	packages/flow/CHANGELOG.md
#	packages/flow/docs/FAIL_CLOSED.md
#	packages/flow/openadapt_flow/gui/__init__.py
#	packages/flow/openadapt_flow/gui/dom.py
#	packages/flow/openadapt_flow/gui/model.py
#	packages/flow/openadapt_flow/gui/steps.py
#	packages/flow/openadapt_flow/receipt_record.py
#	packages/flow/scripts/verdict_folds_baseline.json
#	packages/flow/tests/failopen/sites/governed_safety.py
#	packages/flow/tests/failopen/sites/gui_steps.py
#	packages/flow/tests/gui/_apps.py
#	packages/flow/tests/gui/_grid.py
#	packages/flow/tests/gui/test_gui_steps.py
@abrichr

abrichr commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: 76612aa

Verified

  • Fail-closed hub settlement (packages/flow/openadapt_flow/gui/hub.py):
    • judge_hub() is registered at @verdict_site("gui.hub.judge", classes="C1 C2") with its fail-open spec in packages/flow/tests/failopen/sites/gui_hub.py.
    • Fixes obligations from planned before reading cards; requires found is True, isinstance(done, bool) (done is False refutes), complete is True, and exact type(open_dialogs) is int and open_dialogs == 0 before any section holds.
    • Preserves REFUTED precedence over NOT_CHECKED and rejects unplanned sections via settle(obligations, results).
  • Clean merge & scope: Pure origin/main merge (76612aa8e6) across 7 files (capabilities/ row, FAIL_CLOSED.md, gui/hub.py, failopen + GUI tests; no hand-edited CAPABILITIES.md, zero per-app engine code).

@abrichr
abrichr enabled auto-merge (squash) November 24, 2026 13:18
@abrichr
abrichr merged commit 1c1e867 into main Nov 24, 2026
49 checks passed
@abrichr
abrichr deleted the claude/gui-hub-sections branch November 24, 2026 14:06
abrichr added a commit that referenced this pull request Nov 24, 2026
…d per instance (#2512)

* feat(flow): one verdict kernel, a fail-open harness and a fold ratchet

Fail-open blockers kept coming back one PR at a time. This fixes the
classes once:

- openadapt_flow/verdict.py: obligations fixed from the plan, settle(),
  allow-list codes, run binding, trust labels. An empty set, a short read,
  a raised probe, another run's result or an unknown code never passes.
- tests/failopen: 13 generic mutations run against every @verdict_site.
  The self-test flags 14 historical bugs rebuilt from this repository's
  code and passes their fixes; three live sites on main are strict xfails
  owned by #2470, #2258 and the connector status follow-up.
- scripts/check_verdict_folds.py: fails CI when a file gains a
  hand-written fold; never on a drop.
- verify_run: an empty or unpaired effect list is INDETERMINATE, unknown
  and unchecked (latent behind min_length=1).

See packages/flow/docs/FAIL_CLOSED.md.

* fix(flow): close the gaps a review found in the verdict kernel and harness

- settle matches on subject key and run binding; obligations dedupe on both
- a HELD token is bound to its subject, so replace() can't move it
- observe refuses to map an exception to Observed
- owned sites list their exact known failures (strict xfail per case)
- pre-fix controls are pinned copies, never live code; S3b shows the
  undo fix still passes an unlisted per-write code
- the ratchet compares per-kind totals, so moving code into a new module
  is not a new fold, judges each exit of an except, refuses a site id on
  two functions, and runs in the smoke job on every change

* fix(flow): second review round on the verdict kernel and harness

- HELD is minted only inside the kernel's constructors, so replace() can't
  copy or restore it; one result claimed by two obligations conflicts
- known failures carry the seed and lens, so a new case can't hide
- the ratchet checks every @verdict_site has a spec on every change, finds
  conditional sites, judges every branch of a returned value, and lowers
  the baseline per kind so a moved fold keeps its allowance
- M7 is out of P1; the S5 seeds plan 20 runs and a gate needing all 20
  passes

* fix(flow): settle the positive controls, verify-run folds and receipt lines on the kernel

- check_verdict_folds: count a broad handler that falls through, leaves by
  break, or names Exception in a tuple or by attribute (swallow_wide); add
  says_unchanged and empty_change_set for "nothing else changed" claims; a
  file that doesn't parse fails; a spec id is an id= or factory argument.
- verdict: count the obligations that claim a result, not repeats of it;
  add Result.nothing_else (any change refutes, zero holds only on a
  complete read).
- harness: three-level monotonicity (P6), M7 appends a separate equal
  copy, M3 says when the plan is kept, M15 partial "nothing else" read,
  M16 a result turned bad.
- hard_invariants and versions build verdicts with settle; versions no
  longer lets a duplicate or missing-history row hide another author.
- verify_run._aggregate/_observed settle against cfg.effects;
  receipt_record._line and _tally_lines move onto the kernel.
- wire_tap is a registered site now that #2470 merged.
- Baseline measured again after merging main; every kind is at or below
  a clean origin/main.

* fix(flow): close the log-call hole in the swallow check; state the provenance boundary

A handler that only logs a not-checked word still swallows; only a call that
stores the value records it. M15 must not raise a refuted seed. Observed and
Result.held say the adapter establishes which run produced a read.

* fix(flow): close the four ratchet and observed gaps Gemini found

The empty-change test is read from either side, a [0:N] slice counts like
[:N], builtins.all/any count as folds, and an unplanned verdict beside a
refuted one makes _observed unknown.

* docs(flow): record how the fold baseline was measured and why unread-first stays

* feat(flow): links, tabs and menu items as steps; the commit point is the step the demo saw writing

Adds openadapt_flow.gui, a neutral view of a screen (controls by role, name,
state and containers) with adapters for a browser page (links included), an
accessibility tree and a form_tx snapshot. gui.steps learns each clicked step's
role from what the backend counted in the demonstration (commit, navigate,
in place, unknown), never from its words, and judges a live step against it.
judge_step is a registered verdict site.

* docs(flow): record gui.steps in CAPABILITIES, the changelog and the fail-closed list

* feat(flow): checkbox attestations declared in pack data and ticked only 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.

* docs(flow): record gui.attestations in CAPABILITIES, the changelog and the fail-closed list

* feat(flow): hub pages of section dialogs, with completion read per section from the hub

gui.hub classifies an open dialog by what is in it: one that holds an
editable control is a form, never a confirmation, and only a declared
section's dialog may be filled. run_section opens a section, fills and saves
it, and requires the dialog to close with the demonstrated writes and the
card to show done on a fresh read. learn_hub derives each section's opener,
dialog, save control and done tokens from a demonstration. judge_hub settles
the planned sections and is a registered verdict site.

* docs(flow): record gui.hub in CAPABILITIES, the changelog and the fail-closed list

* feat(flow): repeating structures learned from the demo, added to match the intake and checked per instance

gui.repeating learns an add-another group from a demonstration (the add
control, the instance's container kind and its fields), adds instances until
the count matches the intake, fills them in document order and reads each one
back by the container it was written into. It stops before writing on a
prefilled instance, more instances than items, an add that did not add exactly
one blank instance, or an add that wrote. judge_instances is a registered
verdict site; location_rows exports the checks in the effect-location shape.

* fix(flow): take no step on a backend that cannot count writes; refute an in-place step that moves the screen

From Gemini's review of #2499. A navigation must be shown not to write, so
without a write count no step is judged and none is clicked. An in-place step
that moved the screen did something the demo did not.

* fix(flow): run_section reports the hub verdict's status instead of minting its own held result

From Gemini's review of #2502. Only judge_hub, a registered verdict site, can
say a section held; run_section now carries its status and verdict.

* docs(flow): record gui.repeating in CAPABILITIES, the changelog and the fail-closed list

* fix(flow): an attestation spec that matches more than one box stops on 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.

* fix(flow): a repeating slot box whose state was not read is neither blank nor a pass

From Gemini's review of #2512: an unread checkbox read as unticked, so an
item expecting unticked passed on missing evidence.
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