Skip to content

feat(lake): the object-store credential path — open an s3:// lake (#792) - #924

Merged
athvin merged 6 commits into
mainfrom
issue/792-s3-lake
Nov 8, 2026
Merged

athvin merged 6 commits into
mainfrom
issue/792-s3-lake

Conversation

@athvin

@athvin athvin commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Closes #792

🚧 Claimed by an agent session — 2026-11-08T21:55:19Z, session 01a1b892-4cde-7a53-bb3e-9ed2e764acdc on Mac.
The claim is this open draft PR: closing it releases the ticket.

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

Build the object-store credential path so an s3:// lake opens from Rust, per the issue's acceptance criteria (which are attach-and-tenancy.md's own "In flight" list):

  1. ObjectStoreConfig in dedupe-core — every field optional; emits a CREATE OR REPLACE SECRET before the ATTACH when data_path is s3://. Absence of an explicit key selects PROVIDER CREDENTIAL_CHAIN (the pod's own identity in-cluster — the er-dev-runner-pod Pod Identity role already carries the lake-bucket grants); an explicit key stays for MinIO/CI, which have no chain to consult. No mode flag — the credential's shape is the mode.
  2. Process-level env, ER_LAKE_S3_* convention — ER_LAKE_S3_ENDPOINT / REGION / URL_STYLE / USE_SSL / KEY_ID / SECRET, read via er-env at the two lake-open seams (schema::open_lake_env write, read::open_org_lake read). Deliberately NOT the banned ER_S3_ACCESS_KEY_ID names: those stay banned (a credential-shaped name nothing should consume in deployed envs), so tf-static-credentials-check.sh rule 2 needs no narrowing — recorded in Context.
  3. The credential filter — pg::merge_org_env (the single chokepoint for org-env merges) refuses credential-shaped keys (*_SECRET, *_ACCESS_KEY_ID, *_KEY_ID, *_TOKEN, *_PASSWORD) with a 422 naming the key and the reason; org-row creation paths get the same predicate. An org row is projected into job params and travels further than process env — nothing credential-shaped persists there, ever.
  4. aws joins BAKED_EXTENSIONS (pulls httpfs with it), so LOAD aws works offline in-cluster exactly like ducklake today; the Dockerfile's install step is the gate that proves it bakes.
  5. The proving test — env-gated on ER_TEST_S3_ENDPOINT (+ ER_TEST_S3_KEY_ID/ER_TEST_S3_SECRET, self-skip without them, the ER_TEST_PG_DSN idiom): attach a lake whose DATA_PATH is s3://… against MinIO, write a table, read it back. MinIO joins the DuckLake e2e legs in rust.yml as a service + bucket-create step, so CI proves it too; locally a one-command docker run (documented in the test's header).
  6. The three skill references move with the change — ducklake-lakehouse/SKILL.md's "not wired up" section, attach-and-tenancy.md's "Object storage" + "In flight" sections, and the third the issue names (found in Context below) — all updated in the same PR, not before.

Why

The engine's only lake today is a filesystem path (EFS in-cluster). The identity half is already deployed (Pod Identity role + bucket grants, deliberately ahead of its first consumer); what is missing is the engine half: no aws/httpfs load, no CREATE SECRET, no credential hygiene on org rows. attach-and-tenancy.md records the omission as a Python-regression, not a design decision — so this is a feature, built to the shape that reference prescribes.

Proof

  • make check green (fmt + lint + doc + entities-check + skills-check + workflow-shell + test) at efd4f55b+.
  • make check-e2e green — 18 suites ok, with ER_TEST_PG_DSN and the rustfs-backed ER_TEST_S3_*/ER_LAKE_S3_* all set, so the pg tiers AND the s3 proving tests ran for real.
  • The proving tests (er-cli tests/s3_lake.rs, run against a local rustfs): an s3:// lake attaches, writes two rows, and reads them back from a fresh session (data provably crossed the object store — confirmed the Parquet objects in the bucket with aws s3 ls --recursive), through BOTH the explicit-key shape and the empty-config process-env fallback.
  • The credential filter (er-server tests/pg_env_filter.rs, real Postgres): org create and dataset create each 422 on ER_LAKE_S3_SECRET/AWS_SECRET_ACCESS_KEY/AWS_ACCESS_KEY_ID/ER_LAKE_S3_KEY_ID, name the key, and create nothing; the pure predicate unit-tests the live ER_LAKE_*/ER_DUCKDB_* keys keep working.
  • 8 ObjectStoreConfig unit tests: chain-vs-static SQL emission, quote escaping, half-key refusal, env parsing incl. USE_SSL.

Risk & rollback

