Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
…neric-upsert-route-that-accepts-all-root
…ma lookup and refuse an unsafe space id
…neric-upsert-route-that-accepts-all-root
…neric-upsert-route-that-accepts-all-root
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ca8eedb4b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…neric-upsert-route-that-accepts-all-root
…neric-upsert-route-that-accepts-all-root
…neric-upsert-route-that-accepts-all-root
Reviewer brief
FEE-890 adds one route that takes the five root CrossApp types for a space and writes them with one
upsert_conceptscall. It ships as two PRs, stacked on #1619 (ENG-2005, the validators):packages/databaseonly: the request type and its validator, and the pure steps the route runs.apps/website, its unit tests and the bearer-token client.Why two and not one: together they are 527 changed lines excluding tests (386 in #1621, 141 here). The split follows the package boundary: shared code first, then the route that uses it.
POST /api/internal/space/{id}/graphchecks the caller, checks the body, converts it and makes oneupsert_conceptscall. It answers{ upserted: { localId: dbId }, failed: [{ localId, kind, reason }] }. Nothing calls the route yet. It supersedes the July draft ENG-2039 Create a generic upsert route #1237.createBearerTokenClientbuilds a client per request with that token, so RLS applies as the caller. No cookies, no service key./graphfollows Michael on #1237 ("or just /graph") and Marc-Antoine on FEE-890 (2026-10-23):space/[id]in the path, noupsertsegment.unique_conflictfor-1(any unique violation, such as a name or a Content clash),errorfor-2.upsert_conceptscatches the RLS error per row.error; a triple'srelationwritten as a RID gets 422 even when it names a stored type), 500 for a database failure. Nothing is written in any of those cases. Database failures and the 502 are reported throughinternalError.handleRouteError, which answers 400 and logs to the console only.jsonb, so one such item fails the wholeupsert_conceptscall. Roam and Obsidian already callupsert_conceptsdirectly with the same exposure. The route then answers 500 and reports it.failedwitherrorand nothing is stored for them; when one already exists, both are written (read from the SQL, not run). No ticket yet.Verification
pnpm ci:validatepasses: check-types 8/8 tasks, test:unit 6/6 tasks (website: 64 tests).route.test.tscalls the handler with a mocked client and covers 400 (including a year-0 date, a RID node type, one 5,000-character schema id, one 1,500-character~id and 1,000 schema ids), 401, 502, 403, 422, 500, 200, an empty body and the CORS preflight. Every response is checked for its CORS header.next dev; see the Loom section. The 502 and 500 paths are covered by the unit tests only.Loom video
fee-890-terminal-v2-proof.mp4
One video covers both FEE-890 PRs.
Setup: a local build of this branch at
37a4277b. Later commits refuse a non-documentscale, answer 502 for an auth server error, refuse dates outside years 1 to 9999 and RID types, order entries with an explicit stack, renamename_conflicttounique_conflictand bound the schema lookup; unit tests cover those, not the video. The route ran undernext devfrom the PR worktree, against an isolated local Supabase stack started from this branch's migrations, with edge functions served socreate-spacecould make two new spaces. Every call is curl, and every case reads Postgres back on screen.modifiedAt. The cited node is written before the node citing it, nodes and the relation have their schema, and the triple carries the relation type's label and complement.last_modifiedequals itscreated.modifiedAtupdates the same row, and itslast_modifiedmoves forward. No new row is added.ridnames another space, and a node withassetseach get 400 naming the field. Nothing is written.failedasname_conflict(nowunique_conflict), while the other node in the call is written.Scope check
$scope-checkagainst FEE-890 and the final diff.Done When: Refusing schemametadata, nodeassets, a non-documentscaleand RID node or relation types is narrower than "all aspects of upserting"; FEE-890 Create a generic upsert route that accepts all root CrossApp types (1/2) #1621's Reviewer brief gives the reasons. Whether FEE-890 ships without these is open with sid; noDecision:comment on FEE-890 records it yet. The schema-lookup bound refuses some long reference lists a gateway would accept, so a long list gets 400 instead of a reported 500.Standards check
$dg-pr-adherence-checkagainst the final diff and PR metadata.Local delegated full review
$dg-delegated-full-reviewwhen no other full-review workflow is available.DiscourseGraphs/review-labat01b07f3) on9d89088e: one P3 finding (B3), listed under Risk; nothing blocks review. Review Lab page