Skip to content

feat(reporting): object-storage bindings for revision rows - #3160

Merged
bokelley merged 1 commit into
bokelley/reporting-inline-row-migrationfrom
bokelley/reporting-object-row-storage
Oct 8, 2026
Merged

bokelley merged 1 commit into
bokelley/reporting-inline-row-migrationfrom
bokelley/reporting-object-row-storage

Conversation

@bokelley

@bokelley bokelley commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

This is PR 8 of 16 for Stage 1 of the shared persistence spec (adcontextprotocol/adcp#7996, §3.2–§3.5). It is stacked on #3159.

Revision and adjustment rows can now live in object storage.

Port (row-storage-object.ts)

  • ReportingRowObjectProviderV1 has five operations:
    • validateLocation, a closed schema with no paths or secrets;
    • probe;
    • putIfAbsent, a create-only write that returns {created, nativeVersion} and never replaces an object;
    • get, pinned to an exact native version, with an optional byte range and a hard maxBytes;
    • delete, which removes only the exact version and is idempotent.
  • Key templates must begin with {prefix}/{namespace_key}/ and include {content_sha256} and {chunk_index}. The account segment is sha256(JCS(["adcp.account_key.v1", namespace_key, account_id])), never a raw ID. Rendered keys are confined to the owned prefix, and ./.. segments are refused.
  • createFilesystemReportingRowObjectProviderV1({ roots }): bindings name a root and never a path, and writes go through temp file → fsync → link().
  • runReportingRowObjectProviderConformanceV1 lets adopters qualify custom providers.

Engine and store

  • Object bindings live in host code and form the allowlist. Reads compare the recorded binding identity digest with the configured definition and refuse (STATE_UNAVAILABLE) if it is unconfigured or differs. Registering a binding whose identity or namespace changed fails with UNSAFE_BINDING.
  • Write path, per spec §3.5:
    1. skip the upload on replay;
    2. refuse unless the DB lease still covers writeDeadlineMilliseconds plus 5 s (DEADLINE_EXCEEDED);
    3. open the write intent, or take over an expired one, under the account lock;
    4. upload create-only, recording each created object in the intent before the next upload (adopted objects are never recorded);
    5. the ledger commit inserts the header, row set and locators, and deletes the intent WHERE state='open' AND owner_token=$owner. A swept or taken-over intent rolls the commit back.
  • Reads check the physical digest and size before inflating, inflate with maxOutputLength, then verify segments, chunks and the binding. Uncompressed objects are range-read per page.
  • Provider failures collapse to PROVIDER_UNAVAILABLE/DEADLINE_EXCEEDED/ABORTED, never raw provider errors.
  • Errors move to row-storage-errors.ts. Configuration errors are STATE_UNAVAILABLE, separate from data errors (INVALID_INPUT), so migrateInlineRows quarantines only bad data. It also gains a bindingId override.

Tests

  • New reporting-row-storage-object-pg.test.js covers:
    • provider conformance;
    • gzip objects with hashed keys and an empty intent table after commit;
    • replay without re-upload;
    • a second store instance reading;
    • an unconfigured store refused;
    • a physical-digest mismatch → ROWS_INTEGRITY_FAILED;
    • a deleted object → ROWS_UNAVAILABLE/SERVICE_UNAVAILABLE;
    • a short lease → DEADLINE_EXCEEDED with nothing committed;
    • identical bytes adopted (not recorded as created) and different bytes → CONTENT_CONFLICT;
    • binding validation: unknown provider, bad template, path traversal, an extra location field, a moved prefix.
  • Results on PostgreSQL 16: all PG suites 183/183 inline and 183/183 chunked; unit and reporting suites 878/878. Typecheck is clean.
  • The package budget grows by +8 files (two module sets). The byte budget is the measured 20,205,763 plus 55 KB for the remaining Stage 1 modules.

🤖 Generated with Claude Code


Open workspace in Conductor

Add the object row-store port (create-only putIfAbsent, version-pinned
ranged get, exact-version delete, probe), host-allowlisted object
bindings with confined key templates and hashed account segments, the
fenced write-intent upload path bounded by the obligation lease, verified
object reads with physical-digest checks before decompression, a
filesystem provider and a provider conformance runner. Stage 1 PR 8 of
the shared persistence spec (adcontextprotocol/adcp#7996).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
context
)
);
if (put.created) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium: The object is created on the provider before it is recorded in the write intent — putIfAbsent returns created: true, then onCreated records it. If onCreated throws (intent taken over or swept, STATE_UNAVAILABLE), the object exists physically but is never in created_objects. The provider has no list, so the intent sweep can only delete keys it finds in created_objects — this one is unreclaimable. It self-heals only if a later writer for the same rowSetId+content re-prepares and adopts it; a permanently-abandoned row set leaks the chunk forever. Narrow window, but it contradicts the changeset's "records every object the upload created ... left for the intent sweep." Record the planned key in the intent before the create, or document this as a known bounded leak.

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — object-storage row bindings for reporting rows.

