Skip to content

feat(reporting): S3 provider for object row bindings - #3164

Merged
bokelley merged 4 commits into
mainfrom
bokelley/reporting-s3-row-provider
Oct 9, 2026
Merged

bokelley merged 4 commits into
mainfrom
bokelley/reporting-s3-row-provider

Conversation

@bokelley

@bokelley bokelley commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #3161 (GCS provider). Second of three cloud providers for the shared SDK persistence spec (adcontextprotocol/adcp#7996 §3.4).

What

New subpath @adcp/sdk/reporting/s3 exporting createS3ReportingRowObjectProviderV1({ client, clients }), with a new optional peer @aws-sdk/client-s3 (^3.700.0, the first range whose models carry IfNoneMatch on PutObject and IfMatch on DeleteObject; also a devDependency). Wiring mirrors reporting/gcs: exports, typesVersions, peerDependencies, peerDependenciesMeta. Lockfile changes are limited to the new dev dependency tree.

  • Clients / location: location: { bucket, region? } (closed; bucket validated, IP-style names refused). The endpoint, credentials, region and path style come only from host-injected S3Clients selected by credentialRef, never from the location. If region is set, the probe requires the client's configured region to match.
  • putIfAbsent: PutObject with IfNoneMatch: '*', no ContentEncoding, metadata passed through. A 412 triggers a HeadObject and returns created: false. A 409 ConditionalRequestConflict is retried once.
  • nativeVersion: the VersionId when present; otherwise the ETag, always kept quoted. Version IDs never contain ", so the two cannot be confused when read back.
  • get: pins with VersionId (or IfMatch for ETag versions) plus Range. The early ContentLength check and the streaming cap both enforce maxBytes. These read as null: NoSuchKey/NotFound/NoSuchVersion, 412, and a 400 for a malformed or foreign version ID (AWS answers 400 on unversioned buckets). InvalidRange/416 → ROWS_INTEGRITY_FAILED.
  • Echo check: reads return null and deletes report absent unless the response echoes the exact pinned VersionId / ETag. Some S3-compatible stores ignore versionId or If-Match, and this check stops them from serving or deleting a different version.
  • delete: S3 deletes succeed even for missing keys, so a HeadObject confirms the exact version first (404/412/400/405 → absent). It then calls DeleteObject with VersionId, or with IfMatch for ETag versions. Where conditional deletes return NotImplemented, it falls back to an unconditional delete after the HEAD compare.
  • probe:
    • HeadBucket: 404 / 403 / 301 → UNSAFE_BINDING.
    • Client region check.
    • Best-effort GetBucketPolicyStatus: IsPublic → UNSAFE_BINDING; errors are ignored because S3-compatible stores often lack this API.
    • GetBucketLifecycleConfiguration: an enabled Expiration (Days/Date) whose prefix filter overlaps the binding → UNSAFE_BINDING. Tag-filtered rules, ExpiredObjectDeleteMarker, noncurrent-version and abort-MPU rules are allowed. AccessDenied → UNSAFE_BINDING.
    • Empirical create-only check: writes {prefix}/.adcp-probe/<uuid> twice with If-None-Match and requires the second write to fail with 412. Every probe version is then deleted. A store that ignores the header fails UNSAFE_BINDING.
  • Deadlines: abortSignal is passed to every send, and the shared helper settles on abort (DEADLINE_EXCEEDED vs ABORTED). Raw SDK errors never escape.

Tests

  • test/lib/reporting-s3-row-provider.test.js uses an in-memory fake of S3Client.send(command, { abortSignal }) with the real command classes, in both versioned and unversioned modes. It covers:
    • conformance (runReportingRowObjectProviderConformanceV1), with probe objects cleaned up;
    • If-None-Match on writes, the 412 adopt path, and the 409 retry-once;
    • VersionId / If-Match pinning, ranged reads, the maxBytes cap with and without ContentLength;
    • exact and idempotent deletes, including the no-conditional-delete fallback;
    • probe refusals: missing or forbidden bucket, public policy, region mismatch, lifecycle variants, unreadable lifecycle, and a store that ignores If-None-Match;
    • a store that drops version selectors, which can never serve or delete another version;
    • the closed credentialRef map, endpoint/secret fields rejected in location, secret-free error messages, and deadline/abort.
  • Opt-in emulator test (not in CI): REPORTING_S3_TEST_ENDPOINT=http://127.0.0.1:54500 node --test test/lib/reporting-s3-row-provider.test.js. It runs conformance plus foreign-version get/delete checks through the real S3Client on versioned and unversioned buckets. Passed locally against moto 5.1.22 (python -m moto.server), which enforces If-None-Match and returns 412.
  • Ran by hand (not committed): a full engine round trip on local PostgreSQL through the real client against moto, on versioned and unversioned buckets with gzip and uncompressed (ranged) bindings.
  • Clean build:lib, typecheck, and check-package-size (+4 files) pass. ESM and CJS loads of @adcp/sdk/reporting/s3 work.

