Skip to content

[finding] Two gates import their shared glob helper and their shared declaration table OUT OF a gate script, which costs check:ci-filter-parity a 595-pair derivation lead #11511

Description

@os-steve

Measured while landing #11190 step 1 (the import-following widening of scripts/pm/dispatch-gates.mjs). Filed unassigned; not fixed there — the card's scope was the derivation, not the scripts it reads.

What the sweep found

scripts/check-cross-package-test-inputs.mjs is a gate and a library. Two other gate scripts import from it:

  • scripts/check-examples-live-imports.mjs imports globToRegExp — a pure string utility;
  • scripts/check-ci-filter-parity.mjs imports CROSS_PACKAGE_TEST_INPUTS — the declaration table itself, which is genuinely that gate's population (it checks CI's filters against exactly those globs).

Since #11190, the derivation follows a gate script's first-party imports one level — but deliberately not into a module that is itself a discovered gate file. Measured reason: admitting that class takes the sweep from +893 to +4907 (gate, file) pairs, and 3065 of the difference is check:examples-live-imports inheriting the whole cross-package declaration table because it imports one string helper. The gate reads examples/; the table describes packages/**. That is a fabricated lead in the column a dispatch prompt pastes, and it is refused for the same reason #9626 and #9964 refused theirs.

The cost, and why it is worth a card

The refusal is right about the fabricated half and wrong about the honest half. check:ci-filter-parity really does read CROSS_PACKAGE_TEST_INPUTS, so it should derive for a card that edits the declaration table — and it now cannot, because the table lives in a gate. Measured: 595 (gate, file) pairs the derivation would have named.

The fix, which is the same shape as the consolidation already queued

Move the shared halves out of the gate into a plain module that no workflow invokes — the scripts/i18n-bundle-surface.mjs shape — and let both the gate and its two importers read them from there:

  • globToRegExp / matchesAny (pure predicates), and
  • CROSS_PACKAGE_TEST_INPUTS (the declaration table).

Then check:ci-filter-parity derives through the follow with no rule change, and check:examples-live-imports inherits only the helper module's population, which is nothing — the honest half restored without the fabricated half. #11510 (the enumerator consolidation) needs the same module shape for the same reason, so the two are worth doing with one design.

⚠️ Note when doing it: importing that gate for its exports used to run the whole gate as a side effect; #10610 fixed that, and any new shared module should be inert on import by the same rule check:entry-guard enforces.

Related

#11190 (the derivation change that measured this), #11510 (step 2, same module shape), #10610 (import side effect, fixed), #11199 (the adjacent double-discovery of this same gate).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions