Skip to content

feat(receipts): the post-save screen check earns VERIFIED, with basis post_save_screen - #2849

Merged
abrichr merged 19 commits into
mainfrom
claude/post-save-screen-verified
Dec 1, 2026
Merged

abrichr merged 19 commits into
mainfrom
claude/post-save-screen-verified

Conversation

@abrichr

@abrichr abrichr commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Feature (receipt vocabulary), with tests and docs. Touches openadapt-types, openadapt-flow, openadapt-kernel, the launcher (openadapt.wrap, openadapt receipt verify) and seal-view.

Summary

OpenAdapt checks a save the way a careful person checks their own work. The post-save screen check is the baseline, so it now earns VERIFIED, with the evidence named in the basis. Stronger evidence is a stronger basis on the same word, not a better word.

  • New bases. post_save_screen is level 1. reopened_record is level 2, the same check after the acting session reopened the record.
  • How a basis is earned. Only post_save_screen_basis() hands these bases out, from a per-save ScreenCheck. The check must show that every intended value was read on the screen field by field and matched, the form left edit mode, no error is shown, and the save was not signalled only by a banner or toast.
  • Incomplete checks. A field not read, a value that differs, or a flag nobody observed (None) earns no basis, and the word is RECORDED. The receipt lists fields_not_read when a value was not read.
  • Stronger bases. separate_session, fresh_reload, system_api, activity_log, db_frame and owned_connection keep their levels on the same VERIFIED word.
  • Policy floor. outcome_word and build_evidence_scope now default minimum to same_screen. Regulated passes separate_session, so a screen check is not VERIFIED under it; a test covers both profiles through verified_tier_floor.
  • SHOWN is retired. No producer writes it. Older blocks that say SHOWN still validate at levels 1 and 2 without a basis. They verify in Python and JS (a signed vector covers it), and openadapt receipt verify labels the word as the older format.
  • not_covered. It still always lists server-side async and outbound effects.

One word per path

Path What it does now
Run receipts (evidence_basis.evidence_scope_for_run) Takes screen_checks and earns the basis only from one complete check per save. The tier alone never earns it, because other evidence also lands at tier 4.
verify-run read_proves_delta now uses the new INDEPENDENT_LEVELS (3 and 4), so its behaviour is unchanged even though VERIFIED_LEVELS now lists levels 1 to 4.
Kernel bridge Adds a post_save_screen channel that applies the same rule to proof.screen_check. ReadBackProof.is_valid() refuses an incomplete check. A channel the bridge does not know no longer counts as a level 3 fresh_reload read; it is not checked (fail closed).
openadapt.wrap wrap_receipt_word() takes the word from the Contract's verify-run receipt, bound by digest. A declared checked_how alone is RECORDED. Signed bytes are unchanged.
effect_location, tx Unchanged in logic. A screen reading there has no ScreenCheck, so it is RECORDED where it used to be SHOWN.
seal-view JS verifier Accepts the new bases, and fresh_reload, which it was missing. viewer.html is rebuilt at 261,870 of the 262,144-byte budget.

| Flow runtime (new) | After each save on a backend that can read the page (the browser), it records a post-save screen check in report.json (StepResult.post_save_screen, ReadbackSave.screen_check; counts and flags only, omitted when unset). The run receipt earns post_save_screen from it. |

Flow runtime: the post-save screen check