Risks

  • On unversioned buckets the native version is the ETag, which identifies content, not a write. A delete therefore cannot tell the recorded object from an identical re-upload at the same content-addressed key. The docs recommend versioned buckets.
  • The HEAD-then-delete fallback (stores without conditional deletes) has a small race window.
  • Block Public Access cannot be verified portably; the docs require private buckets.

🤖 Generated with Claude Code


Stack note: this branch now also contains #3166 (Azure Blob provider for object row bindings), which was squash-merged into it while the stack was being assembled. Review that PR's description for the Azure provider.

@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 — new S3 row-object provider, clean diff.

Adds @adcp/sdk/reporting/s3 provider (src/lib/reporting/s3/index.ts, 371 lines) mirroring the existing GCS provider. No blocking or medium findings.

Checked:

  • Witness model preserved — get returns null on absent version, no fabricated fields, bytes verified downstream vs PG digests.
  • Official @aws-sdk/client-s3 commands only; peer dep optional + newer dev dep, matching GCS pattern.
  • Changeset present, correctly scoped as minor/additive.
  • Delete path (L944-972) safe: versioned buckets pin VersionId; unversioned uses HEAD-confirm + If-Match; 501 fallback TOCTOU is benign due to content-addressed keys.
  • Ops readiness: abortSignal threaded through every client.send within the signal race; streaming cap enforced without ContentLength; probe fail-closes correctly.
  • Export map, package-size bump, tsup glob all consistent.

No escalation triggers: high_risk false, gated_paths false, no team gate, no prior decision. Falls through to row 9.

@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 — clean pass, no blocking or medium findings.

This delta adds a servedVersion fail-closed guard to the S3 row provider's two read paths and the delete path, defending against S3-compatible stores that silently ignore VersionId/If-Match selectors. The ETag comparison is consistent with versionOf/selectorOf, the full-get path destroys the body before returning null (no leak), and the delete-path check closes a real hole where a selector-ignoring store could delete the current object. A new test covers the selector-dropping case and confirms legitimate pinned reads still succeed.

