Repository navigation
feat(verify): recheck an API read-back and the system's log after a window - #2472
Conversation
…indow A write checked against an API and an activity log is checked again after a window the caller sets. The log checkpoint is taken before the first read, the state keeps only keyed MACs, and entry ids, not clocks, place the window. A change since the first read gives REFUTED or NOT_CHECKED, never VERIFIED; a first result that wasn't VERIFIED is never raised.
Independent adversarial review: REQUEST CHANGESFrom: Codex
I reviewed all four changed files and the API adapter paths above. The independent focused test run was waiting for a shared CPU slot at posting. The conclusions above come from tracing the committed source. These findings concern evidence shared by all adapters. The PR’s HTTP tests exercise MockMed REST; the activity-log cases use a scripted source. I found no held-out application or real activity-log adapter qualification in this PR. |
…ad-back A screen read-back or a database verifier can't carry the system_api basis, and a named version path that resolves to nothing now fails the read instead of silently dropping the A to B to A check.
Independent adversarial review: REQUEST CHANGESFrom: Codex The delta fixes the API adapter assurance check and the missing configured version. Four findings from the previous review remain open in whole or in part.
I reviewed the two changed files and the new test assertions. The new tests cover adapter eligibility, a missing configured version, and JSON round-tripping. I did not run another suite or use a live system. |
Independent adversarial review: REQUEST CHANGESFrom: Codex Codex run on 46b9274 (read-only sandbox, blockers only). Codex found 13 blockers. Its findings follow verbatim:
VERDICT: REQUEST CHANGES |
- begin refuses an absent record or one with no identity; the state binds
a MAC of the record's identity, so a selector that moves to another
record is NOT_CHECKED.
- MACs are keyed by the salt and the host frame secret (db_snapshot
mac_key), with a key check, so the state alone can't be tested against
guessed values.
- Values are compared as exact JSON: a missing field fails the read, 1 and
"1" differ, and a type with no JSON form fails the read.
- VerifierReadback refuses redacting verifiers and FHIR/GraphQL without a
named version; an ambiguous or record-naming refutation fails the read;
read-failure reasons are fixed sentences.
- Exemptions are {id: operation} maps and apply only to entries the log
attributes to this caller with that operation; a contradiction is
NOT_CHECKED.
- Proven caller mutations are judged first; a changed value with an
unknown, hidden or other actor on the record is NOT_CHECKED.
- A log that records nothing gives no activity_log basis; without a log the
result lists this caller's other changes as not covered.
- state_problem validates types, bounds and digests; schedule refuses a
malformed state; the result reports the observation interval.
Independent adversarial review: REQUEST CHANGESFrom: Codex The corrective commit closes the absent-record baseline, ambiguous matches with returned records, changes to the observed local record ID, and a configured log that returns no result. The named-version requirement, host-keyed MACs and fixed read-failure messages are in place. Four evidence gaps from the two prior reviews remain.
I traced the corrected paths and read the committed assertions. I did not run a new suite. The evidence is synthetic, including MockMed REST and a scripted activity log. The delta adds no application-specific engine branch. |
Independent adversarial review: REQUEST CHANGESFrom: Codex Codex run on 5cd4111 (read-only sandbox, blockers only, round 2 after the fixes for the 13 round-1 blockers). The prompt stated two design decisions: Record evidence
Log evidence
State, scope and tests
VERDICT: REQUEST CHANGES |
Independent adversarial review: REQUEST CHANGESFrom: Codex Three of the four previous findings are fixed. The remaining blocker is whether the recheck observes the same account, record and log actor as the original verified write.
The FHIR projection now refuses an omitted or ambiguous field flattened to null. A projected explicit null also receives that conservative result. REST checks the deployment wrapper’s policy and scans the retained record for redaction markers before hashing. An incomplete log now yields The engine docstring no longer names a vendor. I traced the source and read the committed assertions. The author reports 70 passing tests. This review adds no new test run or held-out system evidence. |
…nd complete log stream/actor
Independent adversarial review: REQUEST CHANGESFrom: Codex One source-binding gap remains. For a SMART/FHIR reader, Bind the SMART client ID to a stable identifier for its authorization server, or decline verification when the reader cannot establish that identifier. This permits ordinary token or signing-key renewal for the same principal. A focused regression can distinguish the same client ID at two authorities from renewal at one authority. The checked-in shared-endpoint test gives its synthetic readers different account labels. Regression The other parts of the previous review are fixed. A verified first result requires its observed record ID to match the baseline. A scheduled log requires both a nonempty stream and actor, and recheck compares their bound values. Readers with no account identity now decline verification. Baseline · Recheck The owner reports 71 local tests passed. I reviewed the exact source and committed assertions. The two-authority case follows from the supported configuration and was not tested against a live deployment. Hosted checks were still running at publication, and the protected-path evidence check had failed. |
…r in source_scope
Independent adversarial review: REQUEST CHANGESFrom: Codex One comparison still merges distinct SMART token audiences. The new binding removes trailing slashes from the authorization-server identifier. For example, configured token endpoints ending in The previous finding is otherwise addressed for the cases in the new test. A missing authority declines verification. Distinct authorization hosts produce distinct bindings. Renewal with the same client and authority keeps its binding because the bearer token and signing-key ID are excluded. The private state stores the keyed source MAC. The earlier original-record, stream and actor checks are unchanged. Regression · State · Stored MAC I reviewed the source and checked-in assertions without running a new suite. The regression uses synthetic token-source objects. The remaining case follows from the lookup and request code. I did not exercise a live authorization server. |
|
From: Claude |
|
From: Claude |
Independent adversarial review: REQUEST CHANGESFrom: Gemini Gemini run on 76638f3 ( R1-1: FIXED. R2-1: FIXED. R3-1: FIXED. R4-1: FIXED. R5-1: FIXED. R6-1: FIXED. NEW BLOCKER: VERDICT: REQUEST CHANGES The new blocker is fixed at 3224fdf: |
Independent adversarial review: APPROVEFrom: Gemini Gemini run on 3224fdf ( R1-1: FIXED. R2-1: FIXED. R3-1: FIXED. R4-1: FIXED. R5-1: FIXED. R6-1: FIXED. G1: FIXED. VERDICT: APPROVE |
Independent adversarial review: APPROVEFrom: Grok Delta versus Gemini APPROVE at I re-read the recheck begin/recheck path and the tests that closed the earlier Codex findings. A recheck of anything but a No package version, lock, or changelog change. This does not auto-publish. |
Gemini independent review: APPROVEFrom: Gemini Independent diff audit of
CI blocker (not merge-ready yet): CI is red on stale CLI help snapshots ( |
Independent adversarial review: APPROVEFrom: Gemini Delta review versus previously approved head |
#2518 split the page into capabilities/ row files from main as of 17:13 EST. Six later first-parent commits updated the stamped page and were kept on merge, but not the row files, so the stamp test and refresh workflow went red (#2562). Fold those edits into the sources and regenerate the stamp. CAPABILITIES.md is unchanged. - #2471: VERIFIED-run prose; fault-test and openIMIS measured-results notes - #2477: grade file/PDF/email checks by artifact provenance - #2472: api_recheck row - #2397: GraphQL / probe_read_routes text on the transaction-lens row - #2363 / #2368: second-factor row, including terminal/Windows console Fixes #2562
What this does
Most customers give no database access, so the whole-database recheck in
late_write.pycan't run for them. This PR addsruntime/effects/api_recheck.py, a sibling module. It checks an API read-back and the system's own activity log again after a window the caller sets.beginruns right after a verified first check. It takes the log checkpoint first and then reads the record, so an entry between the two reads lands in the window, not the baseline. The private state holds a salt and keyed MACs of the declared fields, the record's version and the write's own log entries. It never holds values. The receipt carries onlystate_sha256anddue_at(schedule).recheckruns at or after the due time. It reads the record, then the log from the checkpoint. The local clock decides only when the recheck is due. Entry ids decide what is in the window, so a server clock that is off (Medplum ran about 1.5 s off) can't hide an entry.VERIFIEDmeans only that, as of the recheck time, the read-back showed the same values and the log showed no unexplained change. It never means "persisted".REFUTED: the record's values changed, the record is gone, or this caller's own log entry shows a change nothing declared accounts for.NOT_CHECKED: another actor changed the record; a log entry has an unknown author or kind; the version moved while the values stayed the same (A to B to A); the log read didn't reach the checkpoint or hid entries; a read failed; the state doesn't match its receipt; the recheck ran early. A first result that wasn'tVERIFIEDalso staysNOT_CHECKED, because a recheck can't raise a result.RecheckResult.scope()gives plain evidence-scope fields: check level, basis (system_api, plusactivity_logwhen a log was read), read-back time, recheck time, window, and a not-covered list. That list always includes "server-side async and outbound effects not observed".VerifierReadbackwraps a REST, FHIR or GraphQL verifier on main. It refuses a verifier that isn't an independent system-of-record read (screen read-backs, SQL), and a namedversion_paththat resolves to nothing fails the read. The log half is theActivityLogprotocol, because main has no audit-log reader yet. The reader in feat(tx): verify API and SaaS writes by resource read-back and the system's own log #2437 (txplan/audit.py) fits it with a thin wrapper.The module imports nothing from
txortxplan. No existing file changed exceptCAPABILITIES.mdandllms-full.txt.Tests
tests/test_api_recheck.py: 43 tests. Scripted record and log cases: an early recheck, a changed value, a deleted record, a change by another actor, A to B to A with and without a version, an extra write by this caller, late collateral and excused later writes, a log entry that lags, an entry stamped 1.5 s before the checkpoint, out-of-order stamps, an unreached checkpoint, hidden entries, read failures, a tampered state, an attempt to raise a non-verified first result, a JSON round trip of the state, refusal of screen-tier and non-API verifiers, a missing named version. Two tests run over real HTTP against MockMed's REST server throughRestRecordVerifier: a late note edit is refuted, and a change to an undeclared field is not checked.