Skip to content

[finding] dispatch-gates' self-test harness t takes two arguments, but six call sites pass a third — every one of those cases' diagnostic readings is silently dropped #15539

Description

@claude

Found while implementing #15501 / #15510 (PR #15538), in a part of the file neither card touches. Filed unlabeled for triage.

The defect

selfTest() in scripts/pm/dispatch-gates.mjs builds its case harness with arity TWO:

const t = (name, cond) => {
  cases.push([name, cond]);
  console.log(`  ${cond ? '\u2713' : '\u2717'} ${name}`);
};

Six call sites pass a THIRD argument carrying the case's diagnostic reading, and JavaScript drops it on the floor. Measured on the tree at 4cfa319a7:

scripts/pm/dispatch-gates.mjs:14147   JSON.stringify({ verdict: verdict?.verdict, hints: entry?.hints })
scripts/pm/dispatch-gates.mjs:14177   JSON.stringify({ before: ..., after: ..., residual })
scripts/pm/dispatch-gates.mjs:14282   JSON.stringify({ hints: publishedFiles?.hints })
scripts/pm/dispatch-gates.mjs:14287   JSON.stringify({ verdict: ... })
scripts/pm/dispatch-gates.mjs:14297   JSON.stringify({ ... })
scripts/pm/dispatch-gates.mjs:14422   JSON.stringify(extlessRoster)

(The other JSON.stringify occurrences nearby sit inside a CONDITION or inside the case NAME and are fine.)

Why it is not cosmetic

Every one of the six is on a case whose verdict is a verdict about the LIVE tree — the scripts/** blind-spot pins, check:published-files, the extensionless roster. The third argument is the reading that tells whoever reads a red WHICH half moved: the hint count before and after an ablation, the residual verdict, the roster contents. Confirmed dropped, on a real run of the gate:

  ✓ check:entry-guard is MATCHED for a brand-new scripts/ file, not silent and not unreachable

The { verdict, hints } object that call site passes appears nowhere on the line, and would appear nowhere on the failing line either. So the day one of those cases goes red, the person triaging it gets the sentence and nothing else — and the author had already written the diagnostic they would need.

It is also the shape this file argues against elsewhere in its own prose: a claim that reads as measured and is not. Nothing reds, pnpm lint is green over it (eslint . --no-inline-config, exit 0), and check:pm-dispatch-gates passes 1415 cases with the readings silently absent from all six.

Repair directions (not a prescription)

Either way the arity and the call sites should agree, and a guard against them silently disagreeing again is worth a thought since neither lint nor the self-test can see it today.

Related: #15501, #15510, PR #15538.


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