feat(datasource): read-only introspection routes + by-name test for Studio sync#2085
Merged
Conversation
Expose the external-datasource introspection service over REST so Studio can list a datasource's remote tables and preview the object definition they would become: - GET /api/v1/datasources/:name/remote-tables → listRemoteTables() - POST /api/v1/datasources/:name/object-draft → generateObjectDraft(table) Both are read-only (introspect + type-map; no persistence) — the caller creates the object through the normal metadata channel. Degrade to 503 when the external-datasource service isn't wired; 400 when the table is missing. Verified live against a seeded SQLite datasource (customers/orders → remote-tables lists both; object-draft yields a typed object definition). Tests: remote-tables list + object-draft (200 + 400-without-table). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 5 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
The `datasource` `test_connection` action declares `POST /datasources/:id/test`
(probe a saved datasource by name), but the admin routes only implemented
`POST /datasources/test` (probe an unsaved inline draft). The action — and any
UI that wires it (the Studio datasource manager) — hit a 404.
Add a thin by-name route backed by a new `ExternalDatasourceService.testConnection(name)`
that times a live introspect (driver connect + schema read) and returns
`{ ok, latencyMs, tableCount }` or `{ ok:false, error }`. Reuses the same wired
introspection pool as remote-tables/object-draft, so the secret is resolved
through the existing path — the route never handles cleartext. Registered before
the generic `:name` mutation routes.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 21, 2026
Closed
xuyushun441-sys
added a commit
that referenced
this pull request
Jun 21, 2026
…tion (#2112) The README mentioned "REST routes under /api/v1/datasources" but didn't enumerate them, and predated the Studio integration. Add: - a REST routes section (lifecycle + drivers catalog + by-name test + GET :name detail + introspection/sync routes), with the credential-split note; - a Studio integration section: datasource is managed through the metadata-admin engine (Setup → Integrations → Datasources), runtime records persist to sys_metadata and rehydrate on restart. Reflects #2083 (drivers), #2085 (remote-tables/object-draft/by-name test), #2086 (GET :name), #2091 (Setup nav), #2096 (persistence). Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
Expose the existing
external-datasourceintrospection service over REST so Studio can list a datasource's remote tables and preview the object definition each would become — the backend half of "sync objects from a datasource".GET /api/v1/datasources/:name/remote-tables→listRemoteTables()POST /api/v1/datasources/:name/object-draft→generateObjectDraft(table)Both are read-only (introspect + type-map, no persistence). The Studio caller creates the resulting object through the normal metadata channel (
objectis create-only at runtime), keeping object-creation in the sanctioned path rather thanimportObject(which requires a writable store not wired here). Degrade to 503 when the service isn't wired; 400 whentableis missing.Verification
Verified live against a fresh showcase backend with a seeded SQLite datasource (
customers/orders):remote-tableslists both with column counts;object-draftforcustomersyields{ name, fields: [id,name,email,created_at], external:{remoteName} }. Unit tests cover both routes (list + draft 200 / 400-without-table); service-datasource admin-routes suite green (8/8).🤖 Generated with Claude Code