Checked:

  • No schema drift: base migration already carries every column + write-intents table.
  • Witness contract holds: every object read verifies physical digest + logical chunk/segment digests before release; no fabrication or re-shaping.
  • Fencing is sound: lease-fenced create-only uploads with per-chunk adoption; adoption never records into created_objects and commit deletes the intent atomically, so a sweep can never delete an object a committed revision references.
  • Keys confined to owned prefix with hashed account segment (never raw ID); filesystem traversal guard present.
  • All provider I/O deadline-bounded and maxBytes-capped.
  • Changeset present and correctly minor (additive).

Medium findings (1):

  • src/lib/reporting/ledger/row-storage.ts:380 — Object created before intent-record: bounded orphan leak on onCreated failure.

One medium finding, no blocking issues, no escalation triggers (high_risk false, gated_paths false, no team gate, no prior decision). Falls through to row 9 → approve.

Medium findings

  • src/lib/reporting/ledger/row-storage.ts:380 — Object created before intent-record: orphan leak on onCreated failure

@bokelley
bokelley merged commit 108403d into bokelley/reporting-inline-row-migration Oct 8, 2026
6 checks passed
@bokelley
bokelley deleted the bokelley/reporting-object-row-storage branch October 8, 2026 16:50
bokelley added a commit that referenced this pull request Oct 8, 2026
Add the object row-store port (create-only putIfAbsent, version-pinned
ranged get, exact-version delete, probe), host-allowlisted object
bindings with confined key templates and hashed account segments, the
fenced write-intent upload path bounded by the obligation lease, verified
object reads with physical-digest checks before decompression, a
filesystem provider and a provider conformance runner. Stage 1 PR 8 of
the shared persistence spec (adcontextprotocol/adcp#7996).

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bokelley added a commit that referenced this pull request Oct 8, 2026
* feat(reporting): resumable migration of inline revision rows

Add PostgresReportingLedgerStore.migrateInlineRows, which moves legacy
inline revision and adjustment rows into verified row storage in bounded,
cursor-resumable batches under the account lock, quarantining documents
whose rows no longer reproduce their binding. Stage 1 PR 7 of the shared
persistence spec (adcontextprotocol/adcp#7996).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(reporting): object-storage bindings for revision rows (#3160)

Add the object row-store port (create-only putIfAbsent, version-pinned
ranged get, exact-version delete, probe), host-allowlisted object
bindings with confined key templates and hashed account segments, the
fenced write-intent upload path bounded by the obligation lease, verified
object reads with physical-digest checks before decompression, a
filesystem provider and a provider conformance runner. Stage 1 PR 8 of
the shared persistence spec (adcontextprotocol/adcp#7996).

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(reporting): cover inline adjustment row migration

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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