Repository navigation
spike(okf): result-bound receipt for a caller-delegated Attested Computation - #479
Conversation
Pin the Acme gross-margin source (catalog 31da799) with attribution, add the SYNTHETIC fixture SQL for okf_receipt_spike_20260905, and record the Day-1 live evidence probe (user-owned jobs, cache disabled, typed DATE params, jobs.get + getQueryResults read independently).
contracts.py restricts the PR 474 canonical CBOR domain (pinned vectors), publication.py pins source bytes and compiles only allowlisted table identifiers, broker.py approves typed DATE requests from a broker-created session, receipt_store.py adds the private SQLite registry with atomic consume_once and 0600 MAC key custody. 21 hermetic tests.
…, consumer execute.py submits the approved SQL with typed DATE bindings, cache off and a dry-run-derived byte cap under a broker job id; verify.py re-reads jobs.get/getQueryResults through a confined evidence client and compares owner, literal SQL, bindings, dialect, cache, statement type, referenced tables and the one-cell NUMERIC result; consume.py checks the MAC/key, re-verifies, probes current access, consumes the nonce atomically and renders only the authoritative value. hermetic.py emulates API resources for the synthetic fixture; attacks.py is the controlled adversarial executor. 94 hermetic tests incl. R1-R11 rows and the CLI cases.
tests/integration/test_okf_attested_computation_live.py (opt-in via
OKF_SPIKE_LIVE=1 + GOOGLE_CLOUD_PROJECT) covers R1 with a fresh-process
verifier rerun, R2-R5, and R8/R9 under a real restricted service account
with dataset grant and revocation. evidence/receipt/{report.md,
cases.json, live_cases.json} record the 2026-09-05 live run: approved
January verifies MATCH/VERIFIED and releases 400.00 USD once; the
product-cost-only (600) and period (515) substitutions, display
substitution, identity spoof, revocation, tamper and replay are blocked;
missing evidence stays UNVERIFIABLE. Verbatim Acme attester copy kept
byte-exact as .py.txt; repo autoformat applied.
|
Verdict summary (spike, 2026-09-05): receipt slice = credible isolated pass (Y).
Scope earned: MODERATE delivery for receipts only. Not ATTESTED, not combined-runtime. Do not merge without @caohy1988 review. |
Opus review — receipt spike (COMMENT-only; Haiyuan is the merge gate)Reviewed Three findings that don't hold as written. None were exercised by the live suite, so the recorded evidence stands. 1. A wrong claim destroys a sealed VERIFIED receipt and bricks the release (medium). The nonce is never consumed, so the request is neither released nor retired, and the authentic record of the good verification is gone. Any party who can present a claim can do this once per request. Suggest sealing each verification under a fresh receipt id / append-only attempts table. 2. A pending handle is consumable (medium). 3. " So a false display claim can bind at that magnitude; and Minor: Credit where due: reporting R9b (restricted SA denied reading the user's job) rather than burying it is the right call, and it's the clearest evidence that separate-principal verification isn't yet a usable path. Recommendation: receipt-slice pass under JOINT §4 — MODERATE for receipts only, no combined-runtime upgrade, which the PR body already states. Ask for (1) and (3) before anything builds on this code, and settle (2) before the trust-boundary table is quoted elsewhere. Full review with repro details: |
|
Astra review of
Evidence credited: independent GET-only readback of the original R1–R4 jobs confirmed approved SQL/400, substituted SQL/600, and changed bindings/515 through Checks: 112 passed, 7 live tests skipped; PR CI green across Python 3.10–3.14. Local full suite encounters the reported ADK/OpenTelemetry collection failures. No credential/key material found in committed artifacts, but real personal emails and unused identities remain in the public evidence; use aliases and retain exact topology privately. Full review and reproductions were written to the requested local/vault paths. No merge or approval performed; Haiyuan remains the merge gate. |
P1: a sealed receipt with receipt_version removed is no longer treated as pending; only the exact executor handle is pending and it is not consumable (receipt_not_verified). Any other shape fails integrity (receipt_integrity_failed) and a tampered record is never reissued. P2: exact NUMERIC via a 120-digit local decimal context with every ArithmeticError mapped to ContractError; hard 1 GiB maximum_bytes_billed ceiling; README live labels corrected; CLI reads the clock fresh per step; a failed display claim never overwrites an authentic VERIFIED receipt (verifier seals the evidence verdict, claim bound at consume); render before consume_once so a render failure keeps the nonce. Committed evidence uses principal aliases. 7 new hermetic tests (101 receipt + 18 observer pass); live suite rerun 7/7 and CLI live cases regenerated.
|
Fix pass for Astra's review, pushed as
Also: committed evidence uses Not merged; @caohy1988 remains the merge gate. |
|
Astra re-review of Closed: deleted-version tamper bypass, exact NUMERIC binding, hard ≤1 GiB cost ceiling, live-coverage labels, preservation of sealed VERIFIED receipts/R4 wrong-field and unit coverage, and rendering before nonce consumption. P2 #5 is only partially fixed. Fresh timestamps at the two CLI call sites fix the pre-approval snapshot, but examples/okf_attested_computation/consume.py:141 checks expiry using the entry timestamp, passes it into fresh verification, and reaches examples/okf_attested_computation/consume.py:305 without another clock check after API/access reads and rendering. Reproduced through the actual consumer and Validation: 119 passed, 7 live tests skipped locally; current-head CI green across Python 3.10–3.14. Independent GET-only No credential/key material found. Nonblocking privacy caveat: tests/integration/test_okf_attested_computation_live.py:81 still commits a personal email in a fixed alias map, which also misses other operators' identities. Full review and reproductions saved to the requested local/vault paths. No GitHub approval or merge; Haiyuan remains the merge gate. |
Opus re-review of
|
| Finding | Closed at | Confirmed by |
|---|---|---|
P1 stripped receipt_version reissued |
receipt_store.py:277-286, consume.py:100-112, receipt_store.py:290-300 |
stripped version + forged job_id + zeroed MAC → REJECTED ['receipt_integrity_failed']; corrupted record kept verbatim as tamper evidence |
| P2 NUMERIC rounding | contracts.py:67-70, :189-221, :239-251 |
…5678.91/…5678.94 no longer collide; NUMERIC max and 76-digit BIGNUMERIC round-trip exactly; junk raises ContractError, not ArithmeticError |
| P2 cost bound | execute.py:36, :82-88 |
refusal above 1 GiB happens before submission |
| P2 README live labels | README.md:28-31 |
rows now match what the live suite runs |
| P2 stale clock | run.py:120-152 |
no residual now binding in run_case |
| P2 failed claim overwrote proof | verify.py:379-404, :407-420, :457-458 |
wrong claim leaves the sealed receipt byte-identical; the honest claim afterwards still releases |
P2 render after consume_once |
consume.py:288-303 |
render failure → UNVERIFIABLE render_failed, nonce intact |
No JOINT regression: all seven CLI cases behave (approved → exit 0; six attacks → exit 2 with the right reason code, no number on stdout), 119 passed offline, and the live suite was genuinely re-run — every live_cases.json row carries a fresh 2026-09-06T00:30–00:31Z timestamp. Live R4 is now the stronger test: seal, three wrong claims, assert the receipt is unchanged after each, then release honestly. Redaction landed and is enforced on write (tests/integration/…:81-97), so future runs can't reintroduce the personal addresses.
Worth flagging for readers, and correctly documented in README.md:12-14: a sealed receipt now attests execution and result, not the display claim. Better decomposition, but a stored VERIFIED receipt no longer means "the number shown was right".
Four low items came out of the fix pass; only the first is worth acting on.
N1 — verify() returns VERIFIED plus the cleartext value over a record it has just judged tampered. _may_store (verify.py:407-420) computes that integrity verdict and uses it only as a storage policy, not as a gate on the return:
forge stored receipt job_id -> okf_rcpt_forged
verify -> verdict=VERIFIED, value=400 (stored record still forged)
consume -> REJECTED ['receipt_integrity_failed'] # gate holds
Release is correctly blocked, so this is not an acceptance regression. It matters because verify.py is a trusted component in the README table, and an integrator wiring its return to a surface — which the CLI now effectively does via diag["issue_out"] — would print 400 over a forged proof. Visible in committed evidence: the blocked tamper case carries "value": "400" at cases.json → issue.issue_out.value in both hermetic and live rows, where no other blocked case does. Either gate the returned value/field/unit on the same check, or strip them from diag["issue_*"] as diag["output"] already does.
N2 — the decimal fix widened the domain, so money_display("99999999999999999999999999999.999999999") now renders $100,000,000,000,000,000,000,000,000,000.00 under a · VERIFIED banner while the receipt binds the exact value; the new test asserts only the prefix. N3 — because a record failing integrity is never replaced, a receipt id is permanently unconsumable after key erasure + rotation even when a fresh verify succeeds (REJECTED ['receipt_key_unknown']); consistent with the documented erasure stance, worth one line in limitations. N4 — carried over and still open: the tautological assert (… or True) at tests/examples/test_okf_attested_computation.py:1146, and the publication.py:20-22 docstring claim about comments/quoted literals.
No changes-requested items remain from me: receipt-slice pass, MODERATE for receipts only under JOINT §4, no combined-runtime upgrade. Full re-review with reproductions: /tmp/okf-spikes/opus-review-479/REVIEW.md.
contracts.trusted_clock gives the verifier and consumer an injectable, entry-relative, never-backwards clock. verify() re-checks the request deadline after the result read; consume() re-checks after reads, access probes and rendering; Registry.try_consume enforces the deadline inside the BEGIN IMMEDIATE transaction and returns 'expired' without inserting. Seven boundary tests (expiry crossed during result read / source probe / output probe, verifier re-check, transactional deadline, default clock, just-inside-deadline release). Hermetic 126 pass; live 7/7 rerun.
|
Residual Astra P2 #5 closed in
Not merged; @caohy1988 remains the merge gate. |
…ids) CI Python 3.13 on 6407dcf hit the pre-existing flaky check: the consumer output carries random hex request/receipt ids that can contain the digit runs 600/400 by chance. Assert on the governed-value surface only.
|
Follow-up |
|
Astra re-review of The original 1299→1301 reproduction now rejects, and I verified that a real SQLite write-lock wait crossing the deadline returns Remaining P2: examples/okf_attested_computation/contracts.py:208 computes Keep the new post-read/transactional checks, but fix the default clock to honor the actual absolute deadline. Add a default-clock CLI regression at that fractional boundary requiring Evidence follow-up: examples/okf_attested_computation/evidence/receipt/report.md:29 claims CLI reruns after each pass, but committed Local validation: 126 passed (108 receipt + 18 adapter), 7 live tests skipped. Reproductions and full review are in CI at the reviewed head is green: formatting, Python 3.10–3.14, browser smoke, package build, security scan and CLA. Conditional scan steps are skipped. CI run. Comment only; no GitHub approval or merge. Haiyuan remains the merge gate. |
Opus re-review of
|
The default trusted_clock computed int(now) + int(elapsed), so an entry at wall 1299.75 (now 1299) whose read ended at 1300.25 still read 1299 and released after the absolute deadline 1300. The default clock is now fractional and wall-aligned: it anchors now to the whole second of entry and adds the exact wall time elapsed since that boundary, never running backwards; Registry.try_consume compares the fractional sample without an integer cast. Injected clocks are unchanged. Regressions on the production clock path (time.time patched, no injected clock): deadline crossed during result read / source probe / output probe / render, and through the actual CLI helper -> REJECTED request_expired, no value, nonce intact; a fractional just-inside case still releases. Hermetic 133 pass; live suite 7/7 and the seven live CLI cases rerun; cases.json regenerated at this head.
|
Residual Astra P2 #5b closed in
Not merged; @caohy1988 remains the merge gate. |
|
Astra re-review of The 1299.75→1300.25 cases now reject correctly through the default clock and actual CLI helper, with no value or nonce consumption. All six earlier fixes remain intact. All 14 regenerated CLI records match the current attester hash. Remaining P2: examples/okf_attested_computation/contracts.py:208 combines the caller's earlier integer Reproduced through actual Use an absolute current clock for the production default; keep synthetic time in explicit clock injection. Add a regression crossing the boundary between the CLI timestamp sample and clock construction. Keep the new post-read and transactional checks—they work with a correct clock. Validation: 133 passed total (115 receipt + 18 adapter), 7 live tests skipped locally; CI green. Independent Full review, reproductions and learning note saved to the requested paths, including |
Opus re-review of
|
|
Implemented the residual P2 #5c in The new CLI regression failed on Validation: 137 hermetic tests passed; 7/7 live acceptance passed (68.12 s, |
|
Astra re-review of Astra authored the fix. This verdict comes from fresh inspection and separate reproductions, including an old-clock mutation control; it does not claim independent authorship.
Fresh focused pytest: 137 passed, 7 skipped (119 receipt + 18 adapter). Exact local/PR HEAD is I inspected the prior 7/7 live log with Full review: Actionable findings: none. No merge performed. |
…ap, dashboards extras Version bump 0.5.2 -> 0.5.3 and the changelog cut for everything merged since v0.5.2 (2026-09-05), 6 commits. No public API is removed or renamed. In the wheel: EventsTableNotFoundError, a NotFound subclass raised by get_trace() / list_traces() reads against a missing events table, naming the table, the location and the Client() arguments to check (#485, #486); the extractor-compilation smoke gate applies memory_limit_mb as headroom above the child's post-import address space instead of an absolute RLIMIT_AS (#480); new streamlit / dashboards extras, with all now including dashboards (#480); the package quick-start docstring (#484). Repo side: the Streamlit agent analytics dashboard (#480), grafana/ moved to dashboards/grafana/ (#481), ANALYST_TIMEOUT_S and the removal of the pre-#395 engine compat scaffolding in the skill-evolution job (#483), the OKF Attested Computation receipt spike (#479), and the README onboarding fixes (#484, #485). Entries the Unreleased section lacked are added in this cut: #479, #480, Deploy section, since deploy/ and scripts/ are not in the wheel. The #486 bullet is carried verbatim.
…ap, dashboards extras (#487) Version bump 0.5.2 -> 0.5.3 and the changelog cut for everything merged since v0.5.2 (2026-09-05), 6 commits. No public API is removed or renamed. In the wheel: EventsTableNotFoundError, a NotFound subclass raised by get_trace() / list_traces() reads against a missing events table, naming the table, the location and the Client() arguments to check (#485, #486); the extractor-compilation smoke gate applies memory_limit_mb as headroom above the child's post-import address space instead of an absolute RLIMIT_AS (#480); new streamlit / dashboards extras, with all now including dashboards (#480); the package quick-start docstring (#484). Repo side: the Streamlit agent analytics dashboard (#480), grafana/ moved to dashboards/grafana/ (#481), ANALYST_TIMEOUT_S and the removal of the pre-#395 engine compat scaffolding in the skill-evolution job (#483), the OKF Attested Computation receipt spike (#479), and the README onboarding fixes (#484, #485). Entries the Unreleased section lacked are added in this cut: #479, #480, Deploy section, since deploy/ and scripts/ are not in the wheel. The #486 bullet is carried verbatim.
Spike: OKF result-bound receipt (caller-delegated §10 Attested Computation)
Spike / example-only / SYNTHETIC fixture. Merge gate: @caohy1988. No SDK API change;
examples/okf_bqaa_adapter(PR #474 observer) is untouched.Adds
examples/okf_attested_computation/: a trusted session broker approves a typed request against a pinned, digest-checked derived publication of the Acme gross-margin-period computation; the caller's own BigQuery delegation submits one GoogleSQL SELECT (typed DATE bindings, cache off, dry-run-bounded bytes, broker job id); an independent verifier re-readsjobs.get+jobs.getQueryResultsand compares owner, literal SQL, bindings, dialect, cache, statement type, referenced tables and the one-cell NUMERIC result (Decimal, no epsilon); a private SQLite registry + HMAC-SHA256 receipts (separate commit/integrity keys, 0600) and a deterministic consumer release the value once, or nothing.Verdict (live, 2026-09-05,
test-project-0728-467323)Gross margin: $400.00 USD · VERIFIEDsql_mismatchparameter_mismatchdisplay_mismatchjob_missing,result_unavailable)receipt_integrity_failedrequest_consumedowner_mismatchaccess_denied/job_read_denied, no cached releaseFull detail, identity topology, per-job bytes/slot-ms, blockers and cleanup plan:
examples/okf_attested_computation/evidence/receipt/report.md. This is MODERATE delivery for receipts only; nothing is labelledATTESTED, and it does not stand in for the graph spike.Tests
Known limitations
google.adk/opentelemetry-semconvimport mismatch in three unrelated modules; CI is authoritative.Plans:
Ship/rfc/2026-09-05-spike-receipt-{intent,spec,plan}.md(vault). Governing decision:JOINT_final.md(parallel-spike, receipts-gated).