fix(lint): consolidate did-you-mean suggestion helpers into object-graph's shared nearestName - #14575
Conversation
…nt-suggest-consolidation
…nt-suggest-consolidation
📓 Docs Drift CheckThis PR changes 1 package(s): ⛔ 2 release-owned page(s) name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 5 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 9facf49a1b39d1800a237487f10ab7b34c4780de && git checkout 9facf49a1b39d1800a237487f10ab7b34c4780de
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 7286dd58e806ed321cbdfc23a1c455db8f80b1ad 17d9e56a01ced2fc12b588399641aebe3c34aafa && git checkout -B drift-repro 7286dd58e806ed321cbdfc23a1c455db8f80b1ad && git merge --no-ff 17d9e56a01ced2fc12b588399641aebe3c34aafa
node scripts/docs-audit/affected-docs.mjs --json 7286dd58e806ed321cbdfc23a1c455db8f80b1ad
|
Fixes #14268
What changed
Four hand-copied "Did you mean?" helpers in
packages/lint/srcare now one shared helper.object-graph.ts's already-exportednearestName/suggestNamegained the containment pre-pass thatvalidate-widget-bindings.ts's privatedidYouMeancarried, and the three private copies were deleted:validate-object-references.ts— deleted its privatesuggest/distance, importssuggestNamefrom./object-graph.validate-sortable-fields.ts— same.validate-widget-bindings.ts— deleted its privatedidYouMean/levenshtein/suggest, importssuggestNamefrom./object-graph.object-graph.ts—nearestNamenow checks containment first (matchingc.length/target.lengthwhen one contains the other, scored by length delta) before falling back to Levenshtein distance within the existingmax(2, floor(len/3))budget;suggestNameand the privatedistance(the one surviving edit-distance body) are unchanged. Docblock rewritten to describe the now-shared behaviour instead of pointing at the "consolidating the three copies is recorded as a follow-up" note this card resolves.This is the ruling's decision (comment 5502887598 on #14268): the containment pre-pass becomes
nearestName's behaviour for every caller, includingobject-graph.ts's own twodescribeFieldPathVerdictcall sites (:325/:342, both already routed throughsuggestName).Hints newly supplied
None. A/B comparison on the same base tree (commit
fed4fa409, no test file touched): the full@objectstack/lintsuite run with the four files at theirorigin/mainstate (93 files / 2812 tests passed, 5 skipped) and again with the port applied — byte-identical pass/fail results. No existing suggestion assertion needed a hint text change; the containment pre-pass is additive but none of the three rules' current test fixtures happen to exercise a containment-eligible typo the edit-distance budget didn't already catch. Re-run on the final merged tree (after picking up unrelated upstream commits) also passes clean: 93 files / 2817 tests passed, 0 skipped (the skip-count change is from unrelated upstream work, not this PR).Verification
pnpm --filter @objectstack/lint build— clean (dist emitted, no dangling references to the deleted functions).pnpm --filter @objectstack/lint typecheck— clean (tsc --noEmit+check:test-typecheck).pnpm --filter @objectstack/lint test— 93 files / 2817 tests passed on the final merged tree (commit referenced below).pnpm lintnarrowed to the 5 touched files (--format json): 0 errors, 1 informational warning (.changeset/*.mdhas no ESLint config — expected, not a finding). The repo'seslint.config.mjsenables no type-aware linting (noparserOptions.projectanywhere), so this diff cannot move any untouched file's verdict — the narrowed run is a complete reading of this diff's lint surface, not a partial one.NOT MEASURED(both require artifacts this local run cannot produce, not repo-scoped to this PR):check-test-completeness.mjs(needs a savedturbo run testlog CI produces) andcheck:dual-build-cjs-loads(needs a full monorepopnpm build, ~78 packages).Changeset
.changeset/lint-suggest-name-consolidation.md—@objectstack/lint:patch.Out of scope
Per the ruling and the claim comment, the following private "did you mean?" copies in
packages/lint/srcare not touched by this PR — filed as follow-ups, listed in the report below with file:line for the PM to route:validate-action-name-refs.ts:84(distance) /:101(suggest)validate-ai-tool-references.ts:70(distance) /:87(suggest)validate-chart-bindings.ts:83(distance) /:100(suggest)validate-searchable-fields.ts:275(suggest) /:289(distance)validate-translation-references.ts:159(distance) /:186(suggest)validate-react-page-props.ts:167(nearestKnown)validate-rule-schema-formats.ts:266(nearestRegisteredFormat)Generated by Claude Code