runtime/post_save_screen.py compares the page right before the save with the settled page after it, before any read-back navigates away.

  • Intended values. What the run typed or chose for this save: type and select steps since the previous save, run inputs resolved, secret inputs left out.

  • Field read. A value bound to its label (Note: <value>), alone on a line, or in a labelled table cell or dd, judged by the shared strict matcher (openadapt_types.evidence), which is unchanged. Text in a banner, toast or status region (role alert/status/log, aria-live, or an id or class naming a banner, toast, alert, notice, flash or snackbar) is not a field read. A match must be new: the value shows in more places after the save than before it.

  • Left edit mode. No visible editable control still holds an intended value.

  • Error shown. An error region appeared or changed, a control became aria-invalid, or a new line carries a failure word. The region and aria-invalid signals work in any language; the word list is only an extra signal.

  • Reopened (level 2). When the post-save check is complete and reloading the page can't repeat the save, the runtime reopens the record. Reloading counts as safe when the save loaded no new document, or when the new address has no query string. The reopen is a fresh GET load of the same page in a new tab of the same session.

    • Every value shows again: the check is marked reopened, the save counts as level 2, and the receipt names reopened_record.
    • A value is missing (the browser showed something the server didn't keep): the run stops at that save.

Backends that can't read the page (desktop, Citrix, RDP) record no check, so their screen-checked runs stay RECORDED. Where reloading isn't safe, the check stays at level 1.

What it still can't see:

  • an identical older record that first appears after the save;
  • a dropped value on a save that couldn't be reopened safely;
  • effects the server performs later, or sends elsewhere.

Compiler and verifier: read the field, not the banner

A same-screen read-back mined from the demonstration's stable region landed on MockMed's "Encounter saved — " banner, and the verifier rightly refused banner text as not the field.

  • Compiler (effect_mining.mark_labelled_field): it now marks the one after-frame line where the saved value is bound to the label it was typed under, as a ReadbackField with that label. On web recordings the field is read from page structure.
  • Verifier: it compares only the value bound to a marked field's label (ReadbackField.label, omitted when unset).

MockMed was changed, and why

MockMed's patient record view now shows each saved encounter's fields with labels: Type: Triage | Note: <note>, where it used to show Triage — <note>.

  • Why: a careful person checks a save by reading the record's labelled fields, and real EMRs show them. Before this, MockMed showed the note only inside the banner and an unlabelled line, so no field-by-field read was possible.
  • Loaded from the server: with the fault backend, a fresh page load now reads the saved encounters from the server (/api/db), as a real record view does. Before, MockMed kept them only in the page, so a reopened record showed nothing.
  • What stays the same: selectors and the banner.
  • Readers updated: tests/test_mockmed.py and benchmark/ui_readback/gui_harness.py.
  • Golden runs: the mockmed_* golden baselines pin the old row text, the final screenshots, and report bytes (which now include the screen check). They are Linux results regenerated in CI, so they will be refreshed from this PR's CI artifact.

Real-run proof (in-house)

packages/flow/benchmark/post_save_screen/ (README, script and results) covers one real headless run on MockMed. The program was compiled without database access, as a customer with no database gets it, and ran with only the on-screen verifier under the standard profile.

  • Clean save: the receipt is VERIFIED with basis reopened_record, level reopened. The post-save check read 1 of 1 fields and matched it, the form closed, no error appeared, and the record showed the note again after reopening. openadapt receipt verify and the JS verifier both accept it.
  • ?fault=partial (the server stores the encounter without its note; the page still shows it): the run halts at the save, because the reopened record shows 0 of 1 saved values.
  • Regulated profile: the run gate refuses the same program before it runs, because it requires a separate-session or system-of-record check.
  • ?fault=timeout: the run halts.
  • probe-views.json: shows the check after the save and after the reopen for each fault. partial and optimistic look complete right after the save and are caught on reopen. timeout sees the error and the open form, and session reads nothing.

The script stands in for the reviewing person twice, and says so:

Not yet shown on a held-out app. MockMed motivated this work, so this is in-house evidence. A run on an app that didn't motivate it, such as OpenEMR's encounter view, hasn't been done. Public wording should wait for it.

Tests

  • Shared cases: packages/types/tests/vectors/screen-check/cases.json holds ten cases, run through the types ladder, Flow run receipts, the kernel bridge and openadapt.wrap (tests/test_post_save_screen_parity.py).

  • Signed record/run/v1 vectors, checked by the Python, kernel and JS verifiers:

    • valid-evidence-scope-post-save-screen (accepted)
    • older-evidence-scope-shown (accepted)
    • evidence-scope-screen-with-unread-fields (refused)
    • evidence-scope-screen-with-unchecked-write (refused)
  • Runtime check: packages/flow/tests/test_post_save_screen_runtime.py.

  • Labelled-field read-back: test_labelled_field_readback.py.

  • Policy floor: test_post_save_screen.py.

  • Schema fixtures: ir.json, deployment.json and runtime.effects.effect.json regenerated with the locked pydantic. ir.json and deployment.json were already stale on main.

  • Local results:

    Suite Result
    types 1112 passed
    kernel 386 passed
    verify 177 passed, 5 skipped
    seal-view 69 passed
    launcher (parity, receipt verify, wrap) passed
    Flow, files touching receipts, ladder, on-screen, effect mining, compiler or MockMed 6008 passed

    The 12 Flow failures also fail on clean main locally or pass when run alone: runtime_validation, dialog_row_identity, the handoff tests and browser_attach.

Docs

  • THREAT_MODEL.md: a new section, "The baseline: check like a careful operator". The post-save screen check is part of layer 1, and record, wire and undo checks are upgrades. It also states what the screen check can't see.
  • Receipt, ladder and effect-location docs: updated RECEIPTS.md, READBACK_LADDER.md and EFFECT_LOCATION.md to the runtime check and its limits.
  • Capability row 0132: rewritten. It names the in-house real run and says "not yet shown on a held-out app".
  • Not regenerated: CAPABILITIES.md and llms-full.txt. Repo policy and CI forbid it in a PR; refresh-generated.yml does it after merge.

Generality

  1. Per-app code: none in the engine. The check uses labels, roles, aria-* attributes and counts. MockMed is a test app.
  2. Class fix: this fixes the class "receipt word decided per path". One rule lives in openadapt_types.check_level (copied into the standalone kernel), with shared vectors for every path.
  3. Held-out evidence: in-house MockMed run only; not yet shown on a held-out app.

Independent review

I ran codex exec with paid API keys stripped.

Round Reviewed Verdict Fixed in
1 the receipt vocabulary diff REQUEST_CHANGES, 11 findings 6dc8258
2 the round-1 fixes REQUEST_CHANGES, 8 findings 176533b
3 verification 6 of 8 fixed, 2 small regressions 7f08b90
4 the runtime, compiler and MockMed diff REQUEST_CHANGES, 15 findings, 13 high b3827da
5 verification 2 fixed, 12 partly, 4 regressions 5ce0be5
6 verification most fixed; the rest are mainly crafted-page edge cases 0190cf7

After round 6 I stopped iterating. Each hardening pass on crafted HTML opened a new crafted case, as earlier review loops have done.

Stated limits (also in the docs):

  • Saves that couldn't be reopened safely. A value the server dropped while the page still shows it can pass. The reopen catches it wherever reloading is safe.
  • Identical records. An identical older record that first appears after the save can't be told apart from the new one without record identity.
  • Two forms, one save. Edits in two forms before one save are counted together.
  • Selects. A select, or a save made by a choice, makes that save uncheckable (no basis). Resuming a linear run does the same.
  • The marked field's place is fixed when the program is compiled. The read-back reads the screen position where the demonstration showed the saved value. If the record already has rows when the program runs (an earlier encounter for the same patient), that position can show the older row. The check then reads the wrong value and halts. This fails closed, but it's a false stop whenever the record list already has rows. The quickstart avoids it by resetting the app before each run.
  • The shared matcher's ; rule. The shared matcher treats ; as a field separator, so Note: green; awaiting review reads as green. This is unchanged on purpose.

Known gaps left from round 6, rare on honest pages:

  • Overlaid iframe: an opaque overlay covering a whole visible iframe.
  • Unnamed control: an unnamed input whose position shifts when a hidden sibling is inserted.
  • Program resume: resuming a program run, which doesn't pass resume_from, starts with an empty edit list.
  • Reopen upgrade: a fixed-navigation reopen upgrade keeps the demonstrated literal. This was already so before this PR.

Pre-existing, not changed here:

Release order

  1. openadapt-types (feat, so 0.25.0).
  2. A follow-up PR that raises the openadapt-types pin in Flow and the launcher to >=0.25.0,<0.26.0.
  3. Flow, kernel, the launcher and seal-view.

With types 0.24.x, Flow fails closed: there is no screen basis. Older verifiers refuse receipts that carry the new bases as malformed, so verifiers should upgrade first.

Checklist

  • I have tested this change locally
  • Documentation is updated if needed
  • CI passes (golden baselines to refresh from CI)

Notes

Held until after the Dec 1 launch. Do not merge before the coordinator signs off.

…ve_screen from it

The runtime now observes, after each save on a backend that can read the page,
what a careful person checks: every value the run typed for the save read in a
field (bound to its label, alone on a line, or in a labelled cell), the form
no longer holding the values, and no new error (error regions, aria-invalid,
or failure words on new lines). Counts and flags only go into report.json
(StepResult.post_save_screen, ReadbackSave.screen_check, both omitted when
unset), and the run receipt earns post_save_screen from them.

MockMed's patient record view now shows each saved encounter's fields with
labels (Type: ... | Note: ...), as a real EMR's record view does; the banner
is unchanged.
…eld; real-run proof

The compiler marks the after-frame line where the saved value is bound to the
label it was typed under as the read-back field (effect_mining.mark_labelled_field),
so a same-screen check reads the record's field instead of a banner. The
on-screen verifier compares only the value bound to a marked field's label
(ReadbackField.label, omitted when unset). A save whose post-save screen check
read every field no longer lists field_values as unchecked on its receipt line.

benchmark/post_save_screen holds a real headless MockMed run compiled without
database access: its receipt is VERIFIED with basis post_save_screen (Python and
JS verifiers), the regulated profile refuses it, and per-fault screen checks.
…d edits, stricter field reads

- Page view: per-element exclusion of status regions, on-screen text only,
  table headers respect column spans, editable controls keyed by element
  path; a frame that is shown but can't be read means no check.
- Check: every intended value read under its label in one record that is new
  since the save; a still-showing form (even cleared) has not left edit mode;
  any visible error region or invalid control is an error.
- Intended values are the edits the run delivered since its last executed
  save (not the workflow definition), so guards, loops and graph runs count
  what ran.
- Compiler: labels from this save's steps only; the label starts a line or
  follows a separator and the value ends there; the effect value is bound to
  the run input; long labels are skipped.
- Verifier: a labelled field needs the strict matcher's label binding.
- Receipt: screen checks come from each write's own result; a repeated step
  earns nothing; checks on stronger-tier saves are ignored.
- A missing openadapt_types.evidence means no check, never a failure.
…abel-bound reads keep their kind

- Receipt: the saves that need a screen check are rebuilt from the write
  results, not the summary; checks on saves read at level 3 or 4 are ignored
  (including for fields_not_read).
- Page view: one visible-text reader for lines, cells and dd (status text,
  controls and unselected options left out; covered or off-screen text left
  out; <br> and blocks start lines, not source newlines); tables with row
  spans give no pairs; off-screen frames are skipped; controls keyed by id,
  name or label when they have one.
- Check: a value shown under its label before the save, in any form, is not
  new; failure words are looked for in table and dl cells and outside the
  saved values.
- Edits: a select or a resumed run makes the next save's edits unknown (no
  check); only a successful save starts a new list.
- Verifier: a labelled read keeps the field's value_kind and date order.
- Compiler: a line with the label twice is not marked; the effect value is
  bound to the run input after the different-path pass.
…e-word value stripping, rendered spacing

- Receipt: the run's level is its weakest write's, from the write results.
- Error scan: a saved value is left out only as whole words.
- Page view: whitespace between inline elements is kept, hidden elements
  don't break lines, a status cell is left out, a one-row table's cells are
  lines, and a named control's key includes its form.
- Check: only a record that already showed every intended value counts as
  shown before, so a value shared with an older record still reads.
- A save made by a choice gets no check; an ambiguous labelled date stays
  ambiguous; the compiler counts a repeated label on the raw line.
…d_record)

After a complete post-save screen check, when reloading the page can't repeat
the save (the save loaded no new document, or the new address has no query
string), the runtime loads the same page fresh in a new tab of the same
session and reads every typed value again. All shown: the check is marked
reopened and the save counts as level 2, so the receipt names
reopened_record. One missing (the browser showed a value the server didn't
keep): the run stops at that save.

MockMed's record view now loads saved encounters from the server on a fresh
page load (fault backend only), the way a real record view does, so the
reopen reads what was stored. Its partial and optimistic faults, which looked
complete right after the save, are now caught on reopen.
- File-size budgets: the page reading moves to backends/page_view.py (no
  change to playwright_backend.py); the edit tracker, the before/after page
  views and the reopen halt live in the effects mixin and
  runtime/post_save_screen.py; replayer.py gains one call line and ir.py two
  one-line fields (plain dicts, omitted when unset). PostSaveScreenEvidence
  moves to runtime/post_save_screen.py.
