Skip to content

feat(ladder): one check-level ladder and evidence-scope receipts on every path - #2495

Merged
abrichr merged 16 commits into
mainfrom
claude/nodb-ladder
Nov 24, 2026
Merged

abrichr merged 16 commits into
mainfrom
claude/nodb-ladder

Conversation

@abrichr

@abrichr abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member

What this does

Makes openadapt_types/check_level.py the only source of check levels and gives every receipt one word for its evidence.

  • One ladder. verify-run, the runtime report, the tx engine and Execute v1 build their tier and strength tables from check_level. A separate-session read is level 3 on every path. It counts as VERIFIED with basis separate_session when the contract's minimum is independent_session. Before this change, verification.py and verify_run.py disagreed about it. The default minimum (independent_system_of_record) is unchanged.

  • Receipt words. outcome_word(level, basis) returns VERIFIED only for levels 3 and 4, and only with a basis (separate_session, system_api, activity_log, db_frame, owned_connection). A same-screen or reopened check is SHOWN, a counterparty check is CONFIRMED, an operator's confirmation is ATTESTED, and anything else is RECORDED. VERIFIED means "as of the read-back time, the read-back showed X", not "persisted".

  • Evidence scope. openadapt_types/evidence_scope.py adds openadapt.evidence-scope/v1. It records the check level, the word, the basis, the wire scope (the channel watched and the protocols parsed), the read-back time, the recheck window and not_covered. not_covered always lists server_side_async_effects and outbound_effects.

    • verify-run receipts carry the block, and so do tx receipts and their results.
    • So do run receipts (record/run/v1). There it is an additive, optional predicate field. When the field is absent, wire() leaves it out, so older receipts keep their canonical bytes and still verify. All existing shared vectors are byte-identical after regeneration. Two new vectors were added: valid-evidence-scope and evidence-scope-disagrees.
    • A run report has no per-read time, so a run receipt lists read_back_time in not_covered instead of guessing one.
    • A run receipt whose saves were checked below level 3 is UNKNOWN with reason below_verified_level. It is never VERIFIED, and no built-in profile produces such a run.
  • tx without SQLite authority. tx/lens.py no longer caps every verdict at UNCERTAIN. A post-commit update read is CONFIRMED with basis system_api (tx/api_readback.py) when all of these hold:

    • the read was sent with cache-bypass headers;
    • the response shows no sign of a cache (no Age, cache-status or Warning 11x headers, and the status is not 304);
    • the record's integer version is exactly one past the before-image's;
    • no concurrent modification was reported.

    Anything else is still UNCERTAIN. Undo still requires the row authority.

The new code is in new modules: evidence_scope.py, evidence_basis.py and tx/api_readback.py. No size or import budget was raised.

Compatibility with #2476 (verdict kernel)

git merge-tree against claude/fail-open-general conflicts only in packages/flow/CHANGELOG.md, and the verify_run.py hunks are disjoint. I ran #2476's check_verdict_folds.py on the merged tree, and this branch adds no folds. The only increase is says_success in hooks/cli.py and hooks/engine.py. That code is already on main, so #2476 needs to refresh its baseline either way.

Tests

Run with the CPU slot runner:

  • packages/types/tests: 845 passed.
  • packages/flow/tests, the tx, hooks, execute, receipt, seal, countersign, verify-run, one-ladder, readback and check-level files: 1166 passed, 8 skipped, 3 failed.
    • Two of the failures are in test_hooks_e2e.py (invalid_write_evidence from receipt_record._write_lines). They fail the same way on a clean origin/main (e754d56).
    • The third, test_tx_atomic_authority.py::test_http_redirects_cannot_change_endpoint_method_or_forward_credentials, was a connection reset under load. It passed 3 of 3 times when rerun.
  • Launcher: tests/test_cli_seal.py, test_quickstart.py, test_quickstart_lifecycle.py and test_quickstart_command.py: 117 passed, 2 skipped.
  • ruff check passed and ruff format --check was clean.

tests/test_one_ladder.py checks that the same evidence gets the same level, word and basis on every path: the runtime report, verify-run, tx, Execute v1 and the run receipt. Tests that expected UNCERTAIN for a version-checked API read now expect CONFIRMED with basis system_api. test_oracle.py now expects an Execute receipt that opted in to independent_session to validate as verified at tier 1. It still can't mint a production Seal.

Not in this PR

  • Provenance grading for local file, PDF and email checks.
  • The wording in THREAT_MODEL.md.
  • Website copy.

The Cloud and website TypeScript receipt verifiers must accept the optional predicate.evidence_scope (shared vectors) before a release ships receipts that carry it.

# Conflicts:
#	CAPABILITIES.md
#	llms-full.txt
#	packages/flow/CHANGELOG.md
…adder

Run receipts (record/run/v1) carry the optional evidence_scope block; a
receipt without it keeps its canonical bytes and still verifies. A run
receipt never says VERIFIED below check level 3. Fake-verifier verify-run
tests now take a baseline so the frame is judged. tx tests that expected
UNCERTAIN for a cache-bypassed, version-checked API read now expect
CONFIRMED with basis system_api; undo still needs the row authority.
# Conflicts:
#	packages/flow/openadapt_flow/receipt_record.py
#	packages/types/openadapt_types/receipt.py
@abrichr

abrichr commented Nov 22, 2026 •

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: 6140966

Gemini run on 6140966 (gemini-3.1-pro-preview). Header corrected: this review was produced by Gemini, not Codex.

Note: the Codex CLI stopped before reviewing because its account hit a usage limit (retry possible from Nov 27). As the review procedure allows, the review was run on Gemini (gemini-3.1-pro-preview) instead. Gemini had no repository access. It received the full diff against origin/main (without llms-full.txt) and the complete post-change text of every changed non-test Python file. It was asked for blockers only: correctness, fail-open paths, security, broken or vacuous tests, and claims not backed by code. Everything else was out of scope.

Summary of the review

Gemini found no blockers:

  • The single ladder in check_level.py maps evidence to the right word and basis.
  • A tx API read-back gives basis system_api only with a cache bypass and a version exactly one past the before-image. Anything else stays UNCERTAIN.
  • ExecuteEvidenceReceiptV1 validation still enforces the tier-2 floor. The only exception is a contract that opts into an independent_session minimum, which then yields separate_session.
  • The fallback and downgrade paths fail closed.

The review was short and gave no file-level findings.

VERDICT: APPROVE

# Conflicts:
#	CAPABILITIES.md
#	llms-full.txt
#	packages/flow/CHANGELOG.md
#	packages/types/CHANGELOG.md
@abrichr

abrichr commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: e487e5c

Delta review versus previously Gemini-approved head 61409662b407ae204d0f2c3986202859fab9d25d: clean merge of origin/main (2ea74802f). Verified packages/flow/openadapt_flow/receipt_record.py preserves both _evidence_scope() (one-ladder check-level / evidence-scope receipts) and origin/main's sealed_set.write_bytes path, with doc/changelog conflicts cleanly resolved. Zero behavior regression. Approve for merge on green CI.

# Conflicts:
#	packages/types/CHANGELOG.md
# Conflicts:
#	capabilities/04-the-core-a-checked-entry-every-time/0340-commit-one-record-update-through-a-transaction.md
#	packages/flow/CHANGELOG.md
@abrichr

abrichr commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: f8972de

Independent cross-vendor delta review of claude/nodb-ladder (e487e5c8..f8972dea):

  • openadapt_types/check_level.py: Adds and exports VERIFIED_WORD: OutcomeWord = "VERIFIED" and CONFIRMED_WORD: OutcomeWord = "CONFIRMED" — strictly additive typed constants matching OutcomeWord.
  • Flow consumers (evidence_basis.py, receipt_record.py, tx/api_readback.py, tx/lens.py, tx/receipt.py, verify_run.py): Pure mechanical replacement of "VERIFIED" / "CONFIRMED" literals with VERIFIED_WORD / CONFIRMED_WORD for verdict-fold compliance. All evidence-scope invariants remain fail-closed:
    • receipt_record.build_statement still lowers VERIFIED to UNKNOWN (below_verified_level) whenever a readback block is present but fails to reach a verified level/basis.
    • TxReceiptPayload._coherent_wire_commitment still rejects any evidence_scope whose word == VERIFIED_WORD disagrees with self.outcome == CONFIRMED_WORD.
    • verify_run._evidence_scope_receipt_problem still enforces exact agreement between scope["word"] == VERIFIED_WORD, outcome, and checked_how.
  • Sync: 438f14d6f5 cleanly merges origin/main with no behavioral drift or safety regressions.

Ready to merge once CI completes green.

@abrichr
abrichr enabled auto-merge (squash) November 24, 2026 09:54
@abrichr

abrichr commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: 4b7a7f9

Scope checked

Verified the delta f8972deab25fc61e0bc77419a2638848481e31c7..4b7a7f95df07d4a5cc578c951e33bc2cc2fcaf1b (fix(flow,tests): keep smoke and launcher tests compatible with pre-0.24.3 openadapt-types).

Verification

  • packages/flow/openadapt_flow/check_level.py: Pre-0.24.3 ImportError fallback mirrors Basis, VERIFIED_WORD, CONFIRMED_WORD, VERIFIED_LEVELS, and the tier/strength mapping helpers in openadapt_types.check_level verbatim, and is only reached when importing against an older published openadapt-types wheel.
  • packages/flow/openadapt_flow/{evidence_basis.py,tx/api_readback.py,tx/lens.py,verification.py,verify_run.py}: Routing imports through openadapt_flow.check_level and deferring build_evidence_scope import in tx_evidence_scope avoids import-time breakage on pre-0.24.3 wheels while failing loud (TypeError / ImportError) if receipt-emission or validation functions are invoked without openadapt_types.evidence_scope (no silent bypass).
  • tests/test_verify_seal_action.py: _ensure_in_tree_types() evicts preloaded openadapt_types.* submodules outside the in-tree package path so launcher tests import the in-tree openadapt_types.

