Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .changeset/sideeffects-declaration-consistency-gate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
---

Test-only (objectui#3943). A repo-level gate now holds every workspace package's
`sideEffects` declaration to what its modules actually do at load time —
`scripts/__tests__/side-effects-declaration-consistency.test.ts`, in the shape
`package-files-exist.test.ts` established for `files`.

`sideEffects: false` is a promise to bundlers that no module does anything on
evaluation. When it is false, a bundler drops the module whole: 0 bytes, exit
code 0, no warning, and the failure surfaces far away as a red
`Unknown component type` panel. objectui#3899 was that defect in
`packages/layout`; PR #3940 fixed it and pinned it, but the pin only ever read
`packages/layout/package.json`, so the next package to repeat it would turn
nothing red.

The gate checks both directions — a `false` package must have no load-time side
effect anywhere in its barrel's reachable module graph, and every entry in a
`sideEffects` array must name a real module form that really does have one. Entry
forms are derived from `main`/`module`/`exports` **and** from the in-repo bundler
alias tables, because a package aliased at its `src` is bundled through the same
manifest (PR #3940 measured a 0-byte console bundle with only the `dist/*` paths
declared). Every probe runs against a real bundler and carries its
`sideEffects: false` control, so a bundler that stopped honouring the field fails
loudly instead of leaving the gate green over nothing.

`packages/layout/src/__tests__/side-effects-manifest.test.ts` is converged into
the new gate: everything in it is now derived for all packages, except the
assertion that layout's actual registry keys survive a side-effect-only import,
which is carried over as the gate's named specimen.

No published behaviour changes — no package's runtime source was touched.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* by `guide-layout-sidebar-nav-doc.test.ts` (objectui#4840);
* - `src/index.ts` itself — the keys' existence — held by
* `app-shell-not-a-component-key.test.tsx` (objectui#4841, one key) and
* `side-effects-manifest.test.ts` (a count FLOOR, not a census);
* the repo-level `scripts/__tests__/side-effects-declaration-consistency.test.ts`
* (a count FLOOR, not a census — objectui#3943 converged the former
* `side-effects-manifest.test.ts` into it);
* - this README's `## Registration` paragraph — nothing.
*
* The asymmetry was measured, not theorised. objectui#4841 deregistered
Expand Down Expand Up @@ -89,7 +91,8 @@
* The reader below is this repo's fourth copy of the same three-line
* `ComponentRegistry.register` regex (the others are in
* `guide-layout-sidebar-nav-doc.test.ts`, `app-shell-not-a-component-key.test.tsx`
* and `side-effects-manifest.test.ts`). Extracting a shared helper is raised as a
* and `scripts/__tests__/side-effects-declaration-consistency.test.ts`).
* Extracting a shared helper is raised as a
* side option on objectui#4860 and is deliberately NOT taken here: it would edit
* three pin files to serve one, and each of those files is self-contained on
* purpose — a pin that imports its own reader from a shared module can be
Expand Down
Loading
Loading