- Verdict-folds ratchet: evidence-only handlers hand back NOT_CHECKED; the
  receipt rebuilds its saves through summarize_report; wrap_receipt_word uses
  verify-run's classify().
- run_proof.py disables argument abbreviations; public artifact inventory
  lists the new evidence files; shard durations cover the new test files;
  seal-view size snapshot updated.
- Tests reading MockMed's encounter row follow the labelled text: the e2e
  banner OCR check scores adjacent line pairs (OCR splits the banner), and the
  chaos check expects 'Type: Triage'.
@abrichr

abrichr commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Grok
Reviewed-Head: 9426725

I reviewed this exact head. I am not approving, and I will not merge or push.

Blocker

  1. A reopened page that is still in edit mode can still earn reopened_record. with_reopen treats the reopen as complete when fields_matched == fields_intended and error_shown is False. It does not require left_edit_mode is True, banner_only is False, or fields_read == fields_intended. On success it copies reopened=True onto the original post-save check, so the reopened page's left_edit_mode=False never reaches the receipt. with_reopen · ScreenCheck.complete

    I built a complete post-save check (fields_intended=2, form closed, no error), then a reopen view that still had the same labelled values in the original editable. observe set left_edit_mode=False on the reopen, but with_reopen returned the original check with reopened=True and left_edit_mode=True. post_save_screen_basis then returned reopened_record. The tests cover a dropped value and a clean reopen, not this case. The reopen should have to pass the same complete-check rule as the post-save check, including that the form has left edit mode.

