fix(runtime): surface code-defined datasources on the host-config boot path (ADR-0015 §18)#2157
Merged
Merged
Conversation
…t path (ADR-0015 §18)
A datasource declared in `defineStack({ datasources: [...] })` was absent from
`GET /api/v1/datasources` and `GET /api/v1/meta/datasource` under `os dev`/`serve`
for any config whose `plugins` are already instantiated (`isHostConfig` true), even
though the boot banner counted it and its federated objects were queryable.
Root cause is write-side, not read-side: on the host-config path no MetadataPlugin
loads, so the `metadata` service is the kernel's in-memory fallback, which
implemented register/list/get but not `registerInMemory`. AppPlugin gates
code-defined-datasource (and stack-RBAC) registration on
`typeof metadata.registerInMemory === 'function'`, so the registration was silently
skipped and both REST surfaces read empty. The read paths (metadata.list,
datasource-admin listDatasources, protocol.getMetaItems which merges metadata.list)
were already correct.
Add `registerInMemory` (synchronous, no persistence — identical to register for an
in-memory store) to both in-memory metadata fallbacks: @objectstack/core's
createMemoryMetadata and @objectstack/plugin-dev's dev stub. Also restores
stack-declared RBAC listing on this path. Adds a runtime regression test that boots
the host-config shape and asserts all three backing surfaces include the code
datasource.
Follow-up to #2111.
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 3 package(s): 30 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
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>
14 tasks
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.
Problem
A datasource declared in
defineStack({ datasources: [...] })(e.g.examples/app-showcase'sshowcase_external) was absent fromGET /api/v1/datasourcesandGET /api/v1/meta/datasourceunderos dev/serve— even though the boot banner counted it ("1 Datasources") and its federated objects were queryable. Affects any code-defined datasource (app-crm too). Follow-up to #2111 / ADR-0015 §18.Root cause (write-side, not read-side)
The read paths were already correct:
protocol.getMetaItems({type:'datasource'})mergesmetadataService.list(type), and datasource-admin'slistDatasourceRecordsreadsmetadata.list('datasource').The showcase config has instantiated plugins, so
isHostConfigis true →shouldBootWithLibraryis false → it boots via the lightweight assembler, notcreateStandaloneStack/MetadataPlugin. On that host-config path themetadataservice is the kernel's in-memory fallback (createMemoryMetadata), which implementedregister/list/getbut notregisterInMemory.AppPlugingates code-defined-datasource (and stack-RBAC) registration ontypeof metadata.registerInMemory === 'function', so the registration was silently skipped and both REST surfaces read empty. The standalone path (NodeMetadataManager, which hasregisterInMemory) was unaffected.Fix
Add
registerInMemory(synchronous, no persistence — identical toregisterfor an in-memory store, matchingMetadataManager's signature) to both in-memory metadata fallbacks:packages/core/src/fallbacks/memory-metadata.tspackages/plugins/plugin-dev/src/dev-plugin.ts(same latent gap)This also restores stack-declared RBAC (
roles/permissions/sharingRules/policies) listing on this path, since AppPlugin registers those through the same guard.Test / verification
packages/runtime/src/datasource-visibility.test.tsboots the host-config shape (no MetadataPlugin → kernel injects the fallback) and assertsmetadata.list,datasource-admin.listDatasources()(backs/api/v1/datasources), andprotocol.getMetaItems(backs/api/v1/meta/datasource) all include the code datasource withorigin:'code'. Verified RED before → GREEN after.200withshowcase_external(origin:"code").Changeset:
@objectstack/core: patch(fixed group).🤖 Generated with Claude Code