Generality Gate & Durability

  • No weakened safety checks, no silent fallback to pass, and no test-only shortcuts in runtime logic.

@abrichr

abrichr commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: 7a0965a

Scope checked

Verified the delta 4b7a7f95df07d4a5cc578c951e33bc2cc2fcaf1b..7a0965a82b04557c727b7a3482f6ebbd5e55064f (fix(flow): satisfy mypy on check_level shim and verify_run evidence_scope).

Verification

  • packages/flow/openadapt_flow/check_level.py: isinstance(value, str) guard before _STRENGTH_TO_LEVEL.get(...) cleanly removes # type: ignore[arg-type] with identical runtime behavior.
  • packages/flow/openadapt_flow/verify_run.py: # type: ignore[misc] on the Final EVIDENCE_SCOPE_FIELD fallback and int(recheck_after_s) guard when recheck_due_at is not None and recheck_after_s is not None satisfy mypy without changing safety or receipt semantics.

# Conflicts:
#	packages/flow/CHANGELOG.md
@abrichr

abrichr commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: b34574c

Scope checked

Verified merge commit b34574cce2dc30083da131d33073310cd149b51c (7a0965a82b04557c727b7a3482f6ebbd5e55064f + origin/main 990073c4971183c2c0cb471287b3a7311ab92683).

Verification

  • Conflict resolution in packages/flow/CHANGELOG.md cleanly keeps both the #2495 and #2499 (openadapt_flow.gui.steps) changelog entries. No code or safety changes from previously approved 7a0965a8.

@abrichr

abrichr commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Gemini
Reviewed-Head: 5167bd1

Scope checked

Verified the delta b34574cce2dc30083da131d33073310cd149b51c..5167bd171494c3057863bbba5a0e3167115be18b (fix(flow,verify): guard evidence_scope for pre-0.24.3 types, fix reconcile mypy, and update tx facade test).

Verification

  • packages/flow/openadapt_flow/receipt_record.py: routes VERIFIED_WORD through openadapt_flow.check_level and returns None from _evidence_scope only when openadapt_types.evidence_scope is absent on pre-0.24.3 wheels.
  • packages/flow/openadapt_flow/reconcile/__init__.py: (_STRENGTH_BY_TIER.get(tier) or "unchecked") cleanly narrows to str for mypy with identical runtime behavior.
  • packages/flow/openadapt_flow/verify_run.py: guards build_evidence_scope emission when absent on pre-0.24.3 wheels, and _evidence_scope_receipt_problem rejects receipts carrying an evidence_scope block if evidence_scope_problem is unavailable (evidence_scope_problem is None or ...), never accepting an unvalidated block.
  • packages/verify/tests/test_tx_verify_facade.py: updates the e2e CLI tx run test to assert #2495's system_api confirmation (rc_run == 0, outcome == "CONFIRMED", evidence_scope.word == "VERIFIED", evidence_scope.basis == "system_api").

Generality Gate & Durability

  • No weakened validation gates, no silent acceptance of unverified evidence, and no app-specific shortcuts.

@abrichr
abrichr merged commit b454999 into main Nov 24, 2026
53 checks passed
@abrichr
abrichr deleted the claude/nodb-ladder branch November 24, 2026 14:54
abrichr added a commit that referenced this pull request Nov 24, 2026
#2640)

Types 0.24.2 publishes from its newest commit, so it ships #2495's
check_level and evidence_scope. Those were listed under Unreleased. The
#2495 push run failed on a Flow __main__ import bug (fixed in #2639), so
this commit also gives types a new commit to publish from.
abrichr added a commit that referenced this pull request Nov 24, 2026
…ier (#2643)

* fix(seal-view): validate predicate.evidence_scope in JS receipt verifier

Port openadapt_types.evidence_scope.EvidenceScopeV1 and
predicate_evidence_scope_problem into packages/seal-view/src/lib/receiptRecord.mjs
and rebuild openadapt/seal_view/viewer.html so the JS verifier matches
packages/types after #2495 added predicate.evidence_scope and its two
shared record-run-v1 test vectors.

* test(seal-view): update seal_viewer_size.json snapshot (257738 / 262144 bytes)
abrichr added a commit that referenced this pull request Nov 24, 2026
* fix(flow): require openadapt-types>=0.24.2 for Flow 4.0.0

Flow 4.0.0 imports openadapt_types.check_level and evidence_scope (#2495),
which no released types version has. The >=0.24.0 floor let pip resolve
types 0.24.0 and fail on import.

* chore(flow): hold Flow 4.0.0 until its types floor is 0.24.2

release_plan publishes a version only when CHANGELOG.md's first dated entry
matches it. Undating v4.0.0 keeps the plan at wait, so #2639's green push
run can't publish 4.0.0 with openadapt-types>=0.24.0, which fails on import.
#2637 re-dates the entry together with the >=0.24.2 floor.

* chore(flow): re-date v4.0.0 with the 0.24.2 types floor (undoes the #2641 hold)

* chore(flow): relock openadapt-types 0.24.2

* chore(connectors): relock eligibility for the 0.24.2 types floor; name all new types imports
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