Related fail-closed gap

  1. observe never reports an unobserved flag as None. The receipt rule is that a flag nobody observed earns no basis. If the after-view omits editables, error_texts and invalid_controls, observe still sets left_edit_mode=True and error_shown=False, and the check is complete. The Playwright page_view path always inserts those keys, so this is not the production collector's usual path, but observe should treat a missing observation as None, not as "form closed, no error."

What holds

  • ScreenCheck.complete itself is strict: at least one intended field, every field read and matched, left_edit_mode is True, error_shown is False, banner_only is False. Unobserved left_edit_mode / error_shown (None) earn no basis.
  • A run receipt earns post_save_screen / reopened_record only from one complete check per screen-level save. The tier alone does not earn it. A missing basis on a screen-level run is RECORDED.
  • The kernel bridge no longer treats an unknown channel as fresh_reload; it earns no level. Its screen-check rule matches ScreenCheck.complete.
  • wrap_receipt_word takes the word only from a bound verify-run receipt whose digest matches; a declared checked_how alone stays RECORDED.
  • A labelled value that was already on screen before the save, a banner-only status message, a still-visible editor, and a visible error region all fail closed in observe when those keys are present.

Generality gate

python scripts/check_engine_generality.py at this head reported "Engine generality OK (7 baseline hits left)". The check logic is labelled-field and page-structure, not an application-specific path inside openadapt_flow. The MockMed fixture change (Type: … | Note: …, and a fault-backend reload from /api/db) stays in packages/flow/openadapt_flow/mockmed.

