Skip to content

finding: check:system-context-census dies with a raw ERR_MODULE_NOT_FOUND stack in a fresh worktree instead of reporting an unmet prerequisite — #11557's class at an unconverted site #15783

Description

@claude

Measured while implementing #15722 (PR pending), in a fresh worktree with pnpm install never run — the checkout shape CLAUDE.md mandates. Filed unassigned, out of that card's scope: #15722 fixes the CALLER (scripts/check-regen-pending.mjs now grades a gate that could not load), this is the gate itself.

What happens

$ pnpm -s check:system-context-census
node:internal/modules/package_json_reader:314
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'typescript' imported from
  /home/user/objectstack-15722-nodeps/scripts/isystem-census.mjs
    ... 8 more frames of node internals ...
exit 1

Exactly #11557's shape, at a site PR #11824 did not convert. The chain is
scripts/check-system-context-census.mjsscripts/isystem-census.mjs, whose line 78 is a bare top-level import ts from 'typescript'. node links the whole module graph before any body runs, so the gate cannot preflight its own missing dependency — #11824's answer to that is the deferred thunk (requireDefaultExport('typescript', () => import('typescript'), import.meta.url, { measures: … })), written in the importing module.

Positive control, same tree, same run

Its sibling check:platform-object-tenancy-census — same repo root, also node scripts/…, also reaching typescript — answers correctly on that identical tree, because its dependency IS thunked:

$ pnpm -s check:platform-object-tenancy-census ; echo EXIT=$?
ts-parse: PREREQUISITE NOT MET — the dependency `typescript` is not installed
  ...
EXIT=3

So this is not "the tree is uninstalled, nothing can answer" — the honest answer is reachable here and is not being given.

Why it is worth a card on its own

#15722's fix means the pre-push regen check now reads this failure correctly at the process boundary. A person running the gate directly still gets the node-internals stack, and exit 1 — indistinguishable from a real finding about content/docs/permissions/system-context.mdx. That is the reading #11557 and #7681 both closed elsewhere: an unmet prerequisite reported as a verdict about content.

Not asserted

No claim that isystem-census.mjs is the only unconverted importer. The population is derivable rather than recalled — a bare specifier in a scripts/ module that import-prerequisite.mjs does not wrap — and that sweep is not run here. scripts/ts-parse.mjs (which isystem-census.mjs also imports) is already converted, which is why the fix is likely one import.

Re-check

  • git grep -n "^import ts from 'typescript'" -- scripts (control: git grep -ln "requireDefaultExport" -- scripts returns the converted set).
  • In a worktree with no node_modules: pnpm -s check:system-context-census > /tmp/g.log 2>&1; echo EXIT=$? — capture BEFORE any pipe.

Related

#11557 (the class) · PR #11824 (the landed fix and its four-way classification) · #7681 (same reading, check-i18n-bundles) · #15722 (the caller-side grading, where this was measured)


Generated by Claude Code


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions