Skip to content

feat(api): add the v2 notebook endpoints to the generated client - #6595

Open
SaxonF wants to merge 1 commit into
developfrom
notebooks/01-api-notebook-endpoints
Open

SaxonF wants to merge 1 commit into
developfrom
notebooks/01-api-notebook-endpoints

Conversation

@SaxonF

@SaxonF SaxonF commented Sep 14, 2026

Copy link
Copy Markdown

Adds the five /v2/projects/{ref}/notebooks routes — list, get, create, update, delete — to the generated Management API client, so the notebook commands later in this stack have a typed client to drive.

Pure codegen. The routes are live on api.supabase.com, so generate picks them up from the published v2 spec; no override block is involved.

How to try it

pnpm --filter @supabase/api run generate
git diff --exit-code -- packages/api/src/generated   # regeneration is reproducible

Notes

  • The deployed spec requires row_limit on database cells and time_range on log cells in notebook responses.
  • Cell schemas are closed: a key the spec does not declare is dropped rather than passed through.
  • page / filter on these operations are style: deepObject, which the client does not serialize correctly yet. Fixed in the next PR in this stack.

@SaxonF
SaxonF added this pull request to stack #6600 September 14, 2026 11:20
@SaxonF
SaxonF force-pushed the notebooks/01-api-notebook-endpoints branch from a3b3310 to b33241b Compare September 14, 2026 23:50
@SaxonF
SaxonF removed this pull request from stack #6600 September 15, 2026 00:30
@SaxonF
SaxonF added this pull request to stack #6612 September 15, 2026 00:31
@SaxonF
SaxonF force-pushed the notebooks/01-api-notebook-endpoints branch from b33241b to 301e53e Compare September 22, 2026 10:54
@SaxonF
SaxonF marked this pull request as ready for review September 22, 2026 10:55
@SaxonF
SaxonF requested a review from a team as a code owner September 22, 2026 10:55

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

Reconciled five Claude findings and one Codex finding into five entries. The shared deep-object serialization issue is confirmed as major; the override drift risk and two convention/style issues are also confirmed. The claimed notebook content round-trip incompatibility is refuted by the generated types and validation path.

Findings

Severity Location Category Sources Claim
🟠 MAJOR packages/api/scripts/openapi-overrides.json:707 query-serialization claude+codex The generated listNotebooks client cannot correctly serialize its deep-object filter and pagination parameters, so filtering and cursor pagination will not follow the endpoint contract; the README also omits this newly affected operation.
🟡 MINOR packages/api/scripts/openapi-overrides.json:682 maintainability claude The remove-and-add overrides mask future upstream changes to the notebook paths and schemas from the hourly drift detector.
⚪ NIT packages/api/scripts/openapi-overrides.json:686 conventions claude The override comment exposes internal rollout context and references notebook push/pull commands that do not yet exist in the repository.
⚪ NIT packages/api/scripts/openapi-overrides.json:691 style claude The new override block is stylistically inconsistent with existing entries in its Unicode escaping and placement of the $comment field.
Refuted findings (kept for transparency, not posted as review comments)
  • packages/api/scripts/openapi-overrides.json:1282 (api-design): A notebook content value returned by the API cannot be passed to create or update without manually removing schema_version and other response-only fields.
    Refuted: The generated response content type is structurally assignable to the request content type: it has all required request fields, and extra properties do not prevent assigning an existing typed value in TypeScript. The client also validates inputs through the request schema before building the request at packages/api/src/internal/client.ts:547-552. The cited asymmetry therefore does not establish the claimed type-checking or manual-stripping failure.

Stats

Claude findings: 5 · Codex findings: 1 · Confirmed: 4 · Refuted: 1 · Uncertain: 0


Models: claude-opus-5 + gpt-5.6-sol · Trigger: auto · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

Comment on lines +682 to +688
"op": "remove",
"path": "/paths/~1v2~1projects~1{ref}~1notebooks"
},
{
"$comment": "supabase/infrastructure ships the v2 notebook routes ahead of the platform. Pinned here so `supabase notebooks push/pull` has a typed client; the paired remove keeps the add idempotent once the deployed spec carries them, at which point this whole block should be deleted rather than left masking upstream.",
"op": "add",
"path": "/paths/~1v2~1projects~1{ref}~1notebooks",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MINOR · maintainability · source: claude

The remove-and-add overrides mask future upstream changes to the notebook paths and schemas from the hourly drift detector.

Evidence: packages/api/scripts/download-openapi.ts:483-488 applies overrides before writing the generated snapshot. Its remove operation silently ignores missing pointers at lines 219-225, while add inserts the pinned value at lines 215-217. Thus an upstream notebook definition is removed and replaced before drift is evaluated.

Suggested fix: Add a guard that detects when these pinned paths or schemas appear upstream and fails regeneration until the override is removed or reconciled.

Comment on lines +707 to +731
"style": "deepObject"
},
{
"in": "query",
"name": "page",
"required": false,
"schema": {
"properties": {
"after": {
"minLength": 1,
"type": "string"
},
"before": {
"minLength": 1,
"type": "string"
},
"size": {
"maximum": 100,
"minimum": 1,
"type": "integer"
}
},
"type": "object"
},
"style": "deepObject"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 MAJOR · query-serialization · source: claude+codex

The generated listNotebooks client cannot correctly serialize its deep-object filter and pagination parameters, so filtering and cursor pagination will not follow the endpoint contract; the README also omits this newly affected operation.

Evidence: The parameters declare style deepObject at packages/api/scripts/openapi-overrides.json:707 and :731, but packages/api/src/generated/contracts.ts:17304 stores only the names. packages/api/src/internal/client.ts:448-456 then JSON-stringifies object values via normalizeUrlValue at lines 272-281 rather than producing bracketed keys. packages/api/README.md:168-172 lists only the three pre-existing affected operations.

Suggested fix: Preserve query-parameter style metadata during generation and encode deepObject values as bracketed keys, with request-level coverage. Until fixed, add v2-list-notebooks to the README limitation.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next PR

"path": "/paths/~1v2~1projects~1{ref}~1notebooks"
},
{
"$comment": "supabase/infrastructure ships the v2 notebook routes ahead of the platform. Pinned here so `supabase notebooks push/pull` has a typed client; the paired remove keeps the add idempotent once the deployed spec carries them, at which point this whole block should be deleted rather than left masking upstream.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ NIT · conventions · source: claude

The override comment exposes internal rollout context and references notebook push/pull commands that do not yet exist in the repository.

Evidence: The comment names supabase/infrastructure, describes its shipping order relative to the platform, and references supabase notebooks push/pull. No notebook command exists under apps or packages outside the newly generated API artifacts. trusted/CLAUDE.md:101 requires comments in this public repository to omit internal context.

Suggested fix: Describe only the externally observable reason and retirement condition, without naming the internal repository, rollout order, or unshipped commands.

"path": "/paths/~1v2~1projects~1{ref}~1notebooks",
"value": {
"get": {
"description": "Returns a cursor-paginated list of the project notebooks. Notebook bodies are omitted \u2014 read a single notebook to get its cells.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ NIT · style · source: claude

The new override block is stylistically inconsistent with existing entries in its Unicode escaping and placement of the $comment field.

Evidence: Line 691 is the file's only Unicode escape, while the generated snapshot emits the same em dash literally. The new entry places $comment first at line 686, whereas existing commented overrides place it last at lines 594, 619, 661, and 679.

Suggested fix: Use consistent Unicode representation and place $comment consistently with the existing override entries.

Pins the five `/v2/projects/{ref}/notebooks` routes into the OpenAPI
overrides and regenerates the contracts, effect client, and spec snapshot
so `list`/`get`/`create`/`update`/`delete` notebook operations are
available as typed operations.

supabase/infrastructure ships these routes ahead of the platform spec, so
the override is an add paired with a remove that keeps it idempotent once
the deployed spec carries them — at which point the whole block should be
deleted rather than left masking upstream.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@SaxonF
SaxonF force-pushed the notebooks/01-api-notebook-endpoints branch from 301e53e to dcf75a2 Compare September 22, 2026 11:11

@avallete avallete left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve. The generated notebook routes are what pull and push call. List, get, create, update, and delete all behaved against a staging project. No change requested on this commit.

This branch has not been deployed

No deployments
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.

2 participants