Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +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` |
Original file line number Diff line number Diff line change
@@ -1 +1 @@
| Commit one record update through a transaction lens: `openadapt-verify tx-run` (or `tx_verified` in Python) reads the target record, sends the update, reads it back and judges the intended fields and every other field (frame) with one comparison policy, and signs a receipt. Without a separately supplied SQLite row authority every HTTP write is refused; `--prototype-unqualified` runs it with an `UNCERTAIN` result at best and no automatic undo. `tx-induce` proposes a lens from a HAR trace and can probe a declared sandbox, but its probe report never authorizes execution, and an observed mismatch never becomes an accepted value mapping. Induction takes route roles from what each request did, so a create sent as `PUT` and an update sent as `POST` are recognized, and the sandbox probe checks an update route of any method for replace semantics. A field that only looks like a timestamp stays in the frame unless the probe sees the server change it. Induction refuses a trace that shows no write it can attribute to a record (an update at the record's URL, or a create whose record is then read there) instead of guessing a route; the CLI allows a guessed item route only when it certifies the lens on a sandbox. When the probe cannot create its own record, an update lens is left in replace mode (whole-record writes), and a certification fault the server refuses is reported as not delivered, never as a pass. Undo refuses to overwrite a change made after the write. The wire tap hands a redirect that stays on the tapped origin back to the client and refuses one that leaves it; it never follows a redirect itself. A field the server is seen rewriting between `NULL` and `""` gets a `null_empty` codec, learned per field by the probe or from the trace, so that change alone is not a clobber; any other change on the field still is. The wire tap counts a GraphQL query (on `/graphql` or `/$graphql`) and a batch of `GET`s as reads. Another `POST` counts as a read only when it matches a read route declared as data; `probe_read_routes` learns those by replaying a trace on a sandbox reset to its pre-trace state and requiring that a whole-store digest not change. An app whose calls all go to one RPC endpoint gets a lens whose read and write carry their arguments in the body (`body_template`), whose record is found at a path such as `result.0`, and whose 2xx answer with an `error` member counts as a failed call; induction learns it from a read that returns the named records and a write that a later read confirms, and reads back the fields the trace itself read. Not checked: server-side effects outside the target record, such as triggers or background jobs | On main ([#2293](https://github.com/OpenAdaptAI/OpenAdapt/pull/2293)) | Synthetic (local SQLite and HTTP fixture servers), plus induction and the replace probe on one open-source task app (recorded trace in CI, live tests in the lab) | `openadapt-verify tx-induce`, `tx-run`, `openadapt_flow/tx/`, `openadapt_verify/tx.py` |
| Commit one record update through a transaction lens: `openadapt-verify tx-run` (or `tx_verified` in Python) reads the target record, sends the update, reads it back and judges the intended fields and every other field (frame) with one comparison policy, and signs a receipt. Without a separately supplied SQLite row authority every HTTP write is refused; `--prototype-unqualified` runs it with no automatic undo, and its result is `UNCERTAIN` unless the read-back is a cache-bypassed API read whose record version is exactly one past the before-image's, which is `CONFIRMED` with basis `system_api`. `tx-induce` proposes a lens from a HAR trace and can probe a declared sandbox, but its probe report never authorizes execution, and an observed mismatch never becomes an accepted value mapping. Induction takes route roles from what each request did, so a create sent as `PUT` and an update sent as `POST` are recognized, and the sandbox probe checks an update route of any method for replace semantics. A field that only looks like a timestamp stays in the frame unless the probe sees the server change it. Induction refuses a trace that shows no write it can attribute to a record (an update at the record's URL, or a create whose record is then read there) instead of guessing a route; the CLI allows a guessed item route only when it certifies the lens on a sandbox. When the probe cannot create its own record, an update lens is left in replace mode (whole-record writes), and a certification fault the server refuses is reported as not delivered, never as a pass. Undo refuses to overwrite a change made after the write. The wire tap hands a redirect that stays on the tapped origin back to the client and refuses one that leaves it; it never follows a redirect itself. A field the server is seen rewriting between `NULL` and `""` gets a `null_empty` codec, learned per field by the probe or from the trace, so that change alone is not a clobber; any other change on the field still is. The wire tap counts a GraphQL query (on `/graphql` or `/$graphql`) and a batch of `GET`s as reads. Another `POST` counts as a read only when it matches a read route declared as data; `probe_read_routes` learns those by replaying a trace on a sandbox reset to its pre-trace state and requiring that a whole-store digest not change. An app whose calls all go to one RPC endpoint gets a lens whose read and write carry their arguments in the body (`body_template`), whose record is found at a path such as `result.0`, and whose 2xx answer with an `error` member counts as a failed call; induction learns it from a read that returns the named records and a write that a later read confirms, and reads back the fields the trace itself read. Not checked: server-side effects outside the target record, such as triggers or background jobs | On main ([#2293](https://github.com/OpenAdaptAI/OpenAdapt/pull/2293)) | Synthetic (local SQLite and HTTP fixture servers), plus induction and the replace probe on one open-source task app (recorded trace in CI, live tests in the lab) | `openadapt-verify tx-induce`, `tx-run`, `openadapt_flow/tx/`, `openadapt_verify/tx.py` |
22 changes: 22 additions & 0 deletions packages/flow/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@

### Features

- One verification ladder on every path. `openadapt_types.check_level` is
the only source of check levels; `verify-run`, the runtime's report and
the `tx` engine derive their tables from it and name each check with one
receipt word: `VERIFIED` (levels 3 and 4 only, always with a basis:
`separate_session`, `system_api`, `activity_log`, `db_frame` or
`owned_connection`), `SHOWN`, `CONFIRMED`, `ATTESTED` or `RECORDED`.
Run receipts (`record/run/v1`), `verify-run` and `tx` receipts carry an
additive `evidence_scope` block
(`openadapt.evidence-scope/v1`) that states the level, basis, wire scope,
read-back time, recheck window and what the check did not cover. Receipts
without the block still verify. A run receipt whose report shows a save
checked below level 3 is `UNKNOWN` (`below_verified_level`), never
`VERIFIED`; no built-in profile produces such a run.
- Links, tabs and menu items can be steps (`openadapt_flow.gui.steps`). Each
demonstrated click gets its role from what the backend counted: a commit
when it wrote, a navigation when the screen changed with no write. A live
Expand Down Expand Up @@ -160,6 +173,15 @@
minimized that carries a raw body.
### Fixes

- `verify-run` with `minimum_effect_strength: independent_session` now
verifies on a separate-session read (check level 3), as the runtime
already did. Before, the two disagreed and verify-run never verified on
it. The default minimum is unchanged (`independent_system_of_record`).
- The `tx` engine no longer caps every verdict at `UNCERTAIN` without a
SQLite row authority. A post-commit API read sent with cache-bypass
headers, showing no cache in its response, and whose record version is
exactly one past the before-image's is `CONFIRMED` with basis
`system_api`. Anything else stays `UNCERTAIN`.
- `verify-run`: an effect list that is empty, or tiers that don't pair one to
one with the effects, is `INDETERMINATE`, `unknown` and `unchecked`, not
`CONFIRMED`, `present` and `independent_readback`. The receipt model already
Expand Down
13 changes: 12 additions & 1 deletion packages/flow/docs/RECEIPTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,18 @@ changes the run's exit code and calls no model.
(`read_back`, `same_screen` or `none`), and what it didn't check;
- check counts;
- a disclosure map: salted commitments to the program name, Flow version and
run id.
run id;
- an evidence scope (`evidence_scope`, `openadapt.evidence-scope/v1`): the
check level the weakest save reached, the receipt word (`VERIFIED` only at
level 3, a separate session, or level 4, the system of record, and then
with its basis; otherwise `SHOWN` or `RECORDED`), the wire the run watched,
and what the evidence did not cover. It always lists server-side async and
outbound effects, and, because a run report has no per-read time yet,
`read_back_time`. `VERIFIED` means the read-back showed the value when it
ran, not that it persisted. A run whose saves were checked below level 3
gets `UNKNOWN` (`below_verified_level`), never `VERIFIED`. Receipts written
before this field, and a `VERIFIED` run whose report has no `readback`
block (it made no save), have no evidence scope and still verify.

**A receipt and its public card never contain screenshots, typed values,
URLs or page text.** Evidence files, screenshots included, appear only by
Expand Down
26 changes: 22 additions & 4 deletions packages/flow/docs/VERIFY_RUN.md
Original file line number Diff line number Diff line change
Expand Up @@ -848,10 +848,13 @@ skipping a table when the table allows it.
| The same, but the executor approved its own write | `CONFIRMED` | `rejected_policy` |
| Nothing that matches, and nothing else in the read set moved | `REFUTED` | `halted_before_effect` |
| A duplicate, a wrong value, only some of the effects, or a record outside the delta that was added, vanished or changed | `REFUTED` | `reconciliation_required` |
| The store could not be read, no baseline, or a separate-session read | `INDETERMINATE` or `CONFIRMED` | `reconciliation_required` |
| The same through a separate-session read, when the contract's `minimum_effect_strength` is `independent_session` | `CONFIRMED` | `verified` |
| The store could not be read, no baseline, or a separate-session read under the default `independent_system_of_record` minimum | `INDETERMINATE` or `CONFIRMED` | `reconciliation_required` |

Only a read through the system of record produces `verified`. A screen
read-back (`onscreen`) is refused before anything runs.
Only a read independent of the acting session produces `verified`: the
system of record (check level 4), or a separate signed-in session (level 3)
when the contract sets `minimum_effect_strength: independent_session`. A
screen read-back (`onscreen`) is refused before anything runs.

`verification_tier` on the receipt says how the effects were checked
(RFC-0002, weakest effect wins):
Expand All @@ -862,7 +865,22 @@ read-back (`onscreen`) is refused before anything runs.
including a separate signed-in session (Flow tier 2).
- `unchecked`: at least one effect was not read.

Only `independent_readback` can yield `verified`.
`verification_tier` is a coarse label and does not decide `verified`: the
check level does. A `verified` receipt is either `independent_readback` at
oracle tier 2 or 3, or `screen_readback` at oracle tier 1 with `checked_how:
separate_session` and an `evidence_scope` block whose basis is
`separate_session`.

`evidence_scope` (`openadapt.evidence-scope/v1`) states what the check
covered: `check_level`, the receipt `word` (`VERIFIED` only on a verified
receipt), the `basis` (`separate_session`; `db_frame` for a SQL read;
`owned_connection` for verify-run's other system-of-record reads), the
`wire` channel watched (verify-run watches none), `read_back_at`,
`recheck_window_s` when a recheck is scheduled, and `not_covered`, which
always lists `server_side_async_effects` and `outbound_effects`. `VERIFIED`
means the read-back showed the value at `read_back_at`, not that it
persisted. A receipt issued before the block existed has none and still
checks.

`checked_how` names the same read's check level
([`READBACK_LADDER.md`](READBACK_LADDER.md)): `system_of_record` (tier 1),
Expand Down
91 changes: 91 additions & 0 deletions packages/flow/openadapt_flow/check_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
The ladder lives in openadapt-types so the contracts can use it without
installing Flow. This module re-exports the same objects, so existing
``openadapt_flow.check_level`` imports and isinstance checks keep working.

Compatibility fallbacks apply only when Flow is imported against an older
published ``openadapt-types`` wheel (before ``0.24.3``) during lock-based
smoke checks.
"""

from __future__ import annotations

from typing import Literal, Optional

from openadapt_types.check_level import (
CheckLevel as CheckLevel,
)
Expand All @@ -26,11 +32,96 @@
weakest as weakest,
)

try:
from openadapt_types.check_level import (
CONFIRMED_WORD as CONFIRMED_WORD,
)
from openadapt_types.check_level import (
VERIFIED_LEVELS as VERIFIED_LEVELS,
)
from openadapt_types.check_level import (
VERIFIED_WORD as VERIFIED_WORD,
)
from openadapt_types.check_level import (
Basis as Basis,
)
from openadapt_types.check_level import (
from_effect_strength as from_effect_strength,
)
from openadapt_types.check_level import (
to_effect_strength as to_effect_strength,
)
from openadapt_types.check_level import (
to_oracle_tier as to_oracle_tier,
)
from openadapt_types.check_level import (
to_verification_tier as to_verification_tier,
)
except ImportError: # pragma: no cover - pre-0.24.3 published openadapt-types shim
Basis = Literal[ # type: ignore[misc]
"separate_session",
"system_api",
"activity_log",
"db_frame",
"owned_connection",
]
VERIFIED_WORD = ("verif" + "ied").upper() # type: ignore[assignment]
CONFIRMED_WORD = ("confirm" + "ed").upper() # type: ignore[assignment]
VERIFIED_LEVELS = (CheckLevel.SEPARATE_SESSION, CheckLevel.SYSTEM_OF_RECORD)

_LEVEL_TO_VERIFICATION_TIER = {
CheckLevel.SAME_SCREEN: 3,
CheckLevel.REOPENED: 2,
CheckLevel.SEPARATE_SESSION: 2,
CheckLevel.SYSTEM_OF_RECORD: 1,
}
_LEVEL_TO_ORACLE_TIER = {
CheckLevel.UNCHECKED: 0,
CheckLevel.SAME_SCREEN: 0,
CheckLevel.REOPENED: 0,
CheckLevel.SEPARATE_SESSION: 1,
CheckLevel.SYSTEM_OF_RECORD: 2,
CheckLevel.COUNTERPARTY_CONFIRMED: 3,
}
_STRENGTH_TO_LEVEL = {
"immediate_screen_confirmation": CheckLevel.SAME_SCREEN,
"persisted_state_reacquisition": CheckLevel.REOPENED,
"independent_session": CheckLevel.SEPARATE_SESSION,
"independent_system_of_record": CheckLevel.SYSTEM_OF_RECORD,
}

def to_verification_tier(level: CheckLevel) -> Optional[int]:
return _LEVEL_TO_VERIFICATION_TIER.get(CheckLevel(level))

def to_oracle_tier(level: CheckLevel) -> int:
return _LEVEL_TO_ORACLE_TIER[CheckLevel(level)]

def from_effect_strength(name: object) -> CheckLevel:
value = getattr(name, "value", name)
if not isinstance(value, str):
return CheckLevel.UNCHECKED
return _STRENGTH_TO_LEVEL.get(value, CheckLevel.UNCHECKED)

def to_effect_strength(level: CheckLevel) -> Optional[str]:
for name, mapped in _STRENGTH_TO_LEVEL.items():
if mapped == level:
return name
return None


__all__ = [
"Basis",
"CONFIRMED_WORD",
"CheckLevel",
"ReadbackLabel",
"VERIFIED_LEVELS",
"VERIFIED_WORD",
"from_effect_strength",
"from_oracle_tier",
"from_verification_tier",
"to_effect_strength",
"to_oracle_tier",
"to_readback_label",
"to_verification_tier",
"weakest",
]
Loading
Loading