Repository navigation
refactor(react): AdapterCtx and useAdapter are typed by DataSource; react drops its data-objectstack dependency - #26292
Conversation
…dError in core (WIP) Claude-Session: https://claude.ai/code/session_017sGTFTS9edirCTVBgQysK7 Co-authored-by: Claude <noreply@anthropic.com>
…d designer declare ObjectStackAdapter (WIP) Claude-Session: https://claude.ai/code/session_017sGTFTS9edirCTVBgQysK7 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sGTFTS9edirCTVBgQysK7 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sGTFTS9edirCTVBgQysK7 Co-authored-by: Claude <noreply@anthropic.com>
…claration (test program reach) Claude-Session: https://claude.ai/code/session_017sGTFTS9edirCTVBgQysK7 Co-authored-by: Claude <noreply@anthropic.com>
…reached from the registry Claude-Session: https://claude.ai/code/session_017sGTFTS9edirCTVBgQysK7 Co-authored-by: Claude <noreply@anthropic.com>
Contract reviewServed-tier: ① Derived judgments
② Contract declarations
③ Evidence and serialisation
Implemented-by: card thread VERDICT: PASS |
席位核对 · ACCEPT · seat
|
…-4u44e4 # Conflicts: # scripts/sdui-manifest.sources/core.json # scripts/sdui-manifest.sources/react.json
Claude-Session: https://claude.ai/code/session_017sGTFTS9edirCTVBgQysK7 Co-authored-by: Claude <noreply@anthropic.com>
席位核对 · re-ACCEPT · seat
|
Requested by Steve · project thread
Fixes #25917
@object-ui/reactno longer depends on@object-ui/data-objectstack.AdapterCtxanduseAdapter()are typed by the protocol-levelDataSourcefrom@object-ui/types, and a host that installs a concrete adapter declares it once on a new extension point,AdapterContextRegister(module augmentation, the same shape as TanStack Router'sRegister). Theenable-block denial predicate moves to@object-ui/core, and the adapter re-exports it unchanged.Clause-②: yes (narrowing)
Metadata-protocol: none
Premise, measured on origin/main 4f7e041
componentsfiles reaching the concrete adapter. That count is stale: today there are 62 non-test readers ofuseAdapter/AdapterCtx(app-shell 41, console 14, components 4, plugin-designer 3).ObjectStackAdaptermembers thatDataSourcedoes not declare:getClient(13 files),probeAppAccess,probeMetaItemAccess,getConnectionState/onConnectionStateChange,clearCache,queryDataset. They all sit in app-shell, console and plugin-designer, which already depend on the adapter.isApiAccessDeniedErroris also called insidedata-objectstack, socoreis its only single-source home: bothreactanddata-objectstackdepend oncore.What changed
@object-ui/react:AdapterCtx/useAdapter()carryContextAdapter, which resolves to the adapter a host declares onAdapterContextRegisterand otherwise toDataSource.@object-ui/data-objectstackmoves todevDependencies, because one boundary test (error-message.normalisation-boundary.test.ts) still reads it.error-message.tsimports the predicate from@object-ui/core. The README documents the extension point.@object-ui/core: newutils/api-access-denied.tsholdsAPI_ACCESS_DENIED_CODESandisApiAccessDeniedError, moved verbatim with their docblock.@object-ui/data-objectstack: re-exports both names from@object-ui/core, so its published face is unchanged, and its internal caller imports the predicate from core.@object-ui/app-shell:adapter-context-register.tsdeclaresObjectStackAdapter, and the package entry imports it, so the declaration ships indist/index.d.ts.@object-ui/plugin-designer: the same declaration, imported by the two pages that callgetClient, so the test type-check program sees it too.coreandreactre-recorded.data-objectstack.jsonis removed by the generator ("no longer reached"), because the registry walk reached it only through react.No call site of the 18 changed. Runtime behaviour is unchanged: the context holds the same object.
Verification (merged main 2409c9c, head 29b4eed, all heavy runs under
os-verify-lock)turbo run build --filter=@object-ui/console, 71/71 tasks, which includes the Console build.type-check: core, react, data-objectstack, components, plugin-designer, app-shell and console all exit 0. Console resolves@object-ui/reactand@object-ui/app-shellfromdist, and its seven files that callgetClientthrough app-shell'suseAdaptercompile, so the published app-shell types carry the declaration.ui/apps/consolethat imports type-only from@object-ui/app-shelland readsuseAdapter()?.getClient()exits 0. The same file without the app-shell import exits 2 with TS2339,Property 'getClient' does not exist on type 'DataSource'(the compiler prints the type with itsanyargument).AppShellContext.adapterType.pin.test.ts(13 cases, same tsc harness asSchemaRendererContext.dataSourceType.pin.test.ts). Without a declaration,getClientandprobeAppAccessare refused and anyDataSourcemay be provided. With a declaration, the host adapter's own member is readable and a bareDataSourceprovider value is refused. CONTROL rows guard against a harness that has degraded toany.scripts/ablation-replace.mjs, each restored to the HEAD blob with an emptygit diff HEAD:anyturns 2 cases red: the provider check and a CONTROL row.DataSourcefallback withgetClient/probeAppAccessturns 3 cases red: both NARROWED rows and the provider row.packages/react/,packages/core/,packages/data-objectstack/andpackages/plugin-designer/: 480 files and 7238 tests passed, 27 skipped. app-shell's suite is left to CITest Core/ Test UI because its runtime is untouched (type declaration only).dispatch-gates --commandsderived were run and reconciled with--ran. 63 exit 0.check:dual-build-cjs-loadsexits 3 (PREREQUISITE NOT MET: it reads the whole repo's built output), so it is NOT MEASURED locally and left to CI.check-adr-0087-registrationverifiesnot-required (runtime-interface-only ...#ContextAdapter).check:new-line-citations: 0 new citations. eslint on the changed files: 0 errors.Acceptance notes
runtime-interface-onlyinherits the prescription refusal, and the detector does not read this block as a prescription. The disposition stands on the compiler channel: a reader that needs the declaration getsTS2339at its own call site, and no metadata surface moves.plugin-designerneeded the declaration imported by its pages, not only placed undersrc/. Itstsconfig.test.jsoncompiles the pages through the test files, and that program never includes a file that nothing imports.🤖 Generated with Claude Code
https://claude.ai/code/session_017sGTFTS9edirCTVBgQysK7
Generated by Claude Code