You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Commit af5e292
Browse filesBrowse the repository at this point in the historyBrowse files
fix(react): make the published entry loadable by Node's own ESM resolver, and gate it (#5218)
* fix(react,types,core,i18n): explicit extensions so plain Node ESM can load the built entry
`packages/react/dist/index.js` re-exported through extensionless relative
specifiers (`./SchemaRenderer`, `./hooks`, ...). Node's ESM resolver does not
extension-search relative specifiers, so importing the published entry under
plain Node failed with ERR_MODULE_NOT_FOUND.
`tsc` never rewrites import specifiers, so the defect is in the source, not in
a build setting: the root tsconfig's `moduleResolution: "bundler"` permits the
extensionless form and bare `tsc` copies it straight into dist.
- packages/react: 92 specifiers extensioned; tsconfig pinned to
module/moduleResolution `nodenext` so a missing extension is a compile error
(TS2835) rather than a review item.
- packages/types, core, i18n: 163 specifiers extensioned. These are react's
dependency closure — react's own entry stayed unloadable until they were
fixed too, because evaluation crosses into them.
* test(scripts): gate that published ESM packages load under plain Node
Two legs, because neither is honest alone (objectui#4538):
- `pnpm check:esm-specifiers` reads SOURCES and needs no build, so it runs per
pull request in ci.yml's Type Check job. For a package whose build preserves
specifiers (a bare emitting `tsc`), the emitted specifier IS the source
specifier, so the defect is judgeable without building anything.
- `pnpm check:node-esm-load` builds every published package and actually
`import()`s each entry in a child node. Wired to a nightly workflow, not to
pull requests, for the reason published-dist-gate.yml records: this repo has
no per-PR full-repo build.
The load leg EVALUATES rather than resolves, which is the card's measured
point: plugin-charts' own entry resolves fine and the tree was still broken.
A missing module is attributed to the package that OWNS it, so the four plugins
failing on packages/mobile/dist/useBreakpoint produce one finding against
@object-ui/mobile rather than four against innocent importers.
Seven packages still carry the defect and are ledgered with a reason each;
two of them were held by other sessions. The ledger is a ratchet — an entry
whose package is now clean is itself a failure.
* chore(scripts): point the SPECIFIER_DEBT ledger at objectui#5214
Each entry now names the card that clears it, and the three that block other
packages say how many — mobile blocks 6, permissions 4, providers 2. A ledger
entry whose reason is just "follow-up" tells the next reader nothing about
whether it is worth picking up.
---------
Co-authored-by: Claude <noreply@anthropic.com>
|`published-dist-gate.yml`| Published Dist Tooling Scan | Nightly cron `41 3 * * *`; push to `main` touching the gate; manual | No — the blocking copy runs on the publish path, not here |
47
+
|`node-esm-load-gate.yml`| Node ESM Load Scan | Nightly cron `17 4 * * *`; push to `main` touching the gate; manual | No — the per-PR half is `pnpm check:esm-specifiers` in **Type Check**|
47
48
48
49
The path filters explain most "why did nothing run on my PR?" questions:
49
50
@@ -172,7 +173,7 @@ it green — which is how two of `type-check`'s gates came to be missing from th
172
173
| Job key | Appears as | What it runs | When |
173
174
|---|---|---|---|
174
175
|`changeset-check`| Changeset Fixed Group Check |`scripts/check-changeset-fixed.mjs` — every workspace package must be in the changeset `fixed` group or explicitly ignored. It checks group *membership*; it does **not** check whether the PR added a changeset. | Every run |
175
-
| `type-check` | Type Check | `scripts/check-type-check-coverage.mjs`, then `pnpm check:phantom-deps`, then `pnpm check:self-import`, then `pnpm check:spec-symbols`, then `pnpm check:action-forward-parity`, then `pnpm check:i18n-keys`, then `pnpm check:i18n-drift`, then `pnpm type-check:scripts`, then `pnpm type-check`, then `pnpm type-check:vitest-setup`. The coverage guard runs first because turbo silently skips packages that have no `type-check` script, so a package without one would otherwise read as passing (#2911). `pnpm check:phantom-deps` fails when a released package imports a bare specifier its own `package.json` does not declare — a *phantom dependency*, invisible locally because the workspace root's `devDependencies` sit on the upward resolution path from every package directory and on no consumer's, so `require.resolve('react', { paths: ['packages/core/src'] })` succeeds while `@object-ui/core` declares react in no field at all ([#4394](https://github.com/objectstack-ai/objectui/issues/4394)). `pnpm check:self-import` runs next because it reuses that gate's parser: it fails when a file inside a package names its OWN package, a specifier that resolves through the package's `exports` map to `dist/` while `type-check` waits on `^build` — the *dependencies'* builds, never the package's own — so on a cold cache the declarations do not exist yet and the file fails with `TS2307`. Locally it is always green, because every local workflow builds before it type-checks and leaves a `dist/` behind; PR #4789's first run was red on exactly one such line ([#4801](https://github.com/objectstack-ai/objectui/issues/4801)). `pnpm check:action-forward-parity` fails when an action renderer's forward whitelist drops a key the action runtime reads — the class that shipped six times one key at a time, each time green, because the key parses and publishes while the payload is dropped one hop before the runner ([#4050](https://github.com/objectstack-ai/objectui/issues/4050)). The two locale gates sit in the middle because both parse the sources with `typescript`: they need the install and nothing built. `pnpm check:i18n-keys` fails when a `t()` call site asks for a key the `en` pack does not define ([#3530](https://github.com/objectstack-ai/objectui/issues/3530)); `pnpm check:i18n-drift` fails when a change to an `en` string is not accompanied by the nine translation packs ([#3650](https://github.com/objectstack-ai/objectui/issues/3650)), and it is why this job's checkout sets `fetch-depth: 0` — it diffs against the merge base, which a depth-1 clone cannot resolve. `pnpm type-check:scripts` (`tsconfig.scripts.json`) covers `scripts/**/*.ts`, which `pnpm type-check` cannot reach at all — `scripts/` has no package.json, so turbo never walks it, and the coverage guard decides coverage per *package*. Until [#3494](https://github.com/objectstack-ai/objectui/issues/3494) that left the pin tests in `scripts/__tests__/` — including the one pinning this very page — compiled by nothing. `pnpm type-check:vitest-setup` (`tsconfig.vitest-setup.json`) closes the same gap for the four repo-root `vitest.setup.*` files, uncovered until [#3515](https://github.com/objectstack-ai/objectui/issues/3515); it runs *last*, after `pnpm type-check`, because `vitest.setup.dom.tsx` side-effect-imports four `@object-ui/*` packages and resolves them through the declarations that turbo's `^build` produces. | Every run; on a PR the steps short-circuit when only ignored paths changed |
176
+
| `type-check` | Type Check | `scripts/check-type-check-coverage.mjs`, then `pnpm check:phantom-deps`, then `pnpm check:self-import`, then `pnpm check:esm-specifiers`, then `pnpm check:spec-symbols`, then `pnpm check:action-forward-parity`, then `pnpm check:i18n-keys`, then `pnpm check:i18n-drift`, then `pnpm type-check:scripts`, then `pnpm type-check`, then `pnpm type-check:vitest-setup`. The coverage guard runs first because turbo silently skips packages that have no `type-check` script, so a package without one would otherwise read as passing (#2911). `pnpm check:phantom-deps` fails when a released package imports a bare specifier its own `package.json` does not declare — a *phantom dependency*, invisible locally because the workspace root's `devDependencies` sit on the upward resolution path from every package directory and on no consumer's, so `require.resolve('react', { paths: ['packages/core/src'] })` succeeds while `@object-ui/core` declares react in no field at all ([#4394](https://github.com/objectstack-ai/objectui/issues/4394)). `pnpm check:self-import` runs next because it reuses that gate's parser: it fails when a file inside a package names its OWN package, a specifier that resolves through the package's `exports` map to `dist/` while `type-check` waits on `^build` — the *dependencies'* builds, never the package's own — so on a cold cache the declarations do not exist yet and the file fails with `TS2307`. Locally it is always green, because every local workflow builds before it type-checks and leaves a `dist/` behind; PR #4789's first run was red on exactly one such line ([#4801](https://github.com/objectstack-ai/objectui/issues/4801)). `pnpm check:esm-specifiers` follows it for the same reason — sources only, no build: it fails when a published package whose build preserves import specifiers (a bare emitting `tsc`, which never rewrites them) writes a relative specifier with no file extension. Node's ESM resolver does not extension-search relative specifiers, so such a specifier makes the published entry unloadable outside a bundler; `@object-ui/react`'s entry died with `ERR_MODULE_NOT_FOUND` while every bundler-based consumer, the whole test suite and CI stayed green ([#4538](https://github.com/objectstack-ai/objectui/issues/4538)). The half that actually *imports* each built entry needs a full build and runs in `node-esm-load-gate.yml`. `pnpm check:action-forward-parity` fails when an action renderer's forward whitelist drops a key the action runtime reads — the class that shipped six times one key at a time, each time green, because the key parses and publishes while the payload is dropped one hop before the runner ([#4050](https://github.com/objectstack-ai/objectui/issues/4050)). The two locale gates sit in the middle because both parse the sources with `typescript`: they need the install and nothing built. `pnpm check:i18n-keys` fails when a `t()` call site asks for a key the `en` pack does not define ([#3530](https://github.com/objectstack-ai/objectui/issues/3530)); `pnpm check:i18n-drift` fails when a change to an `en` string is not accompanied by the nine translation packs ([#3650](https://github.com/objectstack-ai/objectui/issues/3650)), and it is why this job's checkout sets `fetch-depth: 0` — it diffs against the merge base, which a depth-1 clone cannot resolve. `pnpm type-check:scripts` (`tsconfig.scripts.json`) covers `scripts/**/*.ts`, which `pnpm type-check` cannot reach at all — `scripts/` has no package.json, so turbo never walks it, and the coverage guard decides coverage per *package*. Until [#3494](https://github.com/objectstack-ai/objectui/issues/3494) that left the pin tests in `scripts/__tests__/` — including the one pinning this very page — compiled by nothing. `pnpm type-check:vitest-setup` (`tsconfig.vitest-setup.json`) closes the same gap for the four repo-root `vitest.setup.*` files, uncovered until [#3515](https://github.com/objectstack-ai/objectui/issues/3515); it runs *last*, after `pnpm type-check`, because `vitest.setup.dom.tsx` side-effect-imports four `@object-ui/*` packages and resolves them through the declarations that turbo's `^build` produces. | Every run; on a PR the steps short-circuit when only ignored paths changed |
176
177
|`test`| Test (shard N/4) |`pnpm test --shard=N/4` across a 4-runner matrix with `fail-fast: false`, so every shard reports its own failures. No coverage instrumentation — v8 adds 40–100% overhead. | Pull requests and merge-queue builds (everything but `push`); steps short-circuit on a PR that changed only ignored paths |
177
178
|`test-coverage`| Test (coverage) | One unsharded `pnpm test:coverage`, uploaded to Codecov. Nothing blocks on it, which is why it is not sharded. |**Push only**|
178
179
|`e2e`| Build & E2E | Builds the console with `vite build` (`VITE_BASE_PATH=/console/`), verifies the artifact, then `pnpm test:e2e --project=chromium`. Uploads the Playwright report on failure. | Every run; on a PR the steps short-circuit when only ignored paths changed |
@@ -744,6 +745,44 @@ Three things about it are easy to get wrong and are written down in the script's
744
745
Check** gets only the dependency closure from turbo's `dependsOn: ["^build"]`, so leaf packages
745
746
are never built there. The blocking copy runs on the publish path instead — see below.
746
747
748
+
### Node ESM Load Gate (`node-esm-load-gate.yml`)
749
+
750
+
**Trigger:** Nightly cron `17 4 * * *`; push to `main` that touches the gate script or this
751
+
workflow; manual. **It carries no `pull_request` trigger, on purpose.**
752
+
753
+
Every published ESM package must be importable by Node's own resolver — no bundler, no loader
754
+
hooks. The gate is `scripts/check-node-esm-load.mjs` and it has two legs, only one of which runs
755
+
here:
756
+
757
+
-**The specifier leg** (`pnpm check:esm-specifiers`) reads *sources* and needs no build, so it
758
+
runs per pull request in **Type Check**, not in this workflow. It is the ratchet: for a package
759
+
whose build preserves import specifiers, the emitted specifier *is* the source specifier,
760
+
because `tsc` never rewrites them.
761
+
-**The load leg** (`pnpm check:node-esm-load`) builds every published package and then actually
762
+
`import()`s each entry in a child `node`. That is what runs here, and it needs the full build
763
+
this repository has no per-PR copy of — the same trade `published-dist-gate.yml` records above.
0 commit comments