Skip to content

[finding] dispatch-gates' export { maskComments } is swallowed by an unterminated block comment — the docblock claims a re-export the module does not have #9640

Description

@os-steve

Noticed while measuring the hint scan for #9626 (PR #9639). Not fixed there: different defect class, and the correct shape is a judgment call rather than mechanical.

What happens

scripts/pm/dispatch-gates.mjs line 483 opens a block comment that is never closed before the statement it introduces:

483: /**
484: * The comment/literal scanner used to live here. It now lives in
...
501: * Re-exported because this tool's self-test drives the SAME masker the gates
502: * run, not a copy of it.
503: export { maskComments };

There is no closing delimiter between line 502 and line 503, so export { maskComments }; is comment text. The block runs on until the next closing delimiter, which belongs to the docblock of SELF_TEST_DECL below it — that constant and everything after it are fine, so the file parses and nothing is red.

Measured:

maskComments exported? undefined
maskSelfTests exported? function

Why it is worth recording

The docblock states the reason the re-export exists — "Re-exported because this tool's self-test drives the SAME masker the gates run, not a copy of it" — and that reason is exactly the drift this file's whole contract is written against (scripts/js-comment-mask.mjs's header records five gates that each grew a private copy of this judgment and got it wrong two different ways). The header says the guarantee is in place; the module does not provide it.

Dormant today, in one specific sense only: nothing currently imports maskCommentsfrom dispatch-gates. Every live consumer imports it straight from scripts/js-comment-mask.mjs (check-dispatcher-error-vocabulary, check-platform-checklist, check-examples-live-imports, docs-audit/affected-docs, check-org-identifier, check-error-code-casing, check-error-status-conformance), and dispatch-gates' own internal use works because it imports the symbol at line 134. So the failure surfaces only when someone follows the docblock and writes import { maskComments } from './dispatch-gates.mjs' — which fails as undefined is not a function at call time, not at import.

Shapes

  1. Close the comment before line 503 and keep the re-export. Restores what the docblock promises; costs one delimiter.
  2. Delete both the re-export line and the paragraph promising it, and let consumers import from js-comment-mask.mjs — which is what every consumer already does, and arguably the better direction, since a re-export through a 3000-line CLI is a longer path to the same function.

Triage's call which. Note that maskSelfTests next door IS a real export function, so whichever way this goes, the two neighbours should stop looking symmetric when they are not.

A guard would have caught it

The class is "a statement that reads as code but is inside a comment". Nothing in the tree looks for it. Whether that is worth a gate is a separate question from this one-line repair; recording it here rather than assuming.

Filed unassigned, no pm:queue — an observation, triage's call.


Generated by Claude Code

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions