Skip to content

feat(app-showcase): add an end-to-end external datasource + federated object example (#2111) - #2139

Merged
xuyushun441-sys merged 2 commits into
mainfrom
feat/2111-showcase-external-datasource
Jun 21, 2026
Merged

feat(app-showcase): add an end-to-end external datasource + federated object example (#2111)#2139
xuyushun441-sys merged 2 commits into
mainfrom
feat/2111-showcase-external-datasource

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Closes#2111.

What

A runnable, self-contained example of the ADR-0015 external datasource → federated objects flow in app-showcase, with no external serveros dev just works.

  • src/datasources/showcase-external.datasource.ts — a second, read-only SQLite datasource (schemaMode:'external', onMismatch:'warn' so a fixture hiccup never bricks the showcase boot). Includes a commented Postgres+secret variant for the masked-secret widget.
  • src/objects/external/{customer,order}.object.ts — federated objects whose names (showcase_ext_customer/order) deliberately differ from their remote tables (customers/orders), bound via external.remoteName.
  • src/datasources/external-fixture.ts — the stack onEnable hook: idempotently provisions the fixture SQLite, registers a live read-only driver under the datasource name, and registers the federated objects' read metadata (ql.syncObjectSchema).
  • README section + test/external-datasource.test.ts smoke test.

Builds on the ADR-0015 federation read-path fix (#2138), which makes external.remoteName honored by queries.

Verified live (os dev)

  • GET /api/v1/data/showcase_ext_customer → 200, 3 rows (queried live from external table customers).
  • GET /api/v1/data/showcase_ext_order → 200, 4 rows.
  • ?region=EU / ?region=APAC filters push down to the remote table correctly.
  • os dev boots zero-config; the external SQLite fixture is auto-provisioned.

Known follow-up (not this PR)

In the dev config-load path, a code-defined datasource is not yet surfaced by GET /api/v1/datasources / GET /api/v1/meta/datasource (the admin list reads persisted records; getMetaItems doesn't surface in-memory registrations). This affects any code-defined datasource (e.g. app-crm), and is tracked separately. The federation read path itself works end-to-end.

🤖 Generated with Claude Code

… object example (#2111)
A code-defined EXTERNAL datasource (ADR-0015) over a second, read-only SQLite
file — no external server required, so `os dev` just works. Demonstrates the
full federation path the runtime datasource-admin UI exposes.
- src/datasources/showcase-external.datasource.ts — schemaMode:'external',
read-only, onMismatch:'warn' (a fixture hiccup never bricks the showcase boot).
Includes a commented Postgres+secret variant for the masked-secret widget.
- src/objects/external/{customer,order}.object.ts — federated objects whose
names (showcase_ext_customer/order) deliberately differ from their remote
tables (customers/orders), bound via external.remoteName — exercises the
remote-table remap fixed in the companion driver change.
- src/datasources/external-fixture.ts — the onEnable hook: idempotently
provisions the fixture sqlite (tables + seed rows), registers a live read-only
driver under the datasource name, and registers the federated objects'
read metadata (DDL-free, via ql.syncObjectSchema).
- objectstack.config.ts wires the datasource + objects + onEnable; package.json
adds @objectstack/driver-sql; README documents the flow and the Setup →
Datasources sync UI; test/external-datasource.test.ts smoke-asserts the binding.
Depends on the ADR-0015 federation read-path fix (honoring external.remoteName).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercelBot commented Jun 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJun 21, 2026 3:58pm

Request Review

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file tests size/m labels Jun 21, 2026
@xuyushun441-sysxuyushun441-sys added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Jun 21, 2026
…fication
`objectstack verify` probe-inserts into every object; a read-only external object
(ADR-0015) correctly rejects the insert via the write gate, which verify reported
as a create-failed runtime failure (breaking the Dogfood Regression Gate once the
showcase gained federated objects). deriveCrudCases now marks external objects
that aren't fully write-opted-in (datasource.external.allowWrites && object.external.writable)
as `blocked`/skipped. Adds derive.test.ts covering the skip + the write-opted-in
and managed pass-through cases.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@xuyushun441-sysxuyushun441-sys removed the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

No hand-written docs reference the 1 changed package(s). ✅

@xuyushun441-sys
xuyushun441-sys merged commit 0feea92 into mainJun 21, 2026
20 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the feat/2111-showcase-external-datasource branch June 21, 2026 16:06
xuyushun441-sys added a commit that referenced this pull request Jun 22, 2026
…le, credentials, visibility, query completeness) (#2162)
Consolidates the runtime gaps surfaced while implementing ADR-0015 federation
(#2138 read path, #2149 columnMap, #2139 example+verify, #2157 visibility) into a
single forward decision: one DatasourceConnectionService that auto-connects
declared datasources as queryable engine drivers (no onEnable bridge), backward-
compatible opt-in gating (existing managed apps unchanged), credential resolution
at connect, native-analytics remote-table awareness, and columnMap/field.columnName
reconciliation. Status: Proposed; decisions D1-D8 with a phased rollout.
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependenciesPull requests that update a dependency filedocumentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

examples/app-showcase: add an end-to-end external datasource + federated object example

2 participants

@xuyushun441-sys@os-zhuang