Skip to content

feat(cli): mount runtime datasource admin in serve by default (ADR-0015 Addendum)#1511

Merged
xuyushun441-sys merged 1 commit into
mainfrom
feat/datasource-admin-serve-default
Jun 2, 2026
Merged

feat(cli): mount runtime datasource admin in serve by default (ADR-0015 Addendum)#1511
xuyushun441-sys merged 1 commit into
mainfrom
feat/datasource-admin-serve-default

Conversation

@xuyushun441-sys

@xuyushun441-sys xuyushun441-sys commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

What

Wires @objectstack/service-datasource-admin (added in #1502) into the serve composition root, mounted by default. A self-host runtime now ships the "Add Datasource" wizard backend out of the box — list / test-connection / create / update / remove runtime datasources via /api/v1/datasources, no code or redeploy.

Why

From a platform-completeness standpoint, data connectivity is the bedrock of the low-code promise: every view/flow/dashboard sits on it. Leaving "add a datasource" as the one code-only, redeploy-required step is a conspicuous hole — and since datasource is already a Studio-managed metadata type, not mounting the backend leaves a visible-but-dead UI surface. Mechanism is open; the tier line stays on which ICryptoProvider / driver factory a host injects, so this gives nothing paid away.

How

  • One shared crypto provider for all of sys_secret (datasource creds + secret fields). Single instance ⇒ single key ⇒ everything decrypts consistently. The datasource secret binder is wired before runtime.start() (the plugin's kernel:ready boot rehydration decrypts persisted creds); the existing post-start secret-field wiring reuses the same instance.
  • Fail-closed preserved: if no crypto provider can be created, secrets is left undefined and secret-bearing create/update rejects rather than storing cleartext.
  • Routes registered via a tiny init-time plugin that resolves http.server (same pattern as the hostname guard). Graceful skip when the package or http.server is absent.

Tests

  • New admin-routes integration test against the real HonoHttpServer adapter (the same IHttpServer serve mounts): list / secret-split / create-201 / 503-unavailable / 400-error.
  • 34 pass (was 29); cli typecheck + build green.

Related

🤖 Generated with Claude Code

…0015 Addendum)

Wire `@objectstack/service-datasource-admin` into the `serve` composition root
so a self-host runtime is a complete low-code platform out of the box — the
"Add Datasource" wizard (list/test/create/update/remove + REST routes under
/api/v1/datasources) works without code or redeploy.

Mechanism is open; the tier line stays on which ICryptoProvider / driver factory
a host injects, not on whether the UI can manage datasources.

Details:
- A single shared crypto provider now backs ALL of sys_secret (datasource creds
  + secret fields). One instance ⇒ one key, so everything decrypts consistently.
  The datasource secret binder is wired BEFORE runtime.start() (its kernel:ready
  boot rehydration decrypts persisted creds); the post-start secret-field wiring
  reuses the same instance.
- Fail-closed preserved: if no crypto provider can be created, `secrets` is left
  undefined and secret-bearing create/update rejects instead of storing cleartext.
- REST routes registered via a tiny init-time plugin that resolves http.server
  (same pattern as the hostname guard). Graceful skip if the package or
  http.server is absent.
- New @objectstack/service-datasource-admin dep on the cli package.

Tests:
- Adds admin-routes integration test against the REAL HonoHttpServer adapter
  (list / test-secret-split / create-201 / 503-unavailable / 400-error).
  34 pass (was 29); cli typecheck + build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
spec Building Building Preview, Comment Jun 2, 2026 2:41am

Request Review

@github-actions github-actions Bot added dependencies Pull requests that update a dependency file tests size/m labels Jun 2, 2026
@xuyushun441-sys xuyushun441-sys merged commit e33750d into main Jun 2, 2026
10 of 12 checks passed
@xuyushun441-sys xuyushun441-sys deleted the feat/datasource-admin-serve-default branch June 2, 2026 02:42
const { InMemoryCryptoProvider } = await import(
/* webpackIgnore: true */ '@objectstack/service-settings'
);
sharedCryptoProvider = sharedCryptoProvider ?? new InMemoryCryptoProvider();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file size/m tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants