fix(types): find an aliased install through the host importer's ESM-only fallback - #15047

Merged
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer
Sep 3, 2026
Merged

fix(types): find an aliased install through the host importer's ESM-only fallback#15047
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14278

The defect

createHostImporter's #14041 fallback finder verifies the one directory it consults — hostRoot/node_modules/KEY — by matching that directory's manifest name against the declared package name. An aliased install fails that check by construction:

{ "dependencies": { "foo": "npm:bar@1" } }

hostRoot/node_modules/foo holds a manifest named bar, not foo. The check rejected it, the fallback answered absent, and an ESM-only aliased package therefore kept the pre-#14041 INSTALL wording — the confidently-wrong remedy that sends an operator to run pnpm install against an install that is already correct, on a declaration shape packageNameFromSpecifier's own documentation blesses.

The fix: parse the DECLARATION, never widen the check

⛔ The manifest-name check is not loosened. It is what keeps the fallback strictly tighter than the CJS resolution it backs up — the property #14041 rests on and #4719 guards — and widening it would trade a confidently-wrong remedy for a wrong LOAD, the worse direction.

What moves is the expectation, and it is still authored by the host and still read out of the host's own package.json. A new declaredManifestName(declaration) reads the declaration value for the name it promises:

declaration valueexpected manifest namewhy
^1.0.0, *, a tagthe keyno alias declared
npm:bar@1, npm:@acme/x@^2, npm:barbar / @acme/x / barnpm: values are always name[@range]
workspace:bar@*barpnpm's aliased workspace form
workspace:*, workspace:^1.2.3the keya RANGE, no name in it
link:../bar, file:../bar.tgz, a git URLthe keythey name a LOCATION, not a package
anything not parsing as a bare package namethe keyno expectation to move to ⇒ today's refusal is kept

The last three rows are the conservative half: where no name is derivable, the pre-#14278 refusal stands rather than being guessed at. packageNameFromSpecifier is the single authority on what counts as a package name, so the parse cannot drift from the declaration gate's own idea of one.

declaredCjsResolveFallback and hostInstalledPackageDir now take the HostDeclaration itself instead of a (packageName, hostRoot) pair, so the key, the root and the expected name cannot be passed out of step with each other.

Proof — red-first, and which arm fired

The tests were written and run before the implementation, on unmodified packages/types/src/node.ts:

Tests 7 failed | 51 passed (58)

Six of the seven were the new alias-RESCUE arms, and only those:

× THE CARD: an aliased ESM-only package is rescued, not reported as an INSTALL problem
× THE CARD (wording): an aliased install with no loadable entry gets the PACKAGE message
× a SCOPED key aliasing an unscoped package is rescued too
× an aliased SUBPATH resolves against the aliased package
× an alias with no version range names its target just the same
× a `workspace:` ALIAS names its target; a plain `workspace:` range does not

with the red text on the card's own case being exactly the defect:

Cannot find module 'aliased-esm': the host app DECLARES it
(dependencies: "npm:@fixture/alias-esm-only@1") but it could not be resolved.
This is an INSTALL problem, not a declaration problem …

The seventh red was not this change: the DEFAULT fallback is this package's own resolution — @objectstack/spec and nothing else failed with Failed to resolve entry for package "@objectstack/spec" — an unbuilt dependency closure in a fresh worktree. It goes green once pnpm --filter '@objectstack/types^...' build has run, and is green in the run below.

Every tightness control stayed green in the red-first run — the failure the card must not produce (an aliased red that also reddens a non-aliased control) did not occur:

  • TIGHTNESS: a NON-aliased declaration is unchanged — the key is still the expected name
  • TIGHTNESS: an alias naming one package does not license a directory holding another
  • TIGHTNESS: an alias target carrying a SUBPATH is not a package name, and is refused
  • TIGHTNESS: an alias does not reopen the hostRoot boundary
  • BOUNDARY: a link: target whose manifest names something else keeps the refusal
  • and the pre-existing the fallback trusts only a directory whose manifest NAMES the declared package, plus both TIGHTNESS cases of the createHostImporter's declared leg cannot load an ESM-only host package at all, and misreports it as a broken install #14041 block (NODE_PATH, above-hostRoot) and both traversal-span cases.

After the fix, with the dependency closure built:

Test Files 1 passed (1)
Tests 58 passed (58)

Scope

Expected file face, and nothing wider: packages/types/src/node.ts plus its test, plus the changeset.

⚠️#14270 is untouched. Its surface is the wording of the declared-no-loadable-entry remedy formatters; this diff touches zero lines of noLoadableEntryMessage, unresolvableMessage and undeclaredMessage (git diff origin/main -- packages/types/src/node.ts | grep -c 'noLoadableEntryMessage\|unresolvableMessage\|undeclaredMessage'0). The aliased cases here assert those messages, they do not edit them.

Changeset — the fork, measured:packages/types' own files field is ["dist", "README.md", "CHANGELOG.md"], so src/node.ts ships (as dist/node.*) and the error kind an aliased install answers with is published behaviour. ⇒ a changeset is owed, and .changeset/aliased-install-host-importer.md is it (patch).

Out-of-scope findings, filed unassigned, not fixed here

Verification

Run at final HEAD 7bf2ed4080:

  • pnpm --filter '@objectstack/types^...' build — dependency closure (34/34 declaration files emitted for @objectstack/spec)
  • pnpm --filter @objectstack/types exec vitest run --maxWorkers=2 src/node.test.ts — 58/58
  • pnpm --filter @objectstack/types typechecktsc --noEmit, clean. tsc --listFilesOnly confirms the program really contains src/node.tsandsrc/node.test.ts (1 hit each), so the green covers the edited test file rather than merely the sources.
  • Gate union derived by node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack at this HEAD (never a hand-written list): 40 families, harvested with --commands so no spelling or section is dropped. All 40 were run locally, each exit code captured into a file before any pipe: 36 exit 0, 4 exit 3.

NOT MEASURED — the 4 exit-3s (PREREQUISITE NOT MET; neither a pass nor a red):check:dual-build-cjs-loads and check:type-check-debt both need the whole workspace built (85 packages have no dist/ in this worktree), scripts/check-test-completeness.mjs exited before parsing a single summary line, and scripts/pm/check-half-states.mjs needs the GitHub API census this seat cannot reach. All four are CI's to run; none of them is reported here as green.

