Skip to content

[finding] A SINGLE-SEGMENT module-relative literal still contributes no watch hint — measured at 2062 true pairs on two live spec builders #12470

Description

@yinlianghui

Found while implementing #12371 (producer-side resolve of module-relative watch-hint literals). Recorded, not proposed — no PR, no queue label.

What the #12371 fix deliberately did NOT take

#12371 makes extractWatchHints resolve a module-relative literal against the writing script's own directory instead of stripping the prefix. Admission was left exactly where it was: the looksPathy test still reads the literal as the author wrote it, minus the depth prefix, so a literal that is one segment after the strip is still no hint at all.

That is the right call for './invoked-as.mjs' and './package.json' — admitting those hands every gate its own import specifiers as a watched population, a second and unpriced answer to the question firstPartyImportTargets already owns, with the wrong provenance label (gate source where the import channel says gate source via <mod>). It was measured: widening admission to the resolved form put a path population on two gates that carry the no-path-population marker, and broke the --self-test invariant that a --self-test family inherits nothing.

But the same refusal also drops two literals that are unambiguously real subtree declarations:

packages/spec/scripts/build-docs.ts:61 const SRC_DIR = path.resolve(__dirname, '../src');
packages/spec/scripts/build-skill-references.ts:35 const SPEC_SRC = path.resolve(__dirname, '../src');

Both scripts really do walk packages/spec/src. After the resolve those literals would name it exactly.

The reading (this tree, 176 families x 6899 tracked files, driven through hintCovers)

pairs
packages/spec/src reached from build-docs.ts1031
packages/spec/src reached from build-skill-references.ts1031
total not taken2062

For contrast, the #12371 change as landed is +749 pairs, 1 lost, 0 re-attributed.

Why it is not simply "do it"

The naive widening (admit on the resolved form) was measured in the same session and costs the three structural breakages above. A card here would have to find the narrower predicate that separates "a single-segment literal that resolves to a real tracked DIRECTORY" from "a single-segment sibling module or manifest name" — and price it, since the firstPartyImportTargets docblock's pricing discipline applies to any MATCHED-column widening.

Note that hintCovers' own docblock already refuses the neighbouring class (a bare top-level word, +139084 pairs) and refuses a bare root FILE literal on provenance. Whether this class sits with them or apart from them is the judgement the card would owe.

Refs: #12371 (the producer fix, A) · #12299 (the residue repair, B)

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions