Uh oh!
There was an error while loading. Please reload this page.
fix(lint): consolidate five more private "Did you mean?" copies onto suggestName - #14757
Conversation
…suggestName Follow-up to #14268/#14575. Five more validate-*.ts rules in packages/lint carried a private suggest/distance pair, byte-for-byte re-deriving the edit-distance-only budget object-graph.ts already exports as suggestName. Tier 1 (validate-action-name-refs, validate-chart-bindings, validate-searchable-fields): delete the private pair, import suggestName. Tier 2 (validate-ai-tool-references, validate-translation-references): keep the rule's own one-line pre-pass (the action_<name> tool-family prefix, and a snake_case namespace-segment match — rule-local knowledge), then delegate the fallback to suggestName instead of a private Levenshtein copy. object-graph.ts's helper is untouched (#14268 already ruled it). validate-react-page-props.ts and validate-rule-schema-formats.ts stay fenced out — both are a different contract on purpose per #14577's triage. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV
📓 Docs Drift Check3 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. 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 5e4bfc72ff51e3e3bdbc61ddd9beb0455065d529 && git checkout 5e4bfc72ff51e3e3bdbc61ddd9beb0455065d529
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin df657d9df1fac5a2222f183008532613a1df585f e9e0afa1bf414a8d59107fca2023b64bb180b405 && git checkout -B drift-repro df657d9df1fac5a2222f183008532613a1df585f && git merge --no-ff e9e0afa1bf414a8d59107fca2023b64bb180b405
node scripts/docs-audit/affected-docs.mjs --json df657d9df1fac5a2222f183008532613a1df585f |
…ggest-copies-consolidation
Uh oh!
There was an error while loading. Please reload this page.
Fixes#14577
Summary
Follow-up to #14268/#14575: five more
validate-*.tsrules inpackages/lint/srccarried a privatesuggest/distancepair, re-deriving the same edit-distance-only "Did you mean?" budget thatobject-graph.tsalready exports assuggestName. This PR consolidates all five onto the shared helper.validate-action-name-refs.ts,validate-chart-bindings.ts,validate-searchable-fields.ts: delete the privatedistance/suggestpair, importsuggestNamefrom./object-graph.js.validate-ai-tool-references.ts,validate-translation-references.ts: keep the rule's own one-line pre-pass (theaction_NAMEtool-family prefix, and a snake_case namespace-segment match — rule-local knowledge, not the shared helper's business), then delegate the fallback tosuggestNameinstead of a private Levenshtein copy.object-graph.ts's helper is untouched (#14268 already ruled it — this card consumes it, does not revise it).validate-react-page-props.ts(nearestKnown, fixed budget of at most 2) andvalidate-rule-schema-formats.ts(nearestRegisteredFormat, exported, case-insensitive, alphabetical tie-break) stay fenced out — both are a different contract on purpose per #14577's triage, and this PR does not touch them.Population grep (base
4d0d9445a, re-verified at final head7a17f3bf1)After this PR,
function distanceis gone from all five files (Tier 1 has zerofunction distance/suggestleft at all; Tier 2 keeps a thinfunction suggest(...)that is now a one-line pre-pass +return suggestName(...), not a duplicated algorithm):Per-site before/after (containment pre-pass now reachable)
The shared helper's containment pre-pass (a candidate that contains the target, or vice versa, scores ahead of any edit-distance match) is now every one of these five rules' behaviour too — it only ever adds a hint where the private copy's budget previously gave none, matching #14268/#14575's precedent.
suggestName)validate-action-name-refs.tsarchive→ (no hint, 17 edits > budget 2)archive→Did you mean "archive_completed_deals"?validate-chart-bindings.tsamount→ (no hint, 4 edits > budget 2) — the issue's own headline exampleamount→Did you mean "sum_amount"?validate-searchable-fields.tsamount→ (no hint, 4 edits > budget 2)amount→Did you mean "sum_amount"?validate-ai-tool-references.tsknowledge_base→Did you mean "search_knowledge_base"?validate-translation-references.tsamount→Did you mean "amountsummary"?Existing "Did you mean?" assertions in each file's test suite were re-run and are unchanged (the containment pre-pass never overrides an existing distance-based winner in these fixtures — verified by running each file's test suite before and after). One new pin test was added per file (5 total) covering exactly this containment class — the
amount→sum_amountshape the issue names, or its Tier-2 fallback-after-pre-pass-miss equivalent.Fenced files / helper untouched
git diff origin/main --stat(final head7a17f3bf1)Tests
pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2against the five test files — 164 passed, 0 failed (5 files).pnpm --filter @objectstack/lint test(full package suite, includes the 5 new pin tests) — 93 test files passed, 2841 passed / 5 skipped (2846), run twice: once at merge-base4d0d9445a, once at final head7a17f3bf1— identical results both times.pnpm --filter @objectstack/lint typecheck— clean (pre-existingtest-typecheck-debt.jsonentries unrelated to this change, unchanged: 2 file(s)/6 error(s)/2 pinned signatures, shrink-only,@ts-expect-error退役 pin 在packages/spec里是幽灵检查:tsconfig 把**/*.test.ts排除出唯一的tsc --noEmit#5286).pnpm --filter '@objectstack/lint^...' build(spec, formula) before any test run.Gates
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commandsagainst the five files plus the changeset derived 28 command(s). All 28 run at final head7a17f3bf1:node scripts/check-test-completeness.mjs— exit 3, self-declared NOT MEASURED ("nothing was measured... pass a savedturbo run testlog, or record this gate as NOT MEASURED" — needs aturbo run testlog this local run does not have).pnpm check:dual-build-cjs-loads— exit 3, self-declared PREREQUISITE NOT MET ("this gate reads built output, and some package has no dist/" — needs a full repo-widepnpm buildacross ~79 packages, out of scope for a targeted local run; CI's build step covers it).Both are explicit self-reports, not failures — captured with exit code read before any pipe.
Merged
origin/maintwice during this run (once at5258b63f8, once at7a17f3bf1, both clean fast-forwards, neither touchedpackages/lint/) — the final test+typecheck pair was re-run at7a17f3bf1to confirm the result still holds at the pushed head.Scope
File surface: the five rule files + their test files + one changeset — exactly the claimed surface, nothing else touched.
@objectstack/lintpatchchangeset included, describing the hint-quality change per rule.Generated by Claude Code