Skip to content

fix(typos-format): render multi-candidate residuals as ambiguous - #2666

Merged
kyle-sexton merged 1 commit into
mainfrom
cursor/fix-typos-format-multi-candidate-f8b0
Aug 15, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
cursor/fix-typos-format-multi-candidate-f8b0

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #2659

Summary

Residual findings with more than one correction candidate now list every option and mark the finding ambiguous, matching typos' refusal to auto-apply multi-candidate fixes.

Fix

  • Multi-candidate residuals render as ambiguous (not a definite corrections[0] suggestion)
  • Single-candidate and null-correction residual arms, plus applied-correction renders, stay unchanged
  • Plugin version bumped to 0.6.18

Verification

bash plugins/typos-format/hooks/typos-format.test.sh
# PASS=121 FAIL=0

Related

Refs #2650 — write-mode allowlist work on the same hook.

Open in Web Open in Cursor 

typos refuses to auto-apply findings with more than one correction
candidate; disclosing only corrections[0] as a definite "should be X"
misled agents into edits the tool declined. List every candidate and
mark the finding ambiguous instead. Also align hooks.json statusMessage
with the default report-only posture.

Closes #2659

Co-authored-by: Kyle Sexton <[email protected]>
@cursor

cursor Bot commented Aug 15, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@claude

claude Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 2m 14s —— View job


CI Code Review

Todo

  • Gather context (diff vs origin/main, REVIEW.md, plugin files)
  • Understand the request (code-review lane, /review:code-review)
  • Review changed files for correctness / maintainability
  • Post findings

Scope: 5 files, all in plugins/typos-format/ — the jq classifier in hooks/typos-format.sh, its test coverage, hooks.json, plugin.json version bump, and CHANGELOG.md.

What I checked

  • Traced the jq logic in typos-format.sh#L438-L492:
    • corr1 (single-candidate helper) is still used correctly for the applied/appliedText/appliedInline fields — those only ever contain single-candidate corrections typos actually applied, so keeping corr1 there is correct, not dead code.
    • The new corrs helper elides each candidate individually and joins with " or ". For the single-candidate residual arm, join(" or ") over a 1-element array is just that element, so the quoted should be "X" rendering is unchanged from before — confirmed this doesn't regress the existing single-candidate/null-correction paths.
    • The .corrections == null (disallowed) and length > 1 (ambiguous) / else (single, quoted) branches are mutually exclusive and cover the three shapes typos actually emits.
  • Confirmed no other references to the old "Fixing typos..." status string or to corrections[0]-only rendering remain elsewhere in the plugin (README, docs).
  • CHANGELOG.md/plugin.json version bump (0.6.17 → 0.6.18) are consistent with the Keep a Changelog format already used in this file.
  • Test additions (typos-format.test.sh lines ~489–524) exercise the multi-candidate (wnat → ["want","what"]), single-candidate (teh → ["the"]), and null-correction (disallowme → null) arms against the same stub shapes already used elsewhere in the suite, so they're exercising realistic typos output, not an invented shape.

Not independently verified: this lane's Bash access is restricted to gh pr diff/view/comment/review, so I could not execute typos-format.test.sh myself. The PR description's PASS=121 FAIL=0 is author-claimed; I verified the test logic and hook logic by static read-through instead of running the suite.

Findings: none that a careful reviewer would block on. The change is small, correctly scoped to the multi-candidate render path, and the new tests pin the exact wording for all three residual arms.

@claude

claude Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 8s —— View job


Security Review

  • Gather context (PR diff, changed files)
  • Run skip-gate check
  • Review changed files for security-relevant issues
  • Adversarial validation of any candidate findings
  • Post final results

No security issues found.

This PR changes only how residual spell-check findings are rendered in plugins/typos-format/hooks/typos-format.sh (a jq template inside the hook script): multi-candidate residuals now list every correction candidate via join(" or ") and are marked ambiguous, instead of quoting only corrections[0] as a definite fix. It also bumps the plugin version, updates the hooks.json status message string, and adds test coverage.

Reviewed for security-relevant surface and found none:

  • No new execution paths. TYPOS_BIN invocation, WRITE_CHANGES gating, and the write-mode extension/lockfile allowlists are untouched by this diff — the change is confined to the classification jq filter's residualText branch.
  • No injection risk. The rendered strings (corrs, corr1, tokens) are joined/interpolated entirely inside jq's own string handling, and the final stdout JSON document is composed via hook::emit_channels, which routes both additionalContext and systemMessage through hook::json_escape (plugins/typos-format/hooks/hook-utils.sh:83) before emission. Intermediate extraction uses hook::jq_fields, which reads NUL-delimited values with read -d '' — no eval/command substitution over untrusted content at any point. A typo token or correction containing quotes, backslashes, or shell metacharacters stays inert data throughout.
  • No change to trust boundaries. This is a report-only advisory hook path; the diff doesn't touch the write-mode allowlist, lockfile denial list, or path resolution logic that guard the one mutating code path in this file.

This falls under the skip gate ("change has no security-relevant surface after reading the diff") — a text-formatting correctness fix with no exploitable path.

@github-actions

Copy link
Copy Markdown
Contributor

Last security-reviewed head: d29eed82a40ad8595a48165ed17b541504e1f2a8. On the next push, the relevance gate compares only the commits since this SHA; delete this comment to force a full re-review.

@github-actions

Copy link
Copy Markdown
Contributor

Claude has reviewed this PR 1 time. The lane skips further automatic reviews after 5; deleting this comment resets the count.

@kyle-sexton
kyle-sexton merged commit 83d5401 into main Aug 15, 2026
1 check passed
@kyle-sexton
kyle-sexton deleted the cursor/fix-typos-format-multi-candidate-f8b0 branch August 15, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

typos-format: multi-candidate residual findings render as a single definite correction typos itself refuses to apply

1 participant