Commit eb717a1
fix(pm): follow a final-segment basename glob, and stop the residue naming a move that never happened (#13783)
`collapseHint` collapses a glob by deleting it. That is a sound reduction when
nothing but glob characters follow (`packages/**` -> `packages`), and a SPLICE
when a literal does: `.changeset/*.md` -> `.changeset/.md`, a path no tree can
hold. So the hint matched nothing BY CONSTRUCTION while reading as an ordinary
literal, against 548 tracked changesets. `zeroSegmentForms` recorded this exact
species one branch over and left it; it is the same defect, splicing inside a
segment rather than across a separator.
The second half is why it was worth a card. `deepestTrackedPrefix`,
`unreachableClass` and `unreachableReason` all reasoned from `collapseHint`
UNCONDITIONALLY, including for the hints `hintCovers` had already stopped
judging that way. A pattern-judged hint can never equal its own collapsed splice
(`.changeset` is not `.changeset/.md`), so "the tree stops at X; the layout
moved under it" was the only reachable sentence for the whole shape class -- a
specific wrong cause, printed under the heading that tells a reader to go chase
it. Repairing the matcher alone would have retired today's five instances and
left the derivation that mints them intact.
- `globCarriesLiteralSuffix` -- a `*` in the final segment with a literal behind
it. A literal in FRONT of the glob is not this case.
- `judgedAsPattern` -- the two splice shapes as one question, because two call
sites need the same answer and a second copy of it is the drift this file
refuses everywhere else.
- `comparedForm` -- the form `hintCovers` ACTUALLY judged the hint by. The three
reason branches now mean what they say for both comparison modes.
Measured at 4301f78 over 191 families x 749 distinct hints x 7588 tracked
files: one hint in the whole fleet carries the shape; (hint, file) pairs
35275 -> 35823 and (gate, file) pairs 140716 -> 143456, ZERO lost; residue notes
asserting a layout move for it 5 -> 0. ZERO cards gain a family and zero lose
one -- all five owners also declare the bare `.changeset`, so the brief was
already naming them through the sibling literal. 548 (family, card) pairs
re-attribute to a more precise key in the one owner that spells the glob first.
`?`, `+` and character classes are deliberately NOT admitted (zero live
instances) and the self-test reds on their arrival.
Claude-Session: https://claude.ai/code/session_01Pk26oZ12t5N1hwGW1m1MgC
Co-authored-by: Claude <noreply@anthropic.com>1 parent e5461ba commit eb717a1
1 file changed
Lines changed: 289 additions & 21 deletions
0 commit comments