diff --git a/capabilities/04-the-core-a-checked-entry-every-time/0132-one-receipt-word-per-check-the-same-on-every.md b/capabilities/04-the-core-a-checked-entry-every-time/0132-one-receipt-word-per-check-the-same-on-every.md index d4682fe469..e2c16379c8 100644 --- a/capabilities/04-the-core-a-checked-entry-every-time/0132-one-receipt-word-per-check-the-same-on-every.md +++ b/capabilities/04-the-core-a-checked-entry-every-time/0132-one-receipt-word-per-check-the-same-on-every.md @@ -1 +1 @@ -| One receipt word per check, the same on every path: `VERIFIED` only at level 3 (a separate session) or 4 (the system of record), always with the basis that produced the evidence (`separate_session`, `system_api`, `activity_log`, `db_frame` or `owned_connection`); `SHOWN` for an acting-screen re-read, `CONFIRMED` for the counterparty, `ATTESTED` for an operator and `RECORDED` for the rest. `VERIFIED` means "as of the read-back time the read-back showed this value", not "persisted". Run receipts (`record/run/v1`, an additive optional field), `verify-run` receipts and `tx` receipts carry an evidence-scope block: level, basis, word, the wire channel watched, the read-back time, the recheck window, and what it did not cover (always server-side async and outbound effects; a run receipt says it has no per-read time). A run receipt never says `VERIFIED` below level 3. Receipts without the block still verify. A `verify-run` contract with `minimum_effect_strength: independent_session` now verifies on a separate-session read | On main | Unit tests (parity across the runtime report, `verify-run`, `tx` and Execute v1; fake verifiers) | `openadapt_types/check_level.py`, `openadapt_types/evidence_scope.py`, `openadapt_flow/evidence_basis.py` | +| One receipt word per check, the same on every path: `VERIFIED` always names the basis that earned it. The baseline is the check a careful person does after a save, basis `post_save_screen` (level 1): the form left edit mode, no error is shown, and every intended value was read on the screen, field by field, and matched; a banner or toast alone never earns it, and a value that was not read means `RECORDED`. The same check after reopening the record is `reopened_record` (level 2); stronger evidence is a stronger basis on the same word (`separate_session` or `fresh_reload` at level 3; `system_api`, `activity_log`, `db_frame` or `owned_connection` at level 4). A run or policy can require a stronger level: under `Regulated` a screen check is not `VERIFIED`. `CONFIRMED` is the counterparty, `ATTESTED` an operator and `RECORDED` the rest. `VERIFIED` means "as of the read-back time the read-back showed this value", not "persisted". Run receipts (`record/run/v1`, an additive optional field), `verify-run` receipts, `tx` receipts and the kernel's receipt bridge carry an evidence-scope block: level, basis, word, the wire channel watched, the read-back time, the recheck window, and what it did not cover (always server-side async and outbound effects). `openadapt.wrap` takes its word from the Contract's read-back receipt; a declared `checked_how` alone is `RECORDED`. In a browser the runtime records each save's post-save screen check (counts and flags only); on a backend that can't read the page, a run checked only on its screen gets a `RECORDED` receipt. When reloading can't repeat the save, the runtime then reopens the record on a fresh page load and reads every value again (`reopened_record`, level 2); a value the browser showed but the server didn't keep stops the run. Where it can't reopen safely, the check stays at level 1 and such a value can pass. Older receipts that say `SHOWN` still verify and are labelled as the older format. Receipts without the block still verify | On main | Unit tests (shared cases across the types ladder, the run receipt block, the kernel bridge and `openadapt.wrap`; signed `record/run/v1` vectors checked by the Python and JavaScript verifiers); real headless runs on MockMed, compiled without database access: a clean save's receipt is `VERIFIED` / `reopened_record`, and a save whose note the server dropped stops at the reopen (`packages/flow/benchmark/post_save_screen/`). Not yet shown on a held-out app | `openadapt_types/check_level.py`, `openadapt_types/evidence_scope.py`, `openadapt_flow/evidence_basis.py`, `openadapt_kernel/receipt_bridge.py`, `openadapt/wrap_sdk.py` | diff --git a/openadapt/receipt_verify.py b/openadapt/receipt_verify.py index 8dd799709b..64c4528f23 100644 --- a/openadapt/receipt_verify.py +++ b/openadapt/receipt_verify.py @@ -69,6 +69,9 @@ def _describe(result: Any, say: Say, indent: str = " ") -> None: + (f" ({reason})" if reason else "") + ", as the run recorded it. A receipt doesn't grade the run." ) + scope = predicate.get("evidence_scope") + if isinstance(scope, dict): + say(f"{indent}{_check_line(scope)}") checks = predicate.get("checks", {}) lines = predicate.get("lines", []) say( @@ -81,6 +84,25 @@ def _describe(result: Any, say: Say, indent: str = " ") -> None: say(f"{indent}{name}: {value}") +def _check_line(scope: dict[str, Any]) -> str: + """One line naming how the run's writes were checked, from its + evidence-scope block. An older ``SHOWN`` block says it is the older + format.""" + + word = _one_line(scope.get("word")) + level = _one_line(scope.get("check_level")) + # The one older word, named here so the label works with any installed + # openadapt-types (``openadapt_types.evidence_scope.LEGACY_WORDS``). + if scope.get("word") == "SHOWN": + return ( + f"Check: {word} ({OLDER}: the acting screen was read again; level {level})" + ) + basis = scope.get("basis") + return f"Check: {word} (level {level}" + ( + f", basis {_one_line(basis)})" if basis else ")" + ) + + def verify_record_file( path: Path, registry: Sequence[Any], diff --git a/openadapt/seal_view/viewer.html b/openadapt/seal_view/viewer.html index 0b6c9678d6..ddd95d8865 100644 --- a/openadapt/seal_view/viewer.html +++ b/openadapt/seal_view/viewer.html @@ -15,16 +15,16 @@
-