Skip to content

[finding] measure-self-test-floor's selfTestDefs() reads RAW source, so a name written inside a fixture string counts as a definition #15574

Description

@claude

Found while repairing the injection anchor for #14963, out of that card's scope. Filed unassigned.

The reading

#14963 moved injectEarlyReturn onto masked, line-anchored source. selfTestDefs — the other half of the same question, and what main() uses to decide whether a file has ONE mechanical entry or an ambiguous set — still reads raw text:

export function selfTestDefs(src) {
  for (const m of src.matchAll(/(?:async\s+)?function\s+([A-Za-z_$][\w$]*)\s*\(/g)) {

so a function fixtureSelfTest() { written inside a fixture string is collected as a definition of that file.

Measured, over the whole census on cf6b67164

Comparing selfTestDefs(src) with selfTestDefs(maskCommentsAndLiterals(src)) for every one of the 178 rows:

scripts/pm/dispatch-gates.mjs
  ["selfTest","selfTestOnlyCallables","maskSelfTests","fixtureSelfTest"]
  -> ["selfTestOnlyCallables","maskSelfTests","selfTest"]
rows whose defs differ under masking: 1 | rows that would stop being ambiguous: 0

fixtureSelfTest is a name in a fixture array at scripts/pm/dispatch-gates.mjs:12715, not a function anything can call. The other three are real, so this row stays hand-read either way.

Why it is a finding rather than a bug today

The error direction is a phantom EXTRA name, and an extra name only ever pushes a row from a mechanical entry into ambiguous entry (...) and no ENTRY_BY_HAND row — NOT MEASURED, never a wrong measurement. On this tree it changes no verdict and no row: the one file it touches was hand-read already. What it does do is put a name that cannot be called in a diagnostic a reader is told to act on, and it leaves the two halves of "where is the definition" answered from two different texts, which is the drift #14963's repair exists to end.

⚠️ Anyone taking this should note the constraint that kept it out of #14963: defs is published in --json, so masking it changes that output, and the card required a byte-identical --json diff.

Filed from #14963.


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