ESLint — the full repo run, not a narrowing:pnpm lint (eslint . --no-inline-config, the whole tree, the same command CI's Lint & Repo Gates job runs) completed here with exit code 0 and no findings, so nothing about the lint result is scoped down or deferred.


🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza


Generated by Claude Code

…nly fallback
`createHostImporter`'s #14041 fallback finder verifies the one directory it
consults — `<hostRoot>/node_modules/<key>` — by matching that directory's
manifest `name` against the declared package name. An aliased install fails
that check by construction: `{ "dependencies": { "foo": "npm:bar@1" } }` puts a
manifest named `bar` at `node_modules/foo`, so the finder answered `absent` and
an ESM-only aliased package kept the pre-#14041 INSTALL wording — a
confidently-wrong remedy against an install that is already correct.
The declaration is now parsed for the name it promises. `npm:bar@1`,
`npm:@acme/x@^2` and the aliased `workspace:bar@*` name the package installed
under the key; that is the manifest name the finder expects there.
The manifest-name check itself is NOT loosened — it is what keeps the fallback
strictly tighter than the CJS resolution it backs up (#4719 from the fallback
side). What moves is the EXPECTATION, still authored by the host and still read
out of the host's own package.json. A value that is not a bare package name — a
`workspace:` range, an alias carrying a subpath — yields no expectation to move
to, so the key stays and today's refusal is kept; `link:` and `file:` name a
LOCATION rather than a package, so no name is derivable from them at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

5 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to listnot a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 1 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2packageMentionDocs.

Which tree this was computed on

This run read content/docs from 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 — the merge of head 7bf2ed4080f03ca0d02456bdb86b80f409613122 into base d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 && git checkout 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 7bf2ed4080f03ca0d02456bdb86b80f409613122 && git checkout -B drift-repro d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 && git merge --no-ff 7bf2ed4080f03ca0d02456bdb86b80f409613122
node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@github-actionsgithub-actionsBot added size/m documentation Improvements or additions to documentation tests tooling labels Sep 3, 2026
@os-trump
os-trump marked this pull request as ready for review September 3, 2026 18:56
@os-trump
os-trump added this pull request to the merge queueSep 3, 2026
Merged via the queue into main with commit 101ad2cSep 3, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14278-aliased-install-host-importer branch September 3, 2026 19:41
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An aliased install ("foo": "npm:bar@1") fails createHostImporter's manifest-name check, so an ESM-only aliased package keeps the wrong INSTALL wording

1 participant

@os-trump
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all \u003cpre\u003e\u003ccode\u003e blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks"); } } catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); } })(); (function(){ try { var __m = "github.com"; var __re = new RegExp('^' + "github\\.com" + '
Skip to content

fix(types): find an aliased install through the host importer's ESM-only fallback - #15047

Merged
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer
Sep 3, 2026
Merged

fix(types): find an aliased install through the host importer's ESM-only fallback#15047
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14278

The defect

createHostImporter's #14041 fallback finder verifies the one directory it consults — hostRoot/node_modules/KEY — by matching that directory's manifest name against the declared package name. An aliased install fails that check by construction:

{ "dependencies": { "foo": "npm:bar@1" } }

hostRoot/node_modules/foo holds a manifest named bar, not foo. The check rejected it, the fallback answered absent, and an ESM-only aliased package therefore kept the pre-#14041 INSTALL wording — the confidently-wrong remedy that sends an operator to run pnpm install against an install that is already correct, on a declaration shape packageNameFromSpecifier's own documentation blesses.

The fix: parse the DECLARATION, never widen the check

⛔ The manifest-name check is not loosened. It is what keeps the fallback strictly tighter than the CJS resolution it backs up — the property #14041 rests on and #4719 guards — and widening it would trade a confidently-wrong remedy for a wrong LOAD, the worse direction.

What moves is the expectation, and it is still authored by the host and still read out of the host's own package.json. A new declaredManifestName(declaration) reads the declaration value for the name it promises:

declaration valueexpected manifest namewhy
^1.0.0, *, a tagthe keyno alias declared
npm:bar@1, npm:@acme/x@^2, npm:barbar / @acme/x / barnpm: values are always name[@range]
workspace:bar@*barpnpm's aliased workspace form
workspace:*, workspace:^1.2.3the keya RANGE, no name in it
link:../bar, file:../bar.tgz, a git URLthe keythey name a LOCATION, not a package
anything not parsing as a bare package namethe keyno expectation to move to ⇒ today's refusal is kept

The last three rows are the conservative half: where no name is derivable, the pre-#14278 refusal stands rather than being guessed at. packageNameFromSpecifier is the single authority on what counts as a package name, so the parse cannot drift from the declaration gate's own idea of one.

declaredCjsResolveFallback and hostInstalledPackageDir now take the HostDeclaration itself instead of a (packageName, hostRoot) pair, so the key, the root and the expected name cannot be passed out of step with each other.

Proof — red-first, and which arm fired

The tests were written and run before the implementation, on unmodified packages/types/src/node.ts:

Tests 7 failed | 51 passed (58)

Six of the seven were the new alias-RESCUE arms, and only those:

× THE CARD: an aliased ESM-only package is rescued, not reported as an INSTALL problem
× THE CARD (wording): an aliased install with no loadable entry gets the PACKAGE message
× a SCOPED key aliasing an unscoped package is rescued too
× an aliased SUBPATH resolves against the aliased package
× an alias with no version range names its target just the same
× a `workspace:` ALIAS names its target; a plain `workspace:` range does not

with the red text on the card's own case being exactly the defect:

Cannot find module 'aliased-esm': the host app DECLARES it
(dependencies: "npm:@fixture/alias-esm-only@1") but it could not be resolved.
This is an INSTALL problem, not a declaration problem …

The seventh red was not this change: the DEFAULT fallback is this package's own resolution — @objectstack/spec and nothing else failed with Failed to resolve entry for package "@objectstack/spec" — an unbuilt dependency closure in a fresh worktree. It goes green once pnpm --filter '@objectstack/types^...' build has run, and is green in the run below.

Every tightness control stayed green in the red-first run — the failure the card must not produce (an aliased red that also reddens a non-aliased control) did not occur:

  • TIGHTNESS: a NON-aliased declaration is unchanged — the key is still the expected name
  • TIGHTNESS: an alias naming one package does not license a directory holding another
  • TIGHTNESS: an alias target carrying a SUBPATH is not a package name, and is refused
  • TIGHTNESS: an alias does not reopen the hostRoot boundary
  • BOUNDARY: a link: target whose manifest names something else keeps the refusal
  • and the pre-existing the fallback trusts only a directory whose manifest NAMES the declared package, plus both TIGHTNESS cases of the createHostImporter's declared leg cannot load an ESM-only host package at all, and misreports it as a broken install #14041 block (NODE_PATH, above-hostRoot) and both traversal-span cases.

After the fix, with the dependency closure built:

Test Files 1 passed (1)
Tests 58 passed (58)

Scope

Expected file face, and nothing wider: packages/types/src/node.ts plus its test, plus the changeset.

⚠️#14270 is untouched. Its surface is the wording of the declared-no-loadable-entry remedy formatters; this diff touches zero lines of noLoadableEntryMessage, unresolvableMessage and undeclaredMessage (git diff origin/main -- packages/types/src/node.ts | grep -c 'noLoadableEntryMessage\|unresolvableMessage\|undeclaredMessage'0). The aliased cases here assert those messages, they do not edit them.

Changeset — the fork, measured:packages/types' own files field is ["dist", "README.md", "CHANGELOG.md"], so src/node.ts ships (as dist/node.*) and the error kind an aliased install answers with is published behaviour. ⇒ a changeset is owed, and .changeset/aliased-install-host-importer.md is it (patch).

Out-of-scope findings, filed unassigned, not fixed here

Verification

Run at final HEAD 7bf2ed4080:

  • pnpm --filter '@objectstack/types^...' build — dependency closure (34/34 declaration files emitted for @objectstack/spec)
  • pnpm --filter @objectstack/types exec vitest run --maxWorkers=2 src/node.test.ts — 58/58
  • pnpm --filter @objectstack/types typechecktsc --noEmit, clean. tsc --listFilesOnly confirms the program really contains src/node.tsandsrc/node.test.ts (1 hit each), so the green covers the edited test file rather than merely the sources.
  • Gate union derived by node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack at this HEAD (never a hand-written list): 40 families, harvested with --commands so no spelling or section is dropped. All 40 were run locally, each exit code captured into a file before any pipe: 36 exit 0, 4 exit 3.

NOT MEASURED — the 4 exit-3s (PREREQUISITE NOT MET; neither a pass nor a red):check:dual-build-cjs-loads and check:type-check-debt both need the whole workspace built (85 packages have no dist/ in this worktree), scripts/check-test-completeness.mjs exited before parsing a single summary line, and scripts/pm/check-half-states.mjs needs the GitHub API census this seat cannot reach. All four are CI's to run; none of them is reported here as green.

ESLint — the full repo run, not a narrowing:pnpm lint (eslint . --no-inline-config, the whole tree, the same command CI's Lint & Repo Gates job runs) completed here with exit code 0 and no findings, so nothing about the lint result is scoped down or deferred.


🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza


Generated by Claude Code

…nly fallback
`createHostImporter`'s #14041 fallback finder verifies the one directory it
consults — `<hostRoot>/node_modules/<key>` — by matching that directory's
manifest `name` against the declared package name. An aliased install fails
that check by construction: `{ "dependencies": { "foo": "npm:bar@1" } }` puts a
manifest named `bar` at `node_modules/foo`, so the finder answered `absent` and
an ESM-only aliased package kept the pre-#14041 INSTALL wording — a
confidently-wrong remedy against an install that is already correct.
The declaration is now parsed for the name it promises. `npm:bar@1`,
`npm:@acme/x@^2` and the aliased `workspace:bar@*` name the package installed
under the key; that is the manifest name the finder expects there.
The manifest-name check itself is NOT loosened — it is what keeps the fallback
strictly tighter than the CJS resolution it backs up (#4719 from the fallback
side). What moves is the EXPECTATION, still authored by the host and still read
out of the host's own package.json. A value that is not a bare package name — a
`workspace:` range, an alias carrying a subpath — yields no expectation to move
to, so the key stays and today's refusal is kept; `link:` and `file:` name a
LOCATION rather than a package, so no name is derivable from them at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

5 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to listnot a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 1 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2packageMentionDocs.

Which tree this was computed on

This run read content/docs from 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 — the merge of head 7bf2ed4080f03ca0d02456bdb86b80f409613122 into base d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 && git checkout 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 7bf2ed4080f03ca0d02456bdb86b80f409613122 && git checkout -B drift-repro d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 && git merge --no-ff 7bf2ed4080f03ca0d02456bdb86b80f409613122
node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@github-actionsgithub-actionsBot added size/m documentation Improvements or additions to documentation tests tooling labels Sep 3, 2026
@os-trump
os-trump marked this pull request as ready for review September 3, 2026 18:56
@os-trump
os-trump added this pull request to the merge queueSep 3, 2026
Merged via the queue into main with commit 101ad2cSep 3, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14278-aliased-install-host-importer branch September 3, 2026 19:41
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An aliased install ("foo": "npm:bar@1") fails createHostImporter's manifest-name check, so an ESM-only aliased package keeps the wrong INSTALL wording

1 participant

@os-trump
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(types): find an aliased install through the host importer's ESM-only fallback - #15047

Merged
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer
Sep 3, 2026
Merged

fix(types): find an aliased install through the host importer's ESM-only fallback#15047
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14278

The defect

createHostImporter's #14041 fallback finder verifies the one directory it consults — hostRoot/node_modules/KEY — by matching that directory's manifest name against the declared package name. An aliased install fails that check by construction:

{ "dependencies": { "foo": "npm:bar@1" } }

hostRoot/node_modules/foo holds a manifest named bar, not foo. The check rejected it, the fallback answered absent, and an ESM-only aliased package therefore kept the pre-#14041 INSTALL wording — the confidently-wrong remedy that sends an operator to run pnpm install against an install that is already correct, on a declaration shape packageNameFromSpecifier's own documentation blesses.

The fix: parse the DECLARATION, never widen the check

⛔ The manifest-name check is not loosened. It is what keeps the fallback strictly tighter than the CJS resolution it backs up — the property #14041 rests on and #4719 guards — and widening it would trade a confidently-wrong remedy for a wrong LOAD, the worse direction.

What moves is the expectation, and it is still authored by the host and still read out of the host's own package.json. A new declaredManifestName(declaration) reads the declaration value for the name it promises:

declaration valueexpected manifest namewhy
^1.0.0, *, a tagthe keyno alias declared
npm:bar@1, npm:@acme/x@^2, npm:barbar / @acme/x / barnpm: values are always name[@range]
workspace:bar@*barpnpm's aliased workspace form
workspace:*, workspace:^1.2.3the keya RANGE, no name in it
link:../bar, file:../bar.tgz, a git URLthe keythey name a LOCATION, not a package
anything not parsing as a bare package namethe keyno expectation to move to ⇒ today's refusal is kept

The last three rows are the conservative half: where no name is derivable, the pre-#14278 refusal stands rather than being guessed at. packageNameFromSpecifier is the single authority on what counts as a package name, so the parse cannot drift from the declaration gate's own idea of one.

declaredCjsResolveFallback and hostInstalledPackageDir now take the HostDeclaration itself instead of a (packageName, hostRoot) pair, so the key, the root and the expected name cannot be passed out of step with each other.

Proof — red-first, and which arm fired

The tests were written and run before the implementation, on unmodified packages/types/src/node.ts:

Tests 7 failed | 51 passed (58)

Six of the seven were the new alias-RESCUE arms, and only those:

× THE CARD: an aliased ESM-only package is rescued, not reported as an INSTALL problem
× THE CARD (wording): an aliased install with no loadable entry gets the PACKAGE message
× a SCOPED key aliasing an unscoped package is rescued too
× an aliased SUBPATH resolves against the aliased package
× an alias with no version range names its target just the same
× a `workspace:` ALIAS names its target; a plain `workspace:` range does not

with the red text on the card's own case being exactly the defect:

Cannot find module 'aliased-esm': the host app DECLARES it
(dependencies: "npm:@fixture/alias-esm-only@1") but it could not be resolved.
This is an INSTALL problem, not a declaration problem …

The seventh red was not this change: the DEFAULT fallback is this package's own resolution — @objectstack/spec and nothing else failed with Failed to resolve entry for package "@objectstack/spec" — an unbuilt dependency closure in a fresh worktree. It goes green once pnpm --filter '@objectstack/types^...' build has run, and is green in the run below.

Every tightness control stayed green in the red-first run — the failure the card must not produce (an aliased red that also reddens a non-aliased control) did not occur:

  • TIGHTNESS: a NON-aliased declaration is unchanged — the key is still the expected name
  • TIGHTNESS: an alias naming one package does not license a directory holding another
  • TIGHTNESS: an alias target carrying a SUBPATH is not a package name, and is refused
  • TIGHTNESS: an alias does not reopen the hostRoot boundary
  • BOUNDARY: a link: target whose manifest names something else keeps the refusal
  • and the pre-existing the fallback trusts only a directory whose manifest NAMES the declared package, plus both TIGHTNESS cases of the createHostImporter's declared leg cannot load an ESM-only host package at all, and misreports it as a broken install #14041 block (NODE_PATH, above-hostRoot) and both traversal-span cases.

After the fix, with the dependency closure built:

Test Files 1 passed (1)
Tests 58 passed (58)

Scope

Expected file face, and nothing wider: packages/types/src/node.ts plus its test, plus the changeset.

⚠️#14270 is untouched. Its surface is the wording of the declared-no-loadable-entry remedy formatters; this diff touches zero lines of noLoadableEntryMessage, unresolvableMessage and undeclaredMessage (git diff origin/main -- packages/types/src/node.ts | grep -c 'noLoadableEntryMessage\|unresolvableMessage\|undeclaredMessage'0). The aliased cases here assert those messages, they do not edit them.

Changeset — the fork, measured:packages/types' own files field is ["dist", "README.md", "CHANGELOG.md"], so src/node.ts ships (as dist/node.*) and the error kind an aliased install answers with is published behaviour. ⇒ a changeset is owed, and .changeset/aliased-install-host-importer.md is it (patch).

Out-of-scope findings, filed unassigned, not fixed here

Verification

Run at final HEAD 7bf2ed4080:

  • pnpm --filter '@objectstack/types^...' build — dependency closure (34/34 declaration files emitted for @objectstack/spec)
  • pnpm --filter @objectstack/types exec vitest run --maxWorkers=2 src/node.test.ts — 58/58
  • pnpm --filter @objectstack/types typechecktsc --noEmit, clean. tsc --listFilesOnly confirms the program really contains src/node.tsandsrc/node.test.ts (1 hit each), so the green covers the edited test file rather than merely the sources.
  • Gate union derived by node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack at this HEAD (never a hand-written list): 40 families, harvested with --commands so no spelling or section is dropped. All 40 were run locally, each exit code captured into a file before any pipe: 36 exit 0, 4 exit 3.

NOT MEASURED — the 4 exit-3s (PREREQUISITE NOT MET; neither a pass nor a red):check:dual-build-cjs-loads and check:type-check-debt both need the whole workspace built (85 packages have no dist/ in this worktree), scripts/check-test-completeness.mjs exited before parsing a single summary line, and scripts/pm/check-half-states.mjs needs the GitHub API census this seat cannot reach. All four are CI's to run; none of them is reported here as green.

ESLint — the full repo run, not a narrowing:pnpm lint (eslint . --no-inline-config, the whole tree, the same command CI's Lint & Repo Gates job runs) completed here with exit code 0 and no findings, so nothing about the lint result is scoped down or deferred.


🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza


Generated by Claude Code

…nly fallback
`createHostImporter`'s #14041 fallback finder verifies the one directory it
consults — `<hostRoot>/node_modules/<key>` — by matching that directory's
manifest `name` against the declared package name. An aliased install fails
that check by construction: `{ "dependencies": { "foo": "npm:bar@1" } }` puts a
manifest named `bar` at `node_modules/foo`, so the finder answered `absent` and
an ESM-only aliased package kept the pre-#14041 INSTALL wording — a
confidently-wrong remedy against an install that is already correct.
The declaration is now parsed for the name it promises. `npm:bar@1`,
`npm:@acme/x@^2` and the aliased `workspace:bar@*` name the package installed
under the key; that is the manifest name the finder expects there.
The manifest-name check itself is NOT loosened — it is what keeps the fallback
strictly tighter than the CJS resolution it backs up (#4719 from the fallback
side). What moves is the EXPECTATION, still authored by the host and still read
out of the host's own package.json. A value that is not a bare package name — a
`workspace:` range, an alias carrying a subpath — yields no expectation to move
to, so the key stays and today's refusal is kept; `link:` and `file:` name a
LOCATION rather than a package, so no name is derivable from them at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

5 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to listnot a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 1 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2packageMentionDocs.

Which tree this was computed on

This run read content/docs from 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 — the merge of head 7bf2ed4080f03ca0d02456bdb86b80f409613122 into base d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 && git checkout 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 7bf2ed4080f03ca0d02456bdb86b80f409613122 && git checkout -B drift-repro d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 && git merge --no-ff 7bf2ed4080f03ca0d02456bdb86b80f409613122
node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@github-actionsgithub-actionsBot added size/m documentation Improvements or additions to documentation tests tooling labels Sep 3, 2026
@os-trump
os-trump marked this pull request as ready for review September 3, 2026 18:56
@os-trump
os-trump added this pull request to the merge queueSep 3, 2026
Merged via the queue into main with commit 101ad2cSep 3, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14278-aliased-install-host-importer branch September 3, 2026 19:41
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An aliased install ("foo": "npm:bar@1") fails createHostImporter's manifest-name check, so an ESM-only aliased package keeps the wrong INSTALL wording

1 participant

@os-trump
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length \u003e 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(types): find an aliased install through the host importer's ESM-only fallback - #15047

Merged
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer
Sep 3, 2026
Merged

fix(types): find an aliased install through the host importer's ESM-only fallback#15047
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14278

The defect

createHostImporter's #14041 fallback finder verifies the one directory it consults — hostRoot/node_modules/KEY — by matching that directory's manifest name against the declared package name. An aliased install fails that check by construction:

{ "dependencies": { "foo": "npm:bar@1" } }

hostRoot/node_modules/foo holds a manifest named bar, not foo. The check rejected it, the fallback answered absent, and an ESM-only aliased package therefore kept the pre-#14041 INSTALL wording — the confidently-wrong remedy that sends an operator to run pnpm install against an install that is already correct, on a declaration shape packageNameFromSpecifier's own documentation blesses.

The fix: parse the DECLARATION, never widen the check

⛔ The manifest-name check is not loosened. It is what keeps the fallback strictly tighter than the CJS resolution it backs up — the property #14041 rests on and #4719 guards — and widening it would trade a confidently-wrong remedy for a wrong LOAD, the worse direction.

What moves is the expectation, and it is still authored by the host and still read out of the host's own package.json. A new declaredManifestName(declaration) reads the declaration value for the name it promises:

declaration valueexpected manifest namewhy
^1.0.0, *, a tagthe keyno alias declared
npm:bar@1, npm:@acme/x@^2, npm:barbar / @acme/x / barnpm: values are always name[@range]
workspace:bar@*barpnpm's aliased workspace form
workspace:*, workspace:^1.2.3the keya RANGE, no name in it
link:../bar, file:../bar.tgz, a git URLthe keythey name a LOCATION, not a package
anything not parsing as a bare package namethe keyno expectation to move to ⇒ today's refusal is kept

The last three rows are the conservative half: where no name is derivable, the pre-#14278 refusal stands rather than being guessed at. packageNameFromSpecifier is the single authority on what counts as a package name, so the parse cannot drift from the declaration gate's own idea of one.

declaredCjsResolveFallback and hostInstalledPackageDir now take the HostDeclaration itself instead of a (packageName, hostRoot) pair, so the key, the root and the expected name cannot be passed out of step with each other.

Proof — red-first, and which arm fired

The tests were written and run before the implementation, on unmodified packages/types/src/node.ts:

Tests 7 failed | 51 passed (58)

Six of the seven were the new alias-RESCUE arms, and only those:

× THE CARD: an aliased ESM-only package is rescued, not reported as an INSTALL problem
× THE CARD (wording): an aliased install with no loadable entry gets the PACKAGE message
× a SCOPED key aliasing an unscoped package is rescued too
× an aliased SUBPATH resolves against the aliased package
× an alias with no version range names its target just the same
× a `workspace:` ALIAS names its target; a plain `workspace:` range does not

with the red text on the card's own case being exactly the defect:

Cannot find module 'aliased-esm': the host app DECLARES it
(dependencies: "npm:@fixture/alias-esm-only@1") but it could not be resolved.
This is an INSTALL problem, not a declaration problem …

The seventh red was not this change: the DEFAULT fallback is this package's own resolution — @objectstack/spec and nothing else failed with Failed to resolve entry for package "@objectstack/spec" — an unbuilt dependency closure in a fresh worktree. It goes green once pnpm --filter '@objectstack/types^...' build has run, and is green in the run below.

Every tightness control stayed green in the red-first run — the failure the card must not produce (an aliased red that also reddens a non-aliased control) did not occur:

  • TIGHTNESS: a NON-aliased declaration is unchanged — the key is still the expected name
  • TIGHTNESS: an alias naming one package does not license a directory holding another
  • TIGHTNESS: an alias target carrying a SUBPATH is not a package name, and is refused
  • TIGHTNESS: an alias does not reopen the hostRoot boundary
  • BOUNDARY: a link: target whose manifest names something else keeps the refusal
  • and the pre-existing the fallback trusts only a directory whose manifest NAMES the declared package, plus both TIGHTNESS cases of the createHostImporter's declared leg cannot load an ESM-only host package at all, and misreports it as a broken install #14041 block (NODE_PATH, above-hostRoot) and both traversal-span cases.

After the fix, with the dependency closure built:

Test Files 1 passed (1)
Tests 58 passed (58)

Scope

Expected file face, and nothing wider: packages/types/src/node.ts plus its test, plus the changeset.

⚠️#14270 is untouched. Its surface is the wording of the declared-no-loadable-entry remedy formatters; this diff touches zero lines of noLoadableEntryMessage, unresolvableMessage and undeclaredMessage (git diff origin/main -- packages/types/src/node.ts | grep -c 'noLoadableEntryMessage\|unresolvableMessage\|undeclaredMessage'0). The aliased cases here assert those messages, they do not edit them.

Changeset — the fork, measured:packages/types' own files field is ["dist", "README.md", "CHANGELOG.md"], so src/node.ts ships (as dist/node.*) and the error kind an aliased install answers with is published behaviour. ⇒ a changeset is owed, and .changeset/aliased-install-host-importer.md is it (patch).

Out-of-scope findings, filed unassigned, not fixed here

Verification

Run at final HEAD 7bf2ed4080:

  • pnpm --filter '@objectstack/types^...' build — dependency closure (34/34 declaration files emitted for @objectstack/spec)
  • pnpm --filter @objectstack/types exec vitest run --maxWorkers=2 src/node.test.ts — 58/58
  • pnpm --filter @objectstack/types typechecktsc --noEmit, clean. tsc --listFilesOnly confirms the program really contains src/node.tsandsrc/node.test.ts (1 hit each), so the green covers the edited test file rather than merely the sources.
  • Gate union derived by node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack at this HEAD (never a hand-written list): 40 families, harvested with --commands so no spelling or section is dropped. All 40 were run locally, each exit code captured into a file before any pipe: 36 exit 0, 4 exit 3.

NOT MEASURED — the 4 exit-3s (PREREQUISITE NOT MET; neither a pass nor a red):check:dual-build-cjs-loads and check:type-check-debt both need the whole workspace built (85 packages have no dist/ in this worktree), scripts/check-test-completeness.mjs exited before parsing a single summary line, and scripts/pm/check-half-states.mjs needs the GitHub API census this seat cannot reach. All four are CI's to run; none of them is reported here as green.

ESLint — the full repo run, not a narrowing:pnpm lint (eslint . --no-inline-config, the whole tree, the same command CI's Lint & Repo Gates job runs) completed here with exit code 0 and no findings, so nothing about the lint result is scoped down or deferred.


🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza


Generated by Claude Code

…nly fallback
`createHostImporter`'s #14041 fallback finder verifies the one directory it
consults — `<hostRoot>/node_modules/<key>` — by matching that directory's
manifest `name` against the declared package name. An aliased install fails
that check by construction: `{ "dependencies": { "foo": "npm:bar@1" } }` puts a
manifest named `bar` at `node_modules/foo`, so the finder answered `absent` and
an ESM-only aliased package kept the pre-#14041 INSTALL wording — a
confidently-wrong remedy against an install that is already correct.
The declaration is now parsed for the name it promises. `npm:bar@1`,
`npm:@acme/x@^2` and the aliased `workspace:bar@*` name the package installed
under the key; that is the manifest name the finder expects there.
The manifest-name check itself is NOT loosened — it is what keeps the fallback
strictly tighter than the CJS resolution it backs up (#4719 from the fallback
side). What moves is the EXPECTATION, still authored by the host and still read
out of the host's own package.json. A value that is not a bare package name — a
`workspace:` range, an alias carrying a subpath — yields no expectation to move
to, so the key stays and today's refusal is kept; `link:` and `file:` name a
LOCATION rather than a package, so no name is derivable from them at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

5 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to listnot a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 1 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2packageMentionDocs.

Which tree this was computed on

This run read content/docs from 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 — the merge of head 7bf2ed4080f03ca0d02456bdb86b80f409613122 into base d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 && git checkout 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 7bf2ed4080f03ca0d02456bdb86b80f409613122 && git checkout -B drift-repro d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 && git merge --no-ff 7bf2ed4080f03ca0d02456bdb86b80f409613122
node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@github-actionsgithub-actionsBot added size/m documentation Improvements or additions to documentation tests tooling labels Sep 3, 2026
@os-trump
os-trump marked this pull request as ready for review September 3, 2026 18:56
@os-trump
os-trump added this pull request to the merge queueSep 3, 2026
Merged via the queue into main with commit 101ad2cSep 3, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14278-aliased-install-host-importer branch September 3, 2026 19:41
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An aliased install ("foo": "npm:bar@1") fails createHostImporter's manifest-name check, so an ESM-only aliased package keeps the wrong INSTALL wording

1 participant

@os-trump
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

fix(types): find an aliased install through the host importer's ESM-only fallback - #15047

Merged
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer
Sep 3, 2026
Merged

fix(types): find an aliased install through the host importer's ESM-only fallback#15047
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14278

The defect

createHostImporter's #14041 fallback finder verifies the one directory it consults — hostRoot/node_modules/KEY — by matching that directory's manifest name against the declared package name. An aliased install fails that check by construction:

{ "dependencies": { "foo": "npm:bar@1" } }

hostRoot/node_modules/foo holds a manifest named bar, not foo. The check rejected it, the fallback answered absent, and an ESM-only aliased package therefore kept the pre-#14041 INSTALL wording — the confidently-wrong remedy that sends an operator to run pnpm install against an install that is already correct, on a declaration shape packageNameFromSpecifier's own documentation blesses.

The fix: parse the DECLARATION, never widen the check

⛔ The manifest-name check is not loosened. It is what keeps the fallback strictly tighter than the CJS resolution it backs up — the property #14041 rests on and #4719 guards — and widening it would trade a confidently-wrong remedy for a wrong LOAD, the worse direction.

What moves is the expectation, and it is still authored by the host and still read out of the host's own package.json. A new declaredManifestName(declaration) reads the declaration value for the name it promises:

declaration valueexpected manifest namewhy
^1.0.0, *, a tagthe keyno alias declared
npm:bar@1, npm:@acme/x@^2, npm:barbar / @acme/x / barnpm: values are always name[@range]
workspace:bar@*barpnpm's aliased workspace form
workspace:*, workspace:^1.2.3the keya RANGE, no name in it
link:../bar, file:../bar.tgz, a git URLthe keythey name a LOCATION, not a package
anything not parsing as a bare package namethe keyno expectation to move to ⇒ today's refusal is kept

The last three rows are the conservative half: where no name is derivable, the pre-#14278 refusal stands rather than being guessed at. packageNameFromSpecifier is the single authority on what counts as a package name, so the parse cannot drift from the declaration gate's own idea of one.

declaredCjsResolveFallback and hostInstalledPackageDir now take the HostDeclaration itself instead of a (packageName, hostRoot) pair, so the key, the root and the expected name cannot be passed out of step with each other.

Proof — red-first, and which arm fired

The tests were written and run before the implementation, on unmodified packages/types/src/node.ts:

Tests 7 failed | 51 passed (58)

Six of the seven were the new alias-RESCUE arms, and only those:

× THE CARD: an aliased ESM-only package is rescued, not reported as an INSTALL problem
× THE CARD (wording): an aliased install with no loadable entry gets the PACKAGE message
× a SCOPED key aliasing an unscoped package is rescued too
× an aliased SUBPATH resolves against the aliased package
× an alias with no version range names its target just the same
× a `workspace:` ALIAS names its target; a plain `workspace:` range does not

with the red text on the card's own case being exactly the defect:

Cannot find module 'aliased-esm': the host app DECLARES it
(dependencies: "npm:@fixture/alias-esm-only@1") but it could not be resolved.
This is an INSTALL problem, not a declaration problem …

The seventh red was not this change: the DEFAULT fallback is this package's own resolution — @objectstack/spec and nothing else failed with Failed to resolve entry for package "@objectstack/spec" — an unbuilt dependency closure in a fresh worktree. It goes green once pnpm --filter '@objectstack/types^...' build has run, and is green in the run below.

Every tightness control stayed green in the red-first run — the failure the card must not produce (an aliased red that also reddens a non-aliased control) did not occur:

  • TIGHTNESS: a NON-aliased declaration is unchanged — the key is still the expected name
  • TIGHTNESS: an alias naming one package does not license a directory holding another
  • TIGHTNESS: an alias target carrying a SUBPATH is not a package name, and is refused
  • TIGHTNESS: an alias does not reopen the hostRoot boundary
  • BOUNDARY: a link: target whose manifest names something else keeps the refusal
  • and the pre-existing the fallback trusts only a directory whose manifest NAMES the declared package, plus both TIGHTNESS cases of the createHostImporter's declared leg cannot load an ESM-only host package at all, and misreports it as a broken install #14041 block (NODE_PATH, above-hostRoot) and both traversal-span cases.

After the fix, with the dependency closure built:

Test Files 1 passed (1)
Tests 58 passed (58)

Scope

Expected file face, and nothing wider: packages/types/src/node.ts plus its test, plus the changeset.

⚠️#14270 is untouched. Its surface is the wording of the declared-no-loadable-entry remedy formatters; this diff touches zero lines of noLoadableEntryMessage, unresolvableMessage and undeclaredMessage (git diff origin/main -- packages/types/src/node.ts | grep -c 'noLoadableEntryMessage\|unresolvableMessage\|undeclaredMessage'0). The aliased cases here assert those messages, they do not edit them.

Changeset — the fork, measured:packages/types' own files field is ["dist", "README.md", "CHANGELOG.md"], so src/node.ts ships (as dist/node.*) and the error kind an aliased install answers with is published behaviour. ⇒ a changeset is owed, and .changeset/aliased-install-host-importer.md is it (patch).

Out-of-scope findings, filed unassigned, not fixed here

Verification

Run at final HEAD 7bf2ed4080:

  • pnpm --filter '@objectstack/types^...' build — dependency closure (34/34 declaration files emitted for @objectstack/spec)
  • pnpm --filter @objectstack/types exec vitest run --maxWorkers=2 src/node.test.ts — 58/58
  • pnpm --filter @objectstack/types typechecktsc --noEmit, clean. tsc --listFilesOnly confirms the program really contains src/node.tsandsrc/node.test.ts (1 hit each), so the green covers the edited test file rather than merely the sources.
  • Gate union derived by node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack at this HEAD (never a hand-written list): 40 families, harvested with --commands so no spelling or section is dropped. All 40 were run locally, each exit code captured into a file before any pipe: 36 exit 0, 4 exit 3.

NOT MEASURED — the 4 exit-3s (PREREQUISITE NOT MET; neither a pass nor a red):check:dual-build-cjs-loads and check:type-check-debt both need the whole workspace built (85 packages have no dist/ in this worktree), scripts/check-test-completeness.mjs exited before parsing a single summary line, and scripts/pm/check-half-states.mjs needs the GitHub API census this seat cannot reach. All four are CI's to run; none of them is reported here as green.

ESLint — the full repo run, not a narrowing:pnpm lint (eslint . --no-inline-config, the whole tree, the same command CI's Lint & Repo Gates job runs) completed here with exit code 0 and no findings, so nothing about the lint result is scoped down or deferred.


🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza


Generated by Claude Code

…nly fallback
`createHostImporter`'s #14041 fallback finder verifies the one directory it
consults — `<hostRoot>/node_modules/<key>` — by matching that directory's
manifest `name` against the declared package name. An aliased install fails
that check by construction: `{ "dependencies": { "foo": "npm:bar@1" } }` puts a
manifest named `bar` at `node_modules/foo`, so the finder answered `absent` and
an ESM-only aliased package kept the pre-#14041 INSTALL wording — a
confidently-wrong remedy against an install that is already correct.
The declaration is now parsed for the name it promises. `npm:bar@1`,
`npm:@acme/x@^2` and the aliased `workspace:bar@*` name the package installed
under the key; that is the manifest name the finder expects there.
The manifest-name check itself is NOT loosened — it is what keeps the fallback
strictly tighter than the CJS resolution it backs up (#4719 from the fallback
side). What moves is the EXPECTATION, still authored by the host and still read
out of the host's own package.json. A value that is not a bare package name — a
`workspace:` range, an alias carrying a subpath — yields no expectation to move
to, so the key stays and today's refusal is kept; `link:` and `file:` name a
LOCATION rather than a package, so no name is derivable from them at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

5 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to listnot a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 1 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2packageMentionDocs.

Which tree this was computed on

This run read content/docs from 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 — the merge of head 7bf2ed4080f03ca0d02456bdb86b80f409613122 into base d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 && git checkout 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 7bf2ed4080f03ca0d02456bdb86b80f409613122 && git checkout -B drift-repro d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 && git merge --no-ff 7bf2ed4080f03ca0d02456bdb86b80f409613122
node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@github-actionsgithub-actionsBot added size/m documentation Improvements or additions to documentation tests tooling labels Sep 3, 2026
@os-trump
os-trump marked this pull request as ready for review September 3, 2026 18:56
@os-trump
os-trump added this pull request to the merge queueSep 3, 2026
Merged via the queue into main with commit 101ad2cSep 3, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14278-aliased-install-host-importer branch September 3, 2026 19:41
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An aliased install ("foo": "npm:bar@1") fails createHostImporter's manifest-name check, so an ESM-only aliased package keeps the wrong INSTALL wording

1 participant

@os-trump
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(types): find an aliased install through the host importer's ESM-only fallback - #15047

Merged
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer
Sep 3, 2026
Merged

fix(types): find an aliased install through the host importer's ESM-only fallback#15047
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14278

The defect

createHostImporter's #14041 fallback finder verifies the one directory it consults — hostRoot/node_modules/KEY — by matching that directory's manifest name against the declared package name. An aliased install fails that check by construction:

{ "dependencies": { "foo": "npm:bar@1" } }

hostRoot/node_modules/foo holds a manifest named bar, not foo. The check rejected it, the fallback answered absent, and an ESM-only aliased package therefore kept the pre-#14041 INSTALL wording — the confidently-wrong remedy that sends an operator to run pnpm install against an install that is already correct, on a declaration shape packageNameFromSpecifier's own documentation blesses.

The fix: parse the DECLARATION, never widen the check

⛔ The manifest-name check is not loosened. It is what keeps the fallback strictly tighter than the CJS resolution it backs up — the property #14041 rests on and #4719 guards — and widening it would trade a confidently-wrong remedy for a wrong LOAD, the worse direction.

What moves is the expectation, and it is still authored by the host and still read out of the host's own package.json. A new declaredManifestName(declaration) reads the declaration value for the name it promises:

declaration valueexpected manifest namewhy
^1.0.0, *, a tagthe keyno alias declared
npm:bar@1, npm:@acme/x@^2, npm:barbar / @acme/x / barnpm: values are always name[@range]
workspace:bar@*barpnpm's aliased workspace form
workspace:*, workspace:^1.2.3the keya RANGE, no name in it
link:../bar, file:../bar.tgz, a git URLthe keythey name a LOCATION, not a package
anything not parsing as a bare package namethe keyno expectation to move to ⇒ today's refusal is kept

The last three rows are the conservative half: where no name is derivable, the pre-#14278 refusal stands rather than being guessed at. packageNameFromSpecifier is the single authority on what counts as a package name, so the parse cannot drift from the declaration gate's own idea of one.

declaredCjsResolveFallback and hostInstalledPackageDir now take the HostDeclaration itself instead of a (packageName, hostRoot) pair, so the key, the root and the expected name cannot be passed out of step with each other.

Proof — red-first, and which arm fired

The tests were written and run before the implementation, on unmodified packages/types/src/node.ts:

Tests 7 failed | 51 passed (58)

Six of the seven were the new alias-RESCUE arms, and only those:

× THE CARD: an aliased ESM-only package is rescued, not reported as an INSTALL problem
× THE CARD (wording): an aliased install with no loadable entry gets the PACKAGE message
× a SCOPED key aliasing an unscoped package is rescued too
× an aliased SUBPATH resolves against the aliased package
× an alias with no version range names its target just the same
× a `workspace:` ALIAS names its target; a plain `workspace:` range does not

with the red text on the card's own case being exactly the defect:

Cannot find module 'aliased-esm': the host app DECLARES it
(dependencies: "npm:@fixture/alias-esm-only@1") but it could not be resolved.
This is an INSTALL problem, not a declaration problem …

The seventh red was not this change: the DEFAULT fallback is this package's own resolution — @objectstack/spec and nothing else failed with Failed to resolve entry for package "@objectstack/spec" — an unbuilt dependency closure in a fresh worktree. It goes green once pnpm --filter '@objectstack/types^...' build has run, and is green in the run below.

Every tightness control stayed green in the red-first run — the failure the card must not produce (an aliased red that also reddens a non-aliased control) did not occur:

  • TIGHTNESS: a NON-aliased declaration is unchanged — the key is still the expected name
  • TIGHTNESS: an alias naming one package does not license a directory holding another
  • TIGHTNESS: an alias target carrying a SUBPATH is not a package name, and is refused
  • TIGHTNESS: an alias does not reopen the hostRoot boundary
  • BOUNDARY: a link: target whose manifest names something else keeps the refusal
  • and the pre-existing the fallback trusts only a directory whose manifest NAMES the declared package, plus both TIGHTNESS cases of the createHostImporter's declared leg cannot load an ESM-only host package at all, and misreports it as a broken install #14041 block (NODE_PATH, above-hostRoot) and both traversal-span cases.

After the fix, with the dependency closure built:

Test Files 1 passed (1)
Tests 58 passed (58)

Scope

Expected file face, and nothing wider: packages/types/src/node.ts plus its test, plus the changeset.

⚠️#14270 is untouched. Its surface is the wording of the declared-no-loadable-entry remedy formatters; this diff touches zero lines of noLoadableEntryMessage, unresolvableMessage and undeclaredMessage (git diff origin/main -- packages/types/src/node.ts | grep -c 'noLoadableEntryMessage\|unresolvableMessage\|undeclaredMessage'0). The aliased cases here assert those messages, they do not edit them.

Changeset — the fork, measured:packages/types' own files field is ["dist", "README.md", "CHANGELOG.md"], so src/node.ts ships (as dist/node.*) and the error kind an aliased install answers with is published behaviour. ⇒ a changeset is owed, and .changeset/aliased-install-host-importer.md is it (patch).

Out-of-scope findings, filed unassigned, not fixed here

Verification

Run at final HEAD 7bf2ed4080:

  • pnpm --filter '@objectstack/types^...' build — dependency closure (34/34 declaration files emitted for @objectstack/spec)
  • pnpm --filter @objectstack/types exec vitest run --maxWorkers=2 src/node.test.ts — 58/58
  • pnpm --filter @objectstack/types typechecktsc --noEmit, clean. tsc --listFilesOnly confirms the program really contains src/node.tsandsrc/node.test.ts (1 hit each), so the green covers the edited test file rather than merely the sources.
  • Gate union derived by node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack at this HEAD (never a hand-written list): 40 families, harvested with --commands so no spelling or section is dropped. All 40 were run locally, each exit code captured into a file before any pipe: 36 exit 0, 4 exit 3.

NOT MEASURED — the 4 exit-3s (PREREQUISITE NOT MET; neither a pass nor a red):check:dual-build-cjs-loads and check:type-check-debt both need the whole workspace built (85 packages have no dist/ in this worktree), scripts/check-test-completeness.mjs exited before parsing a single summary line, and scripts/pm/check-half-states.mjs needs the GitHub API census this seat cannot reach. All four are CI's to run; none of them is reported here as green.

ESLint — the full repo run, not a narrowing:pnpm lint (eslint . --no-inline-config, the whole tree, the same command CI's Lint & Repo Gates job runs) completed here with exit code 0 and no findings, so nothing about the lint result is scoped down or deferred.


🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza


Generated by Claude Code

…nly fallback
`createHostImporter`'s #14041 fallback finder verifies the one directory it
consults — `<hostRoot>/node_modules/<key>` — by matching that directory's
manifest `name` against the declared package name. An aliased install fails
that check by construction: `{ "dependencies": { "foo": "npm:bar@1" } }` puts a
manifest named `bar` at `node_modules/foo`, so the finder answered `absent` and
an ESM-only aliased package kept the pre-#14041 INSTALL wording — a
confidently-wrong remedy against an install that is already correct.
The declaration is now parsed for the name it promises. `npm:bar@1`,
`npm:@acme/x@^2` and the aliased `workspace:bar@*` name the package installed
under the key; that is the manifest name the finder expects there.
The manifest-name check itself is NOT loosened — it is what keeps the fallback
strictly tighter than the CJS resolution it backs up (#4719 from the fallback
side). What moves is the EXPECTATION, still authored by the host and still read
out of the host's own package.json. A value that is not a bare package name — a
`workspace:` range, an alias carrying a subpath — yields no expectation to move
to, so the key stays and today's refusal is kept; `link:` and `file:` name a
LOCATION rather than a package, so no name is derivable from them at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

5 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to listnot a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 1 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2packageMentionDocs.

Which tree this was computed on

This run read content/docs from 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 — the merge of head 7bf2ed4080f03ca0d02456bdb86b80f409613122 into base d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 && git checkout 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 7bf2ed4080f03ca0d02456bdb86b80f409613122 && git checkout -B drift-repro d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 && git merge --no-ff 7bf2ed4080f03ca0d02456bdb86b80f409613122
node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@github-actionsgithub-actionsBot added size/m documentation Improvements or additions to documentation tests tooling labels Sep 3, 2026
@os-trump
os-trump marked this pull request as ready for review September 3, 2026 18:56
@os-trump
os-trump added this pull request to the merge queueSep 3, 2026
Merged via the queue into main with commit 101ad2cSep 3, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14278-aliased-install-host-importer branch September 3, 2026 19:41
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An aliased install ("foo": "npm:bar@1") fails createHostImporter's manifest-name check, so an ESM-only aliased package keeps the wrong INSTALL wording

1 participant

@os-trump
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(types): find an aliased install through the host importer's ESM-only fallback - #15047

Merged
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer
Sep 3, 2026
Merged

fix(types): find an aliased install through the host importer's ESM-only fallback#15047
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14278

The defect

createHostImporter's #14041 fallback finder verifies the one directory it consults — hostRoot/node_modules/KEY — by matching that directory's manifest name against the declared package name. An aliased install fails that check by construction:

{ "dependencies": { "foo": "npm:bar@1" } }

hostRoot/node_modules/foo holds a manifest named bar, not foo. The check rejected it, the fallback answered absent, and an ESM-only aliased package therefore kept the pre-#14041 INSTALL wording — the confidently-wrong remedy that sends an operator to run pnpm install against an install that is already correct, on a declaration shape packageNameFromSpecifier's own documentation blesses.

The fix: parse the DECLARATION, never widen the check

⛔ The manifest-name check is not loosened. It is what keeps the fallback strictly tighter than the CJS resolution it backs up — the property #14041 rests on and #4719 guards — and widening it would trade a confidently-wrong remedy for a wrong LOAD, the worse direction.

What moves is the expectation, and it is still authored by the host and still read out of the host's own package.json. A new declaredManifestName(declaration) reads the declaration value for the name it promises:

declaration valueexpected manifest namewhy
^1.0.0, *, a tagthe keyno alias declared
npm:bar@1, npm:@acme/x@^2, npm:barbar / @acme/x / barnpm: values are always name[@range]
workspace:bar@*barpnpm's aliased workspace form
workspace:*, workspace:^1.2.3the keya RANGE, no name in it
link:../bar, file:../bar.tgz, a git URLthe keythey name a LOCATION, not a package
anything not parsing as a bare package namethe keyno expectation to move to ⇒ today's refusal is kept

The last three rows are the conservative half: where no name is derivable, the pre-#14278 refusal stands rather than being guessed at. packageNameFromSpecifier is the single authority on what counts as a package name, so the parse cannot drift from the declaration gate's own idea of one.

declaredCjsResolveFallback and hostInstalledPackageDir now take the HostDeclaration itself instead of a (packageName, hostRoot) pair, so the key, the root and the expected name cannot be passed out of step with each other.

Proof — red-first, and which arm fired

The tests were written and run before the implementation, on unmodified packages/types/src/node.ts:

Tests 7 failed | 51 passed (58)

Six of the seven were the new alias-RESCUE arms, and only those:

× THE CARD: an aliased ESM-only package is rescued, not reported as an INSTALL problem
× THE CARD (wording): an aliased install with no loadable entry gets the PACKAGE message
× a SCOPED key aliasing an unscoped package is rescued too
× an aliased SUBPATH resolves against the aliased package
× an alias with no version range names its target just the same
× a `workspace:` ALIAS names its target; a plain `workspace:` range does not

with the red text on the card's own case being exactly the defect:

Cannot find module 'aliased-esm': the host app DECLARES it
(dependencies: "npm:@fixture/alias-esm-only@1") but it could not be resolved.
This is an INSTALL problem, not a declaration problem …

The seventh red was not this change: the DEFAULT fallback is this package's own resolution — @objectstack/spec and nothing else failed with Failed to resolve entry for package "@objectstack/spec" — an unbuilt dependency closure in a fresh worktree. It goes green once pnpm --filter '@objectstack/types^...' build has run, and is green in the run below.

Every tightness control stayed green in the red-first run — the failure the card must not produce (an aliased red that also reddens a non-aliased control) did not occur:

  • TIGHTNESS: a NON-aliased declaration is unchanged — the key is still the expected name
  • TIGHTNESS: an alias naming one package does not license a directory holding another
  • TIGHTNESS: an alias target carrying a SUBPATH is not a package name, and is refused
  • TIGHTNESS: an alias does not reopen the hostRoot boundary
  • BOUNDARY: a link: target whose manifest names something else keeps the refusal
  • and the pre-existing the fallback trusts only a directory whose manifest NAMES the declared package, plus both TIGHTNESS cases of the createHostImporter's declared leg cannot load an ESM-only host package at all, and misreports it as a broken install #14041 block (NODE_PATH, above-hostRoot) and both traversal-span cases.

After the fix, with the dependency closure built:

Test Files 1 passed (1)
Tests 58 passed (58)

Scope

Expected file face, and nothing wider: packages/types/src/node.ts plus its test, plus the changeset.

⚠️#14270 is untouched. Its surface is the wording of the declared-no-loadable-entry remedy formatters; this diff touches zero lines of noLoadableEntryMessage, unresolvableMessage and undeclaredMessage (git diff origin/main -- packages/types/src/node.ts | grep -c 'noLoadableEntryMessage\|unresolvableMessage\|undeclaredMessage'0). The aliased cases here assert those messages, they do not edit them.

Changeset — the fork, measured:packages/types' own files field is ["dist", "README.md", "CHANGELOG.md"], so src/node.ts ships (as dist/node.*) and the error kind an aliased install answers with is published behaviour. ⇒ a changeset is owed, and .changeset/aliased-install-host-importer.md is it (patch).

Out-of-scope findings, filed unassigned, not fixed here

Verification

Run at final HEAD 7bf2ed4080:

  • pnpm --filter '@objectstack/types^...' build — dependency closure (34/34 declaration files emitted for @objectstack/spec)
  • pnpm --filter @objectstack/types exec vitest run --maxWorkers=2 src/node.test.ts — 58/58
  • pnpm --filter @objectstack/types typechecktsc --noEmit, clean. tsc --listFilesOnly confirms the program really contains src/node.tsandsrc/node.test.ts (1 hit each), so the green covers the edited test file rather than merely the sources.
  • Gate union derived by node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack at this HEAD (never a hand-written list): 40 families, harvested with --commands so no spelling or section is dropped. All 40 were run locally, each exit code captured into a file before any pipe: 36 exit 0, 4 exit 3.

NOT MEASURED — the 4 exit-3s (PREREQUISITE NOT MET; neither a pass nor a red):check:dual-build-cjs-loads and check:type-check-debt both need the whole workspace built (85 packages have no dist/ in this worktree), scripts/check-test-completeness.mjs exited before parsing a single summary line, and scripts/pm/check-half-states.mjs needs the GitHub API census this seat cannot reach. All four are CI's to run; none of them is reported here as green.

ESLint — the full repo run, not a narrowing:pnpm lint (eslint . --no-inline-config, the whole tree, the same command CI's Lint & Repo Gates job runs) completed here with exit code 0 and no findings, so nothing about the lint result is scoped down or deferred.


🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza


Generated by Claude Code

…nly fallback
`createHostImporter`'s #14041 fallback finder verifies the one directory it
consults — `<hostRoot>/node_modules/<key>` — by matching that directory's
manifest `name` against the declared package name. An aliased install fails
that check by construction: `{ "dependencies": { "foo": "npm:bar@1" } }` puts a
manifest named `bar` at `node_modules/foo`, so the finder answered `absent` and
an ESM-only aliased package kept the pre-#14041 INSTALL wording — a
confidently-wrong remedy against an install that is already correct.
The declaration is now parsed for the name it promises. `npm:bar@1`,
`npm:@acme/x@^2` and the aliased `workspace:bar@*` name the package installed
under the key; that is the manifest name the finder expects there.
The manifest-name check itself is NOT loosened — it is what keeps the fallback
strictly tighter than the CJS resolution it backs up (#4719 from the fallback
side). What moves is the EXPECTATION, still authored by the host and still read
out of the host's own package.json. A value that is not a bare package name — a
`workspace:` range, an alias carrying a subpath — yields no expectation to move
to, so the key stays and today's refusal is kept; `link:` and `file:` name a
LOCATION rather than a package, so no name is derivable from them at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

5 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to listnot a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 1 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2packageMentionDocs.

Which tree this was computed on

This run read content/docs from 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 — the merge of head 7bf2ed4080f03ca0d02456bdb86b80f409613122 into base d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 && git checkout 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 7bf2ed4080f03ca0d02456bdb86b80f409613122 && git checkout -B drift-repro d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 && git merge --no-ff 7bf2ed4080f03ca0d02456bdb86b80f409613122
node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@github-actionsgithub-actionsBot added size/m documentation Improvements or additions to documentation tests tooling labels Sep 3, 2026
@os-trump
os-trump marked this pull request as ready for review September 3, 2026 18:56
@os-trump
os-trump added this pull request to the merge queueSep 3, 2026
Merged via the queue into main with commit 101ad2cSep 3, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14278-aliased-install-host-importer branch September 3, 2026 19:41
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An aliased install ("foo": "npm:bar@1") fails createHostImporter's manifest-name check, so an ESM-only aliased package keeps the wrong INSTALL wording

1 participant

@os-trump
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

fix(types): find an aliased install through the host importer's ESM-only fallback - #15047

Merged
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer
Sep 3, 2026
Merged

fix(types): find an aliased install through the host importer's ESM-only fallback#15047
os-trump merged 1 commit into
mainfrom
claude/issue-14278-aliased-install-host-importer

Conversation

@os-trump

Copy link
Copy Markdown
Collaborator

Fixes#14278

The defect

createHostImporter's #14041 fallback finder verifies the one directory it consults — hostRoot/node_modules/KEY — by matching that directory's manifest name against the declared package name. An aliased install fails that check by construction:

{ "dependencies": { "foo": "npm:bar@1" } }

hostRoot/node_modules/foo holds a manifest named bar, not foo. The check rejected it, the fallback answered absent, and an ESM-only aliased package therefore kept the pre-#14041 INSTALL wording — the confidently-wrong remedy that sends an operator to run pnpm install against an install that is already correct, on a declaration shape packageNameFromSpecifier's own documentation blesses.

The fix: parse the DECLARATION, never widen the check

⛔ The manifest-name check is not loosened. It is what keeps the fallback strictly tighter than the CJS resolution it backs up — the property #14041 rests on and #4719 guards — and widening it would trade a confidently-wrong remedy for a wrong LOAD, the worse direction.

What moves is the expectation, and it is still authored by the host and still read out of the host's own package.json. A new declaredManifestName(declaration) reads the declaration value for the name it promises:

declaration valueexpected manifest namewhy
^1.0.0, *, a tagthe keyno alias declared
npm:bar@1, npm:@acme/x@^2, npm:barbar / @acme/x / barnpm: values are always name[@range]
workspace:bar@*barpnpm's aliased workspace form
workspace:*, workspace:^1.2.3the keya RANGE, no name in it
link:../bar, file:../bar.tgz, a git URLthe keythey name a LOCATION, not a package
anything not parsing as a bare package namethe keyno expectation to move to ⇒ today's refusal is kept

The last three rows are the conservative half: where no name is derivable, the pre-#14278 refusal stands rather than being guessed at. packageNameFromSpecifier is the single authority on what counts as a package name, so the parse cannot drift from the declaration gate's own idea of one.

declaredCjsResolveFallback and hostInstalledPackageDir now take the HostDeclaration itself instead of a (packageName, hostRoot) pair, so the key, the root and the expected name cannot be passed out of step with each other.

Proof — red-first, and which arm fired

The tests were written and run before the implementation, on unmodified packages/types/src/node.ts:

Tests 7 failed | 51 passed (58)

Six of the seven were the new alias-RESCUE arms, and only those:

× THE CARD: an aliased ESM-only package is rescued, not reported as an INSTALL problem
× THE CARD (wording): an aliased install with no loadable entry gets the PACKAGE message
× a SCOPED key aliasing an unscoped package is rescued too
× an aliased SUBPATH resolves against the aliased package
× an alias with no version range names its target just the same
× a `workspace:` ALIAS names its target; a plain `workspace:` range does not

with the red text on the card's own case being exactly the defect:

Cannot find module 'aliased-esm': the host app DECLARES it
(dependencies: "npm:@fixture/alias-esm-only@1") but it could not be resolved.
This is an INSTALL problem, not a declaration problem …

The seventh red was not this change: the DEFAULT fallback is this package's own resolution — @objectstack/spec and nothing else failed with Failed to resolve entry for package "@objectstack/spec" — an unbuilt dependency closure in a fresh worktree. It goes green once pnpm --filter '@objectstack/types^...' build has run, and is green in the run below.

Every tightness control stayed green in the red-first run — the failure the card must not produce (an aliased red that also reddens a non-aliased control) did not occur:

  • TIGHTNESS: a NON-aliased declaration is unchanged — the key is still the expected name
  • TIGHTNESS: an alias naming one package does not license a directory holding another
  • TIGHTNESS: an alias target carrying a SUBPATH is not a package name, and is refused
  • TIGHTNESS: an alias does not reopen the hostRoot boundary
  • BOUNDARY: a link: target whose manifest names something else keeps the refusal
  • and the pre-existing the fallback trusts only a directory whose manifest NAMES the declared package, plus both TIGHTNESS cases of the createHostImporter's declared leg cannot load an ESM-only host package at all, and misreports it as a broken install #14041 block (NODE_PATH, above-hostRoot) and both traversal-span cases.

After the fix, with the dependency closure built:

Test Files 1 passed (1)
Tests 58 passed (58)

Scope

Expected file face, and nothing wider: packages/types/src/node.ts plus its test, plus the changeset.

⚠️#14270 is untouched. Its surface is the wording of the declared-no-loadable-entry remedy formatters; this diff touches zero lines of noLoadableEntryMessage, unresolvableMessage and undeclaredMessage (git diff origin/main -- packages/types/src/node.ts | grep -c 'noLoadableEntryMessage\|unresolvableMessage\|undeclaredMessage'0). The aliased cases here assert those messages, they do not edit them.

Changeset — the fork, measured:packages/types' own files field is ["dist", "README.md", "CHANGELOG.md"], so src/node.ts ships (as dist/node.*) and the error kind an aliased install answers with is published behaviour. ⇒ a changeset is owed, and .changeset/aliased-install-host-importer.md is it (patch).

Out-of-scope findings, filed unassigned, not fixed here

Verification

Run at final HEAD 7bf2ed4080:

  • pnpm --filter '@objectstack/types^...' build — dependency closure (34/34 declaration files emitted for @objectstack/spec)
  • pnpm --filter @objectstack/types exec vitest run --maxWorkers=2 src/node.test.ts — 58/58
  • pnpm --filter @objectstack/types typechecktsc --noEmit, clean. tsc --listFilesOnly confirms the program really contains src/node.tsandsrc/node.test.ts (1 hit each), so the green covers the edited test file rather than merely the sources.
  • Gate union derived by node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack at this HEAD (never a hand-written list): 40 families, harvested with --commands so no spelling or section is dropped. All 40 were run locally, each exit code captured into a file before any pipe: 36 exit 0, 4 exit 3.

NOT MEASURED — the 4 exit-3s (PREREQUISITE NOT MET; neither a pass nor a red):check:dual-build-cjs-loads and check:type-check-debt both need the whole workspace built (85 packages have no dist/ in this worktree), scripts/check-test-completeness.mjs exited before parsing a single summary line, and scripts/pm/check-half-states.mjs needs the GitHub API census this seat cannot reach. All four are CI's to run; none of them is reported here as green.

ESLint — the full repo run, not a narrowing:pnpm lint (eslint . --no-inline-config, the whole tree, the same command CI's Lint & Repo Gates job runs) completed here with exit code 0 and no findings, so nothing about the lint result is scoped down or deferred.


🤖 Generated with Claude Code

https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza


Generated by Claude Code

…nly fallback
`createHostImporter`'s #14041 fallback finder verifies the one directory it
consults — `<hostRoot>/node_modules/<key>` — by matching that directory's
manifest `name` against the declared package name. An aliased install fails
that check by construction: `{ "dependencies": { "foo": "npm:bar@1" } }` puts a
manifest named `bar` at `node_modules/foo`, so the finder answered `absent` and
an ESM-only aliased package kept the pre-#14041 INSTALL wording — a
confidently-wrong remedy against an install that is already correct.
The declaration is now parsed for the name it promises. `npm:bar@1`,
`npm:@acme/x@^2` and the aliased `workspace:bar@*` name the package installed
under the key; that is the manifest name the finder expects there.
The manifest-name check itself is NOT loosened — it is what keeps the fallback
strictly tighter than the CJS resolution it backs up (#4719 from the fallback
side). What moves is the EXPECTATION, still authored by the host and still read
out of the host's own package.json. A value that is not a bare package name — a
`workspace:` range, an alias carrying a subpath — yields no expectation to move
to, so the key stays and today's refusal is kept; `link:` and `file:` name a
LOCATION rather than a package, so no name is derivable from them at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016yfqQh2dBgPAymYd7xipza
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

5 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to listnot a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 47 of 219 client-bound route-ledger rows — the other 172 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 172: 14 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 56 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 102 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 1 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2packageMentionDocs.

Which tree this was computed on

This run read content/docs from 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 — the merge of head 7bf2ed4080f03ca0d02456bdb86b80f409613122 into base d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9 && git checkout 05a07e1ea1fae8bd8a6cfd7856f527decd4a81d9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 7bf2ed4080f03ca0d02456bdb86b80f409613122 && git checkout -B drift-repro d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2 && git merge --no-ff 7bf2ed4080f03ca0d02456bdb86b80f409613122
node scripts/docs-audit/affected-docs.mjs --json d5b330dc6916b7ca56f4c751cc654c7aaf64bfe2

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@github-actionsgithub-actionsBot added size/m documentation Improvements or additions to documentation tests tooling labels Sep 3, 2026
@os-trump
os-trump marked this pull request as ready for review September 3, 2026 18:56
@os-trump
os-trump added this pull request to the merge queueSep 3, 2026
Merged via the queue into main with commit 101ad2cSep 3, 2026
35 checks passed
@os-trump
os-trump deleted the claude/issue-14278-aliased-install-host-importer branch September 3, 2026 19:41
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An aliased install ("foo": "npm:bar@1") fails createHostImporter's manifest-name check, so an ESM-only aliased package keeps the wrong INSTALL wording

1 participant

@os-trump