Repository navigation
refactor(ts): resolve extensions through the core's plan contract - #1126
Merged
Merged
Conversation
The TypeScript resolver renders its own "no loadable extension file (.so / .node)" message. Once resolution moves into the core's SelectError the suffixes render as globs (*.so), so pin that wording from the binding tier and from the CLI. skip-changelog: red test only; the behavior change ships with the implementation commit
`resolveConfigsExtensionSpecs` now reads each config off disk and hands
`{ path, contents }` pairs to the addon's `planConfigExtensions`;
`resolvePackage` hands the located package directory and its files to
`selectLoadable`; `resolveExtensionPath` classifies through `isBareName`.
TypeScript keeps only the two halves it alone can do: reading the files,
and `require.resolve`.
Six modules go away against two added, and with them `smol-toml` and the
lazy-load guard that dependency needed. The core renders the
missing-loadable error, so its suffix list is now glob-shaped
(`*.so / *.node`), matching Python.
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.
Slice C of #1111. The TypeScript SDK stops carrying its own port of extension
resolution and reaches the Rust core's plan contract
(
dirsql::extension_resolution, landed in #1124) through the napi addon —mirroring what Python did in #1125.
resolveConfigsExtensionSpecsreads each config off disk and hands{ path, contents }pairs toplanConfigExtensions;resolvePackagehands thelocated package directory and its files to
selectLoadable;resolveExtensionPathclassifies throughisBareName. TypeScript keeps onlythe two halves it alone can do: reading the files, and
require.resolve.Six modules go away (
is-bare-name,has-bare-name,load-extension-entries,resolve-entries,platform-suffixes,resolve-config-extension-specs)against two added (
read-config,plan-entry-path— split apart only tosatisfy
one-function-per-file).smol-tomlis gone. The core parses the config now, so the dependency andthe #720 lazy-load guard that deferred importing it both go with it; the CLI
helper imports the resolver statically again.
Behavior change
The missing-loadable error is now rendered by the core, which writes its suffix
list as globs:
no loadable extension file (*.so / *.node) found in package 'x' (searched /dir), where TypeScript previously wrote(.so / .node). Pythonalready emitted the glob form, so this restores parity. Red integration + e2e
tests for the new wording were pushed as their own commit (9da1e01) and CI was
confirmed red on that assertion alone before the implementation landed. A
migration fragment documents the change.
Marshaling note: napi omits a
Noneobject field rather than emittingnull, soExtensionPlanEntryis typed as a union of variants whose absentside is
undefined. A top-levelOption<Vec<T>>does come through asnull,so the "no config entries" signal is unchanged.
Parity
PARITY.mdupdated: the "temporary drift" note flagging TypeScript as thelagging SDK is removed — both SDKs now plan through the core. This restores
parity; no new drift. Slice D (#1122) does the final sweep.
Fixes #1121
E2E Verification
packages/rustuntouched; only the ts napi crate changed)packages/python/e2e-attestations/<branch>.jsonreceipt written ifpackages/pythonchanged (just e2e-attest-python) — N/Apackages/ts/e2e-attestations/<branch>.jsonreceipt written ifpackages/tschanged (just e2e-attest-ts)pnpm test:e2e(packages/ts),just e2e-attest-ts,pnpm test:binding,pnpm test:integration,pnpm coverage,cargo test -p dirsql-napi,just preflightManual exercise
Built
packages/rust/tests/fixtures/testextand staged it asnode_modules/dirsql-manual-ext/testext.sowith a config naming the barepackage:
Same result from the SDK (
new DirSQL({ root, config })→db.query(...)→[{"answer":42}]). And the new wording, against a package with no loadable:Changelog / Migrations
<root>/<pkg>/changelog.d/for each changed package (or:skip-changelogtrailer on a commit with reason)<root>/<pkg>/migrations.d/(or: not required -- additive/bugfix only)Follow-up
withResolvedExtensionsno longer awaits anything but staysasync; making itsync ripples into
cli/mainand is slice D's (#1122) to take.