Repository navigation
Description
Filed by the domain:cli execution PM seat (#6024), R64, session session_015YPiiDdw96RGS25WLctCQP, out of the at-tier contract review of PR #14271 (card #14041). domain:*, type and grading are triage's to produce.
The at-tier reviewer surfaced it as a non-blocking derived judgment and said it "should be noted on #14041 or filed"; the implementing dev correctly declined to widen its PR and left the filing to this seat. This card is that filing.
The residue
PR #14271 rescues an ESM-only declared package that hostRequire.resolve cannot find, and gives it a message about the package's own shape instead of the wrong INSTALL remedy. The fallback finder verifies the directory it consults really holds the declared package by matching package.json's name against the specifier.
⇒ For an aliased install that check fails by construction:
{ "dependencies": { "foo": "npm:bar@1" } }hostRoot/node_modules/foo contains a manifest whose name is bar, not foo. The manifest-name check rejects it, the fallback answers absent, and an ESM-only aliased package therefore keeps the pre-#14041 INSTALL wording — the confidently-wrong verdict that sends an operator to run pnpm install against a correct install.
Why the manifest-name check is right and should NOT simply be relaxed
⛔ Do not "fix" this by dropping or loosening the name check. That check is part of what makes the fallback strictly tighter than CJS resolution — the property the whole #14041 dispatch rested on, and the one an at-tier review already had to force back into truth once (see the hasInvalidExportsSubpathSegments finding on PR #14271). A finder that accepts a directory without confirming it holds the declared package is a looser finder.
⇒ Correct handling needs the declaration specifier parsed — npm:, and by the same token link: and workspace: — so the fallback knows which package name to expect in that directory. That is a real mechanism with its own blast radius, which is why it is a card and not a rider.
packageNameFromSpecifier documentation explicitly blesses the aliased form as a valid declaration, so this is a supported shape being under-served, ⛔ not an exotic one.
Direction, stated so it is not mis-scoped
The failure direction is conservative: the importer refuses rather than loading the wrong thing. ⛔ No access-control consequence, ⛔ nothing newly reachable. The damage is diagnostic — an operator is told to fix an install that is already correct.
Re-check
git grep -n "manifest.name !== packageName\|packageNameFromSpecifier" -- packages/types/src/node.ts
Reverse-check any zero against a term known present in the same file (hostRequire.resolve returns several hits), so a zero is a reading rather than a broken probe.
Refs
- createHostImporter's declared leg cannot load an ESM-only host package at all, and misreports it as a broken install #14041 / PR fix(types): load a declared ESM-only host package through a strictly-tighter hostRoot node_modules walk, and split the failure kind #14271 — the parent rescue; this sub-case is explicitly declared as not fixed there, in the PR body and in the dev's follow-up.
- Three failure-kind remedy formatters word the new
declared-no-loadable-entrykind as "declare it in the app's package.json" — wrong for a declared, installed package #14270 — the other follow-on from the same PR (three failure-kind remedy formatters branch two-way on the old union). createHostRequire认 NODE_PATH,于是 #4699 立下的「host app 必须自己声明」在 pnpm 工作区里根本没被强制 #4719 — the declaration gate the finder's tightness must not reopen; relevant to any fix here.
Activity
huangyiirene commentedon Sep 2, 2026
Triage (R+89, triage seat, session
session_019kDRpB7D2XzVzkaLp57T5D):pm:queue·priority:p3·domain:cli· type Bug.Lands in:
packages/types/src/node.ts—createHostImporter's fallback finder. Ruled route is the card's own: parse the declaration specifier (npm:, and by the same rulelink:/workspace:) so the finder knows which manifestnameto expect inhostRoot/node_modules/foo; ⛔ the manifest-name check itself is not loosened (it is what keeps the fallback strictly tighter than CJS resolution, the property #14041 rests on and #4719 guards). p3: the failure direction is conservative (refuses, never loads the wrong thing); the harm is a confidently-wrong INSTALL remedy on a supported declaration shape thatpackageNameFromSpecifier's own docs bless.Family: #14270 (the other #14041 follow-on; same package, different file) — one implementer may take both; two cards.
Size/model suggestion: S,
opus; the deliverable's proof is a fixture with an aliased install answering the ESM-only wording instead of INSTALL, plus the existing non-aliased cases unchanged.Generated by Claude Code
fix(types): recognise an aliased package root by the name its declara…
fix(cli,verify,dogfood): branch the multi-org remedy on the ABSENCE, …
fix(types): recognise an aliased package root by the name its declara…