Skip to content

feat(api): tenant-admin dataset configuration — validate, dataset-scoped publish (#1010) - #1266

Merged
athvin merged 1 commit into
mainfrom
feat/1010-dataset-config-api
Nov 26, 2026
Merged

athvin merged 1 commit into
mainfrom
feat/1010-dataset-config-api

Conversation

@athvin

@athvin athvin commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Closes #1010
Closes #1204

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

What

A tenant admin key can now run the whole dataset-configuration workflow through the public contract: create a dataset, validate a candidate config (POST …/datasets/{ds}/config/validate, a dry run of every publish check), store a draft and publish it — and the publish lands on that dataset. Source mappings are checked before any run is queued. Docs describe the allowed customer configuration surface, model boundaries, tiers and rollback.

Why

#1010's gap audit found the workflow broken for any dataset but default: publish read the org row, so it overwrote the default dataset's config file, classified its tier against the default's document and repointed the org; GET …/config served the default's config for every dataset; and a second dataset's first publish 500'd on schedules_one_correction_per_org. Dataset create was documented as operator-only, so it was absent from the public contract.

Proof

  • pg_dataset_config (new): admin creates/validates/publishes a second dataset; asserts the default's file, /config and the org mirror are untouched, tier A classification against the dataset's own config, 403/404/409 edges, and that validation stores nothing.
  • cargo test -p er-server against Postgres (ER_TEST_PG_DSN): all pass (280 lib + 151 integration).
  • make check: see below. Frontend: tsc, eslint, developer-reference unit test green; docs overview baselines regenerated in the pinned Linux image.

Risk & rollback

Fixup 0006 drops the org-wide correction-schedule unique index (only loosens). git revert <merge-sha> is the rollback; the dropped index would not be recreated by the revert, which is harmless (the new per-dataset index stands in its place until then).

Post-merge ledger

Closed by: agent · session Claude Code:24d16c2e-fec6-49d8-9797-060338df4848 on brians-MacBook-Pro · 2026-11-26T19:33:25Z

  • main is green with this change on it — the merge SHA, and the run
    that proves it. A later head SHA with this commit as an ancestor counts;
    a cancelled run with zero jobs does not: de8687b9 — rust 45883261965 success, frontend 45883262045 success, infra/devcontainer/marketing preview success
  • images built, or correctly never ran because nothing that goes into
    an image changed: 45883262090 success
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion: deploy 45883709472 (dev + prod success); the live process at https://dupezero.com/api/openapi serves the new public contract containing POST …/config/validate (probed 2026-11-26T19:32Z)
  • 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; drift red before this merge on the unconfirmed SNS subscriber (Confirm the er-alerts email subscription and prove alert delivery #1056), kind probe red before it (known, kind probe red since 2026-11-10: KeyError 'token_hash' after the credential-omission fix #1106)
  • the board card reached Done through the automation rather than by
    hand, and the issue closed: API: self-service dataset configuration and source mapping #1010 and docs overview visual baseline breaks whenever /docs changes length #1204 CLOSED/COMPLETED, both cards Done
  • follow-ups are open for everything deferred here — numbers: n/a — nothing deferred; delivery/replay continues in API: durable JSON and file delivery with receipts and replay semantics #1011 as planned
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned: the dataset-scoping rules are in the code comments and the docs page; memory updated with the session's gate traps

Specific to this change

  • fixup 0006_per_dataset_correction_schedule recorded in dev's public.fixups after deploy — blocked — the AWS SSO session on this machine expired (needs an interactive aws sso login); the deploy's schema-migrate hook succeeded, which runs every fixup before the new pods start
Context — plan, discoveries, measurements, files

Discoveries

  • publish_config_version used pg::org_publish_context (org row) for config_path, state and active version → cross-dataset overwrite. Now uses the dataset row; the org's deprecated active_config_version mirror moves only for the default dataset.
  • active_config read the same org pointer.
  • schedules_one_correction_per_org unique on org_id while ensure_config_owned keyed by dataset → second dataset's publish = unique violation. Index is now per dataset; fixup 0006 drops the old one.
  • pg_err printed only db error; it now walks the source chain (errfmt::chain), per the repo's error rule.
  • No check existed on sources.*.columns keys: a misspelled attribute (emial) was silently ignored. New source_mapping_problems: canonical attributes only, no empty/duplicate columns, non-empty record id/timestamp columns, distinct priority_ranks.
  • Publish now refuses a config whose entity_type disagrees with the dataset's, and refuses a dataset still provisioning (409).
  • docs overview visual baseline breaks whenever /docs changes length #1204: the docs overview baseline shifted with page length because the sticky header was stitched in; the screenshot now hides sticky chrome.

Files

er-server/src/{lib,config_check,fixups,pg,openapi}.rs, entities/schedule/entity.yaml (+ generated), tests/pg_dataset_config.rs, regenerated OpenAPI/TS/MCP/operations, frontend/src/app/(marketing)/docs/page.tsx.

🤖 Generated with Claude Code

…ped publish (#1010)

A tenant admin key can create a dataset, dry-run a candidate config with
POST …/config/validate, and publish it to THAT dataset. Publish and
GET …/config read the org row, so a publish to any non-default dataset
overwrote the default dataset's config file and repointed the org; a second
dataset's first publish also hit the per-org correction-schedule unique,
now per dataset (fixup 0006 drops the old index). Source mappings are
checked before a run is queued, publish refuses an entity_type mismatch
and a provisioning dataset, and pg_err walks its source chain.

Also fixes the docs overview baseline shifting with page length (#1204).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

The marketing preview was removed because this PR is closed or merged.

This branch was previously deployed

1 inactive deployment
marketing-preview — c6c99638 Deployed Nov 26, 2026 by athvin via remove closed PR previews #65
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.

docs overview visual baseline breaks whenever /docs changes length API: self-service dataset configuration and source mapping

2 participants