v2 evidence: bind release evidence with ts/nonce, pin actual-only quota, ledger onboarding checklist, ledger failure outbox, read-only gate verifier (no live wiring)

- cloud/evidence_binding.py: bind/validate/nonce single-use store;
  release endpoint consumes nonce on first validated submission,
  replay -> 409 evidence_replayed, stale/future -> 409
  evidence_stale, partial -> 400, absent -> old path + label.
  Binding blocks exact replay and stale evidence, NOT restamping
  (unsigned evidence cannot prove content freshness).
- cloud/quota.py docstring: actual-only is the v2 integration
  position (already converged in v1 base via fef09ae, NOT in
  main); original PR semantics (#86 all-rows vs #90 actual-only)
  still pending coordinator confirmation at merge time.
- cloud/ledger_onboarding.py: DDL checklist referencing
  PG_DDL/PG_MARKER_DDL constants, read-only verify_ledger_ready
  and ledger_setup_report; default stays OFF, PG DDL stays an
  operator action (never claimed as executed).
- cloud/ledger_outbox.py + worker hook: ledger write failures
  go to a JSONL outbox in addition to the log and can be
  replayed; task outcome still unaffected (rule 7 kept),
  audit fail-closed untouched -- asymmetry documented, not
  silently changed.
- cloud/gate_verification.py: read-only verifier over an
  injected reader (match/mismatch/skipped); live wiring in
  merge/release is NOT possible on the current contract (no
  repo/ref in body or task row, no guaranteed trusted token),
  proven in the module header; no fake verification claimed.
- cloud/tests/test_v2_evidence.py: 18 new tests, all passing.

(cherry picked from commit bd85e33cd5e846fa6ee5d7e2440182dbd9c758b0)
This commit is contained in:
host committed 2026-11-03 02:49:26 +00:00
1 parent 2dc35bd331
commit 773945d136
9 files changed
+1263 -2

No files matched your search

+8
View File
@@ -210,6 +210,14 @@ POLICY (each rule is enforced in code below, not just prose):
translate to ``%s`` through ``cloud.db``, DDL uses only
Postgres-valid types, no autoincrement/identity column),
exactly like gap 3's PG evidence, and labelled as such.
Integration v2 out-of-box closure (see
``cloud/ledger_onboarding.py``): the DDL checklist, the
explicit enable path and the read-only
``verify_ledger_ready`` / ``ledger_setup_report`` probe
close the "hook off by default + manual PG DDL" gap
WITHOUT changing the default (still OFF) or auto-running
DDL on production Postgres -- the manual PG step remains
an operator action, now checkable instead of assumed.
This module imports ``cloud.attempt_ledger`` only, opens no
database connection itself (callers pass a connection in), and