Tests I ran

  • packages/types/tests/test_post_save_screen.py: 30 passed.
  • packages/kernel/tests/test_post_save_screen_bridge.py: 23 passed.
  • packages/flow/tests/test_post_save_screen.py and test_post_save_screen_runtime.py: 39 passed. The existing suite does not cover the still-editing reopen.

CI at this head

CI is red, for two reasons this branch does not yet address:

  • Flow unit and default-at-rest shard 2 fail on the inherited TypeError: run_quickstart() got an unexpected keyword argument 'break_it' in test_quickstart_encrypted.py. That is the main bug test(flow): encrypted quickstart test follows #2840's act 3 #2866 already fixed. This branch is behind current main (a8cc637080). I will not merge main into this PR; the author should.
  • Golden mockmed_pass and mockmed_pass_structural differ only in $.app_state.enc_item: baseline Triage — Golden triage booking three months vs this head Type: Triage | Note: Golden triage booking three months, which is the intentional MockMed label-format change. Baselines need a refresh after the reopen fix, not a silent CI skip.

The review-verdict check is red because this is the first Grok/Codex review of this head. I am not merging. The PR already says it is held until after the Dec 1 launch and needs the coordinator's sign-off.

Limitations, not blockers

The PR already lists several honest gaps (a server-dropped value that the page still shows until reopen, identical older records, selects making a save uncheckable, the shared matcher's ; rule, English failure words with role=alert / aria-invalid as the language-independent signal). Those stay limitations once the reopen completeness rule is as strict as ScreenCheck.complete.

…ncounter row

Taken from CI run 46580234507's flow-golden-runs artifact (Linux). The only
differences are the encounter row text, now 'Type: Triage | Note: <note>'
(was 'Triage — <note>'), and the final screenshot's hash that shows it.
@abrichr

abrichr commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Grok
Reviewed-Head: 471d445

I reviewed this exact head. I am not approving, and I will not merge or push.

This is a re-review. Since 94267253a953, the only changes are a merge of current main (including #2866's quickstart test fix) and a MockMed golden-baseline refresh for the labelled encounter row. The with_reopen blocker I reported at the previous head is still present, unfixed, in the same lines.

Blocker

  1. A reopened page that is still in edit mode can still earn reopened_record. with_reopen treats the reopen as complete when fields_matched == fields_intended and error_shown is False. It does not require left_edit_mode is True, banner_only is False, or fields_read == fields_intended. On success it copies reopened=True onto the original post-save check, so the reopened page's left_edit_mode=False never reaches the receipt. with_reopen · ScreenCheck.complete

    I built a complete post-save check (fields_intended=2, form closed, no error), then a reopen view that still had the same labelled values in the original editable. observe set left_edit_mode=False on the reopen, but with_reopen returned the original check with reopened=True and left_edit_mode=True. post_save_screen_basis then returned reopened_record. The tests still cover a dropped value and a clean reopen, not this case. The reopen should have to pass the same complete-check rule as the post-save check, including that the form has left edit mode.

    The same "success" path also discards a reopen whose banner_only is True or whose fields_read is short, because those fields are taken from the original check rather than the reopen.

Related fail-closed gap

  1. observe never reports an unobserved flag as None. The receipt rule is that a flag nobody observed earns no basis. If the after-view omits editables, error_texts and invalid_controls, observe still sets left_edit_mode=True and error_shown=False, and the check is complete. The Playwright page_view path always inserts those keys, so this is not the production collector's usual path, but observe should treat a missing observation as None, not as "form closed, no error."

What holds

  • ScreenCheck.complete itself is strict: at least one intended field, every field read and matched, left_edit_mode is True, error_shown is False, banner_only is False. Unobserved left_edit_mode / error_shown (None) earn no basis.
  • A run receipt earns post_save_screen / reopened_record only from one complete check per screen-level save. The tier alone does not earn it. A missing basis on a screen-level run is RECORDED.
  • The kernel bridge no longer treats an unknown channel as fresh_reload; it earns no level. Its screen-check rule matches ScreenCheck.complete.
  • wrap_receipt_word takes the word only from a bound verify-run receipt whose digest matches; a declared checked_how alone stays RECORDED.
  • A labelled value that was already on screen before the save, a banner-only status message, a still-visible editor, and a visible error region all fail closed in observe when those keys are present.

Generality gate

python packages/flow/scripts/check_engine_generality.py at this head reported "Engine generality OK (7 baseline hits left)". The check logic is labelled-field and page-structure, not an application-specific path inside openadapt_flow. The MockMed fixture change stays in packages/flow/openadapt_flow/mockmed.

Tests I ran

  • packages/types/tests/test_post_save_screen.py: 30 passed.
  • packages/kernel/tests/test_post_save_screen_bridge.py: 23 passed.
  • packages/flow/tests/test_post_save_screen.py and test_post_save_screen_runtime.py: 39 passed. The existing suite still does not cover the still-editing reopen.

CI at this head

Finished package checks I can see are green, including packages / flow core critical (golden VERIFIED, zero model calls), types, kernel, seal-view, launcher, and flow unit shards 1, 2 and 4. Merging main looks to have cleared the inherited break_it TypeError that #2866 fixed. Still in progress when I reviewed: flow unit shard 3/4 and default-at-rest shards 3/4 and 4/4. The review-verdict check is red because the newest review was still my REQUEST CHANGES at 94267253a953; this comment is for 471d445959780ecb93ff3110d12c924165a4df02. I am not merging. The PR already says the merge is held until the founder decides.

Limitations, not blockers

The PR already lists several honest gaps (a server-dropped value that the page still shows until reopen, identical older records, selects making a save uncheckable, the shared matcher's ; rule, English failure words with role=alert / aria-invalid as the language-independent signal). Those stay limitations once the reopen completeness rule is as strict as ScreenCheck.complete.

…ved flags are None

- with_reopen: the reopened page's own check replaces the post-save one
  (marked reopened), so the receipt carries what the reopen saw; it earns
  reopened_record only by the ScreenCheck.complete rule (every value read
  and matched, form closed, no error, not banner-only). The reopen gate uses
  the same rule.
- observe: a view that doesn't report editable controls or error signals
  gives left_edit_mode / error_shown None, never closed / no error.
- Tests: a reopen that still shows the editable form, a banner-only reopen,
  a reopen that reads fewer fields, the reopen's own flags, unobserved flags.
@abrichr

abrichr commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: f79c09e

I reviewed this exact head. I am not merging or pushing.

This is a re-review of the REQUEST CHANGES I posted at 471d44595978. The only change since that head is f79c09eb020d, which is confined to runtime/post_save_screen.py and new tests in test_post_save_screen_runtime.py. Both issues I raised are fixed, and I could not find a remaining path that awards reopened_record or post_save_screen from an incomplete reopen.

The earlier blockers

  1. with_reopen no longer copies reopened=True onto the original post-save check. The reopened page's own check now replaces it, marked reopened, so the receipt carries the reopen's flags (left_edit_mode, error_shown, banner_only, fields_read). It earns reopened_record only through _complete, which now matches ScreenCheck.complete: every intended value read and matched, left_edit_mode is True, error_shown is False, banner_only is False. with_screen_check still raises a save to level 2 only when complete and reopened. A reopen that could not be read (None) still leaves the original complete post-save check at level 1, not reopened.

    I rebuilt the earlier case: a complete post-save check, then a reopen that still showed the typed value in an editable. observe set left_edit_mode=False on the reopen; with_reopen kept that flag and reopened=True. _complete and ScreenCheck.complete were false. post_save_screen_basis returned None. with_screen_check stayed at same_screen. _evidence_scope for a VERIFIED report did not name reopened_record or post_save_screen. The new tests cover this case, a banner-only reopen, a reopen that reads fewer fields, and the reopen's own error flag reaching the receipt.

  2. observe now reports unobserved flags as None. If the after-view omits editables, left_edit_mode is None. If it omits error_texts or invalid_controls, error_shown is None. Those checks are not complete and earn no basis. The Playwright collector still always inserts those keys (empty lists / zero), so the production path is unchanged when the page was actually read.

Fail-closed paths I re-checked

  • A dropped value, a wrong value under the label, a visible error region, and aria-invalid (invalid_controls > 0) are all incomplete and earn no basis.
  • A record that already showed every intended value before the save is not counted as new.
  • A banner or status message alone is banner_only and is not a field read.
  • A value with no label, or a value found only in longer unlabelled text, is not a field read.

Value matching (units 1 / units 12)

Field reads go through the shared strict matcher (evaluate_field on labelled lines, match_field on table cells). page_view only collects structure; it does not match values. OnScreenReadbackVerifier._read_labelled and value_matches use the same matcher / compare_value, not a substring. I probed units 1 vs units 12, 1 vs 12, and Ann Smith vs Ann Smithers, both as bare text and as Label: … lines: evaluate_field was not MATCH, value_matches was False, and observe.fields_matched was 0. An exact Dose: units 12 still MATCHes.

Generality gate

python packages/flow/scripts/check_engine_generality.py at this head reported "Engine generality OK (7 baseline hits left)". The check logic stays labelled-field and page-structure, not an application-specific path inside openadapt_flow.

Tests I ran

  • packages/types/tests/test_post_save_screen.py: 30 passed.
  • packages/kernel/tests/test_post_save_screen_bridge.py: 23 passed.
  • packages/flow/tests/test_post_save_screen.py and test_post_save_screen_runtime.py: 44 passed (the five new cases included).
  • Local probes as above, including the earlier still-editing reopen and the prefix-value matcher cases.

CI at this head

Finished package checks I can see are green, including packages / flow core critical (golden VERIFIED, zero model calls), types, kernel, seal-view, launcher, and verify clean install and quickstart. Still in progress when I reviewed: flow core unit shards 1–4, default-at-rest shards 2–4, and Windows replay. Evaluate review verdict / review-verdict are red because the newest review was still my REQUEST CHANGES at 471d44595978; this comment is for f79c09eb020dd2be18c057fe264dccc8b42efd2c.

Two other checks are red, both at install time, not in this PR's code: Check without saving (GTK, ten cases, no skips) and freerdp transport round trip (loopback RDP session) failed with "Ubuntu package download failed" after every usable apt mirror. Those same jobs were green at 471d44595978. I am not treating them as a product regression, and I am not merging.

Limitations, not blockers

reopen_halt still stops the run only when the reopened record shows fewer matching values than intended (fields_matched < fields_intended). A reopen that is still in edit mode, shows an error, or is banner-only, but still displays every typed value, does not halt; it also earns no screen basis and cannot keep reopened_record. The PR's existing listed gaps (a server-dropped value that the page still shows until reopen, identical older records, selects making a save uncheckable, the shared matcher's ; rule, English failure words with role=alert / aria-invalid as the language-independent signal, and a compile-time field position that can halt on an older row) remain honest limitations.

@abrichr
abrichr added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 7c88912 Dec 1, 2026
52 of 55 checks passed
@abrichr
abrichr deleted the claude/post-save-screen-verified branch December 1, 2026 16:35
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