Repository navigation
feat(frontend): the dataset seam in the BFF — slug guard, access scoping, erweb columns (datasets PR2) - #381
Merged
Merged
Conversation
…ing, erweb columns (datasets PR2) Prep for the dataset-scoped routes, inert until they land: nothing calls requireDatasetAccess yet and every new erweb column defaults to 'default', the name the backend sweep will give each existing org's one dataset. - proxy.ts: DATASET_SLUG + requireDatasetSlug (the org traversal guard's twin — the segment is raw-interpolated with the privileged credential attached), requireDatasetAccess (org membership + the slug check; a dataset adds scoping, not a second permission system), and datasetPath as the one audited place a dataset-scoped upstream path is built. - errors.ts: dataset_not_active joins the 409 family; conflictCode() tells the three conflicts apart by detail text. - check-bff-authz.mjs: the orgs rule accepts either guard, so a handler under datasets/[ds] satisfies the same invariant through requireDatasetAccess. - erweb migration 0007: saved_views/segments/review_recommendations gain a NOT NULL dataset (default 'default'; review_recommendations' PK becomes (org, dataset, review_id) because review ids are lake-local), usage_events a nullable one (attribution only — billing stays org-level). drizzle-kit emitted the ADD CONSTRAINT before the ADD COLUMN it references; the statements are reordered by hand, and the PGlite unit tier applies the file so the order is now exercised on every run. - adjudicate store threads the dataset through its upsert target and batch read, with a test proving a crm review never wears a default-dataset verdict. Co-Authored-By: Claude Fable 5 <[email protected]>
…dataset columns 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 2 of the datasets program — frontend prep, inert: nothing calls the new guard yet, and every new erweb column defaults to
'default', the name the backend sweep (PR3) gives each existing org's one dataset.What
DATASET_SLUG/requireDatasetSlug(the org traversal guard's twin — the dataset segment will be raw-interpolated into/v1/orgs/{org}/datasets/{ds}/…with the BFF's privileged credential attached),requireDatasetAccess(org membership + slug check; a dataset adds scoping, not a second permission system),datasetPath(the one audited place the dataset-scoped upstream path is built).dataset_not_activejoins the 409 family;conflictCode()splits writer-lock / dataset / org conflicts by detail text.["requireOrgAccess", "requireDatasetAccess"]— landing this before any moved route is what keeps the gate from hard-failing mid-switchover.saved_views/segments/review_recommendationsgain NOT NULLdataset(default'default');review_recommendationsPK →(org, dataset, review_id)because review ids are lake-local;usage_eventsgains a nullabledataset(attribution only). drizzle-kit emitted the new PK constraint before the column it references — reordered by hand; the PGlite unit tier applies the file, so the order is exercised on everypnpm check."default"until the route move), with a test that acrmreview never wears adefault-dataset verdict.Tests
New
bff-dataset-access.test.ts(slug grammar incl. traversal shapes, denial-status matrix unchanged,datasetPath);bff-authz-gate.test.tsgains the dataset-route case;adjudicate-store.test.tsgains the cross-dataset isolation case.pnpm checkgreen locally (lint, format, types, authz gate, unit+coverage).🤖 Generated with Claude Code