Governance checks: a .changeset/reporting-s3-row-provider.md is present for the src/lib/** change (changeset-vs-wire-impact satisfied); package.json edit is dependency-related, no hand-edited version line observed. No witness/translator fabrication concerns. high_risk false, gated_paths false, review_decision: APPROVED, no author-team gate. Prior decision was also approve.

No findings → decision table rows 1–8 do not fire → row 9 applies.

@bokelley
bokelley force-pushed the bokelley/reporting-gcs-row-provider branch from 985ffd6 to 9599926 Compare October 8, 2026 16:45
@bokelley
bokelley force-pushed the bokelley/reporting-s3-row-provider branch from 0016fe1 to 31f9bed Compare October 8, 2026 16:47
Base automatically changed from bokelley/reporting-gcs-row-provider to bokelley/reporting-header-only-revisions October 8, 2026 16:50

@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 — new @adcp/sdk/reporting/s3 object-row provider mirroring the approved GCS provider.

No blocking findings. Reviewer verified:

  • Create-only writes with bounded single 409 retry; 412 adopts existing version (index.ts:759-768).
  • Version pinning via selectorOf/servedVersion (L681-694) — mismatched echoed version returns null, never wrong bytes.
  • Byte cap fires without ContentLength (L935-939 + stream cap).
  • Witness fidelity: no fabricated fields; errors map to stable secret-free codes (proven by secretFree assertions).
  • Every client.send carries abortSignal; DEADLINE/ABORTED tested.
  • Changeset minor accurate; export matches sibling dual-format shape; package-size cap bumped +4; tsup.config.ts:105 globs the subpath automatically.

Gate check: gated_paths: false, no high-risk files, no no-auto-approve team match. review_decision: APPROVED. Prior decision was also approve with no findings. No critical/high/medium findings — falls through to row 9.

@aao-secretariat

Copy link
Copy Markdown

Ladon cannot review this PR until merge conflicts are resolved.

@bokelley
bokelley force-pushed the bokelley/reporting-header-only-revisions branch from a87fb9e to 706b0d0 Compare October 8, 2026 17:13
@bokelley
bokelley force-pushed the bokelley/reporting-s3-row-provider branch from 5bbe487 to 65fd6a6 Compare October 8, 2026 17:15
aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Oct 8, 2026

@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 — clean pass, no blocking findings.

This delta adds the reporting/s3 and reporting/azure row-object providers, mirroring the already-approved GCS provider with the same credential-free, host-injected-client contract. Verified: create-only writes (If-None-Match: *, 412/409 adoption), version-pinned reads with servedVersion re-verification, byte-cap enforcement via readReportingRowStream even when ContentLength is absent, exact-version deletes, and account-binding enforcement. Operational readiness holds — every SDK call carries abortSignal, ops run under runReportingRowProviderOperation with DEADLINE_EXCEEDED/ABORTED propagation, and errors map to secret-free PROVIDER_UNAVAILABLE (tests assert no SAS/credential leakage). Two minor changesets for the additive subpaths + optional peers; exports/typesVersions match the gcs shape.

Decision table: no critical/high/medium findings (row 1 N/A); gated_paths false (row 2 N/A); high_risk false (rows 3,5 N/A); no medium data-loss/schema/infra (row 4 N/A); prior decision was approve (row 6 N/A); no no-auto-approve team match (row 7 N/A); zero medium findings (row 8 N/A). Falls through to row 9 → approve. review_decision is APPROVED.

@bokelley
bokelley force-pushed the bokelley/reporting-header-only-revisions branch from 706b0d0 to ea06329 Compare October 9, 2026 00:35
Base automatically changed from bokelley/reporting-header-only-revisions to main October 9, 2026 00:51
@bokelley
bokelley dismissed aao-secretariat[bot]’s stale review October 9, 2026 00:51

The base branch was changed.

@bokelley
bokelley force-pushed the bokelley/reporting-s3-row-provider branch from 65fd6a6 to 34ad56f Compare October 9, 2026 00:53
@bokelley
bokelley enabled auto-merge (squash) October 9, 2026 00:54
aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Oct 9, 2026

@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 — new S3/Azure reporting row-object providers, clean pass.

This PR adds @adcp/sdk/reporting/s3 and @adcp/sdk/reporting/azure providers mirroring the already-audited GCS provider via shared row-storage-provider-io helpers. The reviewer verified: version/ETag discrimination is sound (quoted ETags never collide with VersionIds), create-only writes enforced via If-None-Match: * plus empirical probe, exact-version pinning on reads/deletes with servedVersion guarding, unconditional-delete fallback safe under content-addressed keys, Azure versioned delete removes base blob only when it is the target version. Both changesets are correctly minor/additive, export shape matches the dual-format pattern, package-size accounting updated, peer deps optional, no hand-edited version. Tests cover conformance, abort/deadline, secret redaction, and foreign-version negatives.

Decision rules walked top-down: no critical/high findings (row 1 no); gated_paths is false (row 2 no); high_risk is false, no deletions (rows 3/5 no); no medium findings at all (rows 4/8 no); prior decision was approve so sticky-escalate (row 6) does not apply; no no-auto-approve team match (row 7 no). Falls through to row 9 → approve. Note: review_decision is REVIEW_REQUIRED, but with gated_paths: false that does not gate approval.

bokelley and others added 3 commits October 9, 2026 04:34
Add the @adcp/sdk/reporting/s3 subpath with
createS3ReportingRowObjectProviderV1({ client, clients }), backed by the
new optional peer @aws-sdk/client-s3.

- location { bucket, region? }; endpoint, credentials and region come only
  from host-injected clients selected by credentialRef.
- putIfAbsent: PutObject with If-None-Match: *; 412 -> HeadObject adopts
  the existing version; 409 ConditionalRequestConflict retried once.
- nativeVersion: VersionId when present, else the quoted ETag.
- get: VersionId or If-Match, ranged, byte-capped stream; missing,
  mismatched or foreign versions read as null.
- delete: HeadObject confirms the exact version, then DeleteObject by
  VersionId or If-Match (HEAD-compare fallback where conditional deletes
  are not implemented); absent is success.
- probe: HeadBucket, client region, public policy status, lifecycle
  expiration over the prefix, and an empirical create-only check that
  writes a probe key twice and requires the second write to fail with 412.

An opt-in emulator test (REPORTING_S3_TEST_ENDPOINT) runs the conformance
suite through the official client; verified locally against moto.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Some S3-compatible stores ignore versionId or If-Match. Reads now return
null and deletes report absent unless the response echoes the exact
pinned VersionId or ETag, so such a store can never serve or delete a
different version.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Add the @adcp/sdk/reporting/azure subpath with
createAzureBlobReportingRowObjectProviderV1({ client, clients }), backed by
the new optional peer @azure/storage-blob (type-only import; the host
injects BlobServiceClient instances).

- location { account, container }; the selected client must belong to the
  bound account; endpoint and credentials come only from the client.
- putIfAbsent: block-blob upload with If-None-Match: *; 409
  BlobAlreadyExists / 412 -> getProperties adopts the existing blob.
- nativeVersion: versionId when blob versioning is enabled, else the quoted
  ETag; reads (ranged, byte-capped) and deletes pin it and only count a
  response that echoes that exact version.
- delete: ETag-conditional, or for versions: confirm the version, delete the
  base blob if it is still that version, then delete the version.
- probe: container exists, no anonymous access, and an empirical
  create-only check with a probe blob under the prefix.
- Metadata names are stored as C# identifiers (adcp-intent -> adcp_intent).

An opt-in emulator test (REPORTING_AZURE_TEST_CONNECTION_STRING) runs the
conformance suite through the official client; verified locally against
Azurite.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Oct 9, 2026

@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 — clean pass, no blocking or medium findings.

This PR adds @adcp/sdk/reporting/s3 and @adcp/sdk/reporting/azure object-store row providers mirroring the reviewed GCS pattern. Checks verified:

  • Witness-not-translator respected: storage I/O only, no wire fabrication or re-shaping.
  • Official clients only; no HTTP/SSE reimplementation.
  • Two minor changesets present; no hand-edited package.json version line; exports + typesVersions + check-package-size counts match the two dual-format sets.
  • S3 VERSION_ID regex correctly excludes " (no ETag collision); putCreateOnly 409 single-retry; delete HEAD-confirms exact version (fail-closed).
  • Azure servedVersion never serves/deletes a non-echoed version; versioned delete respects the root-blob ordering rule.
  • All client calls thread abortSignal; build glob picks up new files.

Decision table: no critical/high findings (row 1 n/a); gated_paths false (row 2 n/a); high_risk false (rows 3/5 n/a); no medium findings (rows 4/8 n/a); no no-auto-approve team match (row 7 n/a); prior decision was approve (row 6 n/a). Falls through to row 9 → approve. Note review_decision is REVIEW_REQUIRED, but with gated_paths=false that does not block auto-approve.

…s; regenerate release worksheet

AbortSignal.timeout uses an unreferenced timer, so the S3 and Azure
hanging-fake deadline tests could be cancelled by the test runner when the
event loop drained (as already handled in the GCS test). Add a keep-alive
interval. Also regenerate docs/migration-14.x-rc-worksheet.md for the new
optional S3 and Azure peers.

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

@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.

Delta touches docs + tests only (no src/lib, no bin, no build-affecting scripts, no package.json files path), so no new changeset obligation is triggered. The worksheet change correctly documents the two optional provider peers (@aws-sdk/client-s3, @azure/storage-blob) matching the S3/Azure row providers. The test fix adds a referenced setInterval keepAlive (torn down via t.after) so the unref'd AbortSignal.timeout(20) deadline can fire against a hanging fake with no active I/O — correct shape, no leak, accurate comment.

No critical/high/medium findings. Prior decision was a clean approve. No author team gate, gated_paths is false, high_risk is false. Falls through to row 9.

@bokelley
bokelley merged commit ab44ea7 into main Oct 9, 2026
42 checks passed
@bokelley
bokelley deleted the bokelley/reporting-s3-row-provider branch October 9, 2026 06:24
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