fix(commands): bound unknown verb suggestions - #3954
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3954 +/- ##
==========================================
- Coverage 93.66% 93.66% -0.01%
==========================================
Files 372 372
Lines 34856 34867 +11
Branches 12743 12747 +4
==========================================
+ Hits 32649 32658 +9
- Misses 1588 1589 +1
- Partials 619 620 +1
🚀 New features to boost your workflow:
|
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - fixes requiredReview updated: 2026-07-07 09:14:48 UTC
🛑 Suggested Action - Manual Review
Review summary Blockers
Nits — 5 non-blocking
Why this is blocked
CI checks failing
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Motivation
@gittensoryverbs and can exhaust worker CPU/heap.Description
COMMAND_SUGGEST_MAX_VERB_LENGTH = 64and short‑circuit suggestions for unknown verbs longer than that limit.levenshteinDistanceimplementation with a bounded rolling‑row implementationboundedLevenshteinDistance(left, right, maxDistance)that early‑exits when the distance cannot be withinmaxDistance, and preservelevenshteinDistanceas a wrapper.suggestCommandskip targets whose length delta exceedsCOMMAND_SUGGEST_MAX_DISTANCEand use the bounded distance function with the max threshold to avoid heavy work on each catalog entry.Testing
npx vitest run test/unit/command-suggest.test.ts, and the unit suite for the changed file passed.npm run typecheck, which succeeded with no type errors.npx vitest run --coverage --pool=forks test/unit/command-suggest.test.ts, where tests passed but coverage remapping failed withTypeError: jsTokens is not a function.npm run test:ci, which progressed through early lint/type checks but was stopped during the repository'stest:coveragestage due to pre‑existing unrelatedRangeError: Maximum call stack size exceededoutput from the larger test suite, so the full CI gate was not completed here.Codex Task