Additive: new config struct, new env vars (all optional), a filter that only refuses. Existing filesystem lakes are untouched (the secret path fires only on an s3:// data path). git revert is the rollback.

Post-merge ledger

Closed by: agent · session 01a1b892-4cde-7a53-bb3e-9ed2e764acdc on Mac · 2026-11-08T23:55:00Z

  • main is green with this change on it — merge SHA
    7ca3dbb4ad00909e26b04e01443dac98ebd1a2f0; the rust run ON that SHA
    completed success (full suite incl. the DuckLake e2e legs, where the
    rustfs-backed s3 proving tests ran), as did frontend, infra,
    devcontainer.
  • images built — success on 7ca3dbb4; the build ran
    er-server install-extensions, so the new aws+httpfs entries in
    BAKED_EXTENSIONS are proven to fetch and bake (a 404 would fail the
    build).
  • deploy converged — run 42536448566 (both namespaces): helm
    STATUS: deployed on er-platform and
    deployment "web-api-green" successfully rolled out, which is kubectl's
    live read of the cluster, not the workflow conclusion.
  • the push-only surface no pull request can pre-test (deploy, drift,
    kind's nightly leg) is green, or knowingly red for a reason that is not
    this change: deploy green (above); drift and kind's nightly leg are
    scheduled runs — none fired and none failed since the merge.
  • the board card reached Done through the automation rather than by
    hand, and the issue closed: The engine cannot open an s3:// lake — build the object-store credential path #792 is CLOSED/COMPLETED and the card
    reads Done.
  • follow-ups are open for everything deferred here — numbers: Point a lake at s3:// and retire the lake service user #932
    (point a lake at s3, retire the lake service user; includes the web-api
    pod-identity bucket-READ item the tier review surfaced), on the board.
  • what was learned is written down where the next session will find it:
    the three skill references moved with the change (ducklake-lakehouse
    SKILL.md, attach-and-tenancy.md, iam-and-exceptions.md) plus the eval;
    the MinIO-archived supply-chain fact is recorded in the rust.yml
    service comment and the PR body's Discoveries.

Specific to this change

Context — plan, discoveries, measurements, files

Plan

  • 1. ObjectStoreConfig (all-optional) in dedupe-core::session::ducklake + secret_sql() + pure from_env_with resolver + 8 unit tests
  • 2. aws + httpfs into BAKED_EXTENSIONS; the s3:// arm in attach_ducklake (LOAD aws → CREATE OR REPLACE SECRET → ATTACH)
  • 3. Env resolution inside the attach arm (see Discoveries — one mechanism, all seams)
  • 4. The credential filter in er_server::pg (merge_org_env / upsert_org_byo / create_dataset_byo → 422 via env_write_err) + predicate unit tests + the pg HTTP test
  • 5. The proving test + rustfs in the lake-e2e CI legs
  • 6. The three skill references (+ the eval and the IAM retirement note)
  • 7. Gates: make check + make check-e2e green
  • 8. pr-review, land, post-merge watch, ledger

Discoveries

Measurements

  • cargo test -p er-cli --test main s3_lake (rustfs local): 2 passed in ~6.5s, incl. extension INSTALL.
  • aws s3 ls --recursive s3://er-lake-e2e/ after the run: Parquet objects present under both test prefixes — the fresh-session read is genuinely off the object store.
  • make check: green. make check-e2e (ER_TEST_PG_DSN + ER_TEST_S3_* + ER_LAKE_S3_* set): 18 suites ok, 0 failures.

Files

Context — plan, discoveries, measurements, files

Plan (implementation order)

  1. dedupe-core::session::ducklake: ObjectStoreConfig (all-optional fields) + its CREATE OR REPLACE SECRET SQL (quoting unit-tested; chain-vs-explicit unit-tested). attach_ducklake: when data_path starts with s3://, LOAD aws then create the secret, before the ATTACH.
  2. BAKED_EXTENSIONS += aws (and confirm httpfs rides along at image-bake time).
  3. er-env-read ER_LAKE_S3_* at both lake-open seams; the resolved config rides into DuckLakeConfig.object_store.
  4. pg::merge_org_env credential filter + the same predicate on the org-create path; 422 naming the key. pg test for the refusal.
  5. The s3 open test (er-cli lake e2e tier, env-gated) + MinIO service in the e2e legs of rust.yml + bucket create.
  6. The three skill references updated in lockstep; make check, make check-e2e, make frontend green.

Discoveries (pre-implementation recon)

  • The attach sequence lives in dedupe-core::session::Session::attach_ducklake: LOAD ducklake → ATTACH 'ducklake:{metadata}' (DATA_PATH, METADATA_SCHEMA, READ_ONLY, AUTOMATIC_MIGRATION false). The secret hooks in before the ATTACH, after LOAD aws.
  • BAKED_EXTENSIONS = ["ducklake", "parquet", "json", "icu", "postgres_scanner"] (session/mod.rs:77); the Dockerfile's er-server install-extensions bakes them and FAILS THE BUILD on a 404 — adding aws is therefore self-verifying at image time.
  • No MinIO anywhere in the tree (the compose references in infrastructure.md are Python-era); the CI e2e legs already carry a postgres:16-alpine service — a minio/minio service is the same idiom, and GitHub runners carry the AWS CLI for the bucket create.
  • pg::merge_org_env (pg.rs:574) is the single merge chokepoint (update_resources funnels through it). Org creation (upsert_org_byo/provision) gets the same predicate.
  • tf-static-credentials-check.sh rule 2 bans the exact names ER_S3_ACCESS_KEY_ID/ER_S3_SECRET_ACCESS_KEY under infra/+scripts/. Choosing the ER_LAKE_S3_* convention (the issue's own caution against blindly reaching for ER_S3_*) keeps the rule intact — and the rule's own rationale ("a credential nothing consumes") stays true for the banned names.
  • DesignDoc.md §S6's Python-era ER_S3_* block is treated as intent, not interface, per the issue.

…Rust (#792)

- ObjectStoreConfig (all-optional): emits a session-scoped CREATE OR
  REPLACE SECRET ahead of the ATTACH when DATA_PATH is s3://. No explicit
  key selects PROVIDER CREDENTIAL_CHAIN (pod identity in-cluster); an
  explicit pair is for MinIO-class stores/CI. Half a key is an error, not
  a silent chain fallback. No mode flag.
- ER_LAKE_S3_{ENDPOINT,REGION,URL_STYLE,USE_SSL,KEY_ID,SECRET} resolve
  from the process env inside attach_ducklake when the config is empty —
  one mechanism for every lake-open seam. Host-level only: the new
  credential filter in er_server::pg refuses credential-shaped keys on
  every org/dataset env write (422 naming the key).
- aws + httpfs join BAKED_EXTENSIONS so LOAD aws works offline in-cluster.
- Proving test (er-cli tests/s3_lake.rs): write+read round trip against a
  real S3 store through both the explicit key and the env fallback;
  rustfs service in the lake-e2e CI legs (MinIO is archived upstream).
- The three skill references that said 'no credential path' move with the
  change, plus the eval and the lake-service-user retirement note.
…teral (#792)

The declared-names posterity gate scans the workspace for qualified
lake.main.* literals and requires each to be a declared relation; the
ad-hoc round-trip table is not one. register_lake_table is the production
read idiom anyway, so the test is better for using it.
pg_orgs.rs may declare only one #[tokio::test] — fresh_db keys the
database on one slug per FILE, so two tests in one file race on it
(pg_serial gates this). pg_env_filter.rs is its own slug; the pg_e*
prefix keeps it in the a-l CI slice by construction.
@athvin
athvin marked this pull request as ready for review November 8, 2026 22:55
merge_dataset_envs is the remaining env-write chokepoint: its three
callers today only ever forward a patch that already passed the org-side
filter, but a future caller passing user keys would bypass it — the same
class the org-side guard exists for. Flagged in review.
@athvin

athvin commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

PR review — 0 findings

House-invariant diff review (pr-review pipeline: one fresh-context reviewer per routed dimension, findings would have gone to a separate verifier; none were produced to verify).

  • instrumentation — the four new failure modes all propagate into existing reporting seams (dispatcher task error, read-API 503, er-cli stage failure); the secret SQL never reaches a span (generator_span records a bounded label, not text — the PII boundary holds); the 422 rides the request span like every sibling 4xx.
  • tier — nothing crosses a tier boundary; the s3 arm prices at ~ms per attach in all three tiers, and the migrate --expect-additive refuses a NOT NULL column that carries a default — #805's tags.kind can never deploy #904 failure class (network on a request) cannot recur in deployment: INSTALL aws fires only when ER_DUCKDB_EXTENSION_DIR is unset (dev/tests), the baked image autoloads offline.
  • reuse — everything composes existing helpers (env_write_err = detail_err+pg_err; register_lake_table for reads; common::fresh_db for the pg test); the new predicate has no pre-existing counterpart to reuse.
  • One cross-flag acted on during the review window: merge_dataset_envs now runs the credential filter too (ebe681b5), so no env-write chokepoint can be bypassed by a future caller.
  • Prose (.claude/) checked in-thread: the three references and the eval now describe the landed shape and match the code.

Ready to merge? Yes — pending CI green on ebe681b5 (in progress).
Declined to judge: url_style validation (fails loudly at CREATE SECRET); the image bake shipping the binaries (fails loudly at LOAD aws; Dockerfile's install-extensions proves it at build); unpinned rustfs/rustfs:latest service image (CI-store supply chain, judged acceptable alongside postgres:16-alpine precedent).

@athvin
athvin merged commit 7ca3dbb into main Nov 8, 2026
43 checks passed
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.

The engine cannot open an s3:// lake — build the object-store credential path

2 participants