Repository navigation
feat(datasets): the dataset entity, the fixup ledger, the convergence sweep, and dataset CRUD (PR3) - #383
Merged
Conversation
… sweep, and dataset CRUD (PR3)
A dataset is one of a tenant's resolution domains: its own lake location,
config pointer, entity type and lifecycle state. This lands the control-plane
half — nothing reads a dataset's lake yet.
- entities/dataset: natural key (org_id, name), history, the org's lake/config/
ingest columns mirrored per dataset; entities/fixup: the ledger for named
one-shot fixups.
- V17 (warning): a dataset_id column must reference datasets(id), keep org_id
beside it, and carry a usable index — the dataset analogue of V15, landed
before its first subject so every table arrives well-formed.
- er-server/src/fixups.rs: the two-phase ledgered fixup pass (BeforeReconcile
for constraint surgery the reconciler refuses; AfterReconcile for backfills)
wired into ensure_schema — the mechanism the reconciler deliberately isn't.
Plus ensure_default_datasets, which is NOT a fixup: "each org has a default
dataset" is a convergence invariant, so it runs every boot and an org created
between deploys is converged by the next one. Env/config/ingest fields ride
verbatim — nothing moves on disk or in any catalog.
- Routes: GET/POST /v1/orgs/{org}/datasets, GET/PATCH /{ds}, /suspend,
/resume. Create is BYO + operator-only until dataset_provision exists (the
honest 503, as org auto-provisioning was); reserved names 'datasets' and
'settings' are refused; the config_path/env.ER_CONFIG_PATH one-source rule
is enforced as on orgs; detail never echoes env or config_path.
- Contract: Dataset joins the OpenAPI components (13 -> 14), openapi.json /
schema.d.ts / envelopes.json regenerated.
- pg_datasets (CRUD, validation edges, role boundary, lifecycle 409s) and
pg_dataset_sweep (convergence, verbatim copy, no-overwrite, entity_type
from the published config) both green against Postgres 16.
Co-Authored-By: Claude Fable 5 <[email protected]>
…he dataset entity mirrors the org's columns, so best-match attribution ties and flips (the header's own attribution limit) Co-Authored-By: Claude Fable 5 <[email protected]>
This was referenced Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 3 of the datasets program (after #380 attach seam, #381 frontend prep). This lands the control-plane half of a dataset — one of a tenant's resolution domains, with its own lake location, config pointer, entity type and lifecycle. Nothing reads a dataset's lake yet; the dispatcher still runs on the org env until PR5.
What
entities/dataset: natural key(org_id, name), history, the org's lake/config/ingest columns mirrored per dataset.entities/fixup: the ledger for named one-shot fixups.dataset_idcolumn must referencedatasets(id), keeporg_idbeside it, and carry a usable index — V15's dataset analogue, landed before its first subject so every table that gains the column arrives well-formed. Fixture-pinned both ways.er-server/src/fixups.rs: the two-phase ledgered fixup pass wired intoensure_schema—BeforeReconcilefor constraint surgery the reconciler refuses (the PR8SET NOT NULLs),AfterReconcilefor backfills (the PR4dataset_idstamp). This is the mechanism the declarative reconciler deliberately isn't (it never drops, never re-keys, never backfills).ensure_default_datasets— deliberately NOT a fixup: "each org has adefaultdataset" is a convergence invariant, not an event, so it runs on every boot and an org created between deploys is converged by the next one. The org's env/config/ingest fields ride verbatim — nothing moves on disk or in any catalog, andconfig.tenant(hash-bearing) is untouched.GET/POST /v1/orgs/{org}/datasets,GET/PATCH …/{ds},…/suspend,…/resume. Create is BYO + operator-only untildataset_provisionexists (the honest 503, exactly as org auto-provisioning once was); reserved namesdatasets/settingsare refused (frontend static segments); theconfig_path/env.ER_CONFIG_PATHone-source-of-truth rule is enforced as on orgs; detail/list never echoenvorconfig_path.Datasetjoins the OpenAPI components (13 → 14);openapi.json,schema.d.ts,envelopes.jsonregenerated. The mock serves nothing new (mock ⊆ router holds).Tests
pg_datasets— CRUD, every validation edge (reserved names, entity types, slug, env mismatch, 409-on-collision-leaves-row-untouched, suspended-org 409), the role boundary (viewer reads / operator creates / admin runs the lifecycle), and the suspend/resume 409 edges.pg_dataset_sweep— an org created after boot is converged by the next; env rides verbatim; re-running neither duplicates nor overwrites;entity_typefollows the active published config (self-checking account fixture).make checkgreen; the whole pg suite green locally against Postgres 16 (46/46 before these two — the every-boot sweep breaks no existing test).🤖 Generated with Claude Code