Skip to content

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

Closed

Description

@kyle-sexton

Problem

plugins/typos-format/hooks/typos-format.sh renders residual (non-applied) findings using only corrections[0], in the sentence form should be "X".

Upstream typos returns a correction list. Where that list has more than one entry, typos itself treats the finding as not safely fixable — typos -w refuses to apply it. The hook therefore presents a finding the tool declines to act on as a single definite correction, which reads as an instruction to the agent to make an edit typos deliberately would not.

The plugin's own README already documents the distinction:

Residual findings — an entry with no known correction ... or one with more than one candidate correction — surface as advisory context, never auto-applied.

So the display contradicts the documented model.

Evidence

Measured against real typos:

  • 14/14 ordinary English typos were single-candidate and auto-fixed.
  • 4/4 observed false positives were multi-candidate: ba -> ["by","be"], mis -> ["miss","mist"]. Both were refused by typos -w.

Marking multi-candidate findings removes 100% of observed false positives at zero true-positive cost.

The test suite has no residual-rendering assertion at all, which is why this shipped.

Proposed change

In the classifier jq in plugins/typos-format/hooks/typos-format.sh, add a corrs helper beside the existing corr1, and render residual findings with more than one candidate as ambiguous rather than definite:

"  \"\(tok)\" (line \(.line_num // 0)) should be \(if (.corrections|length) > 1 then "\(corrs) (ambiguous — typos will not auto-correct this)" else "\"\(corrs)\"" end)."

The applied renders stay on corr1: typos -w only ever produces an applied correction from a single-candidate finding, so corr1 is exact there and must not change.

Also in scope, same file family: plugins/typos-format/hooks/hooks.json carries "statusMessage": "Fixing typos...". The default configuration is report-only and never writes, so the string misdescribes what the hook does. It should read "Checking spelling...".

Acceptance criteria

  • A multi-candidate residual renders as "ba" (line 3) should be by or be (ambiguous — typos will not auto-correct this).
  • A single-candidate residual still renders as "recieve" (line 5) should be "receive".
  • The corrections == null arm ("is disallowed, no known correction") is unchanged.
  • The applied-correction renders are untouched and still use corr1.
  • typos-format.test.sh gains an assertion covering the multi-candidate residual render that fails against the pre-change code.
  • hooks.json statusMessage reads Checking spelling....

Activity

  1. added
    needs-triage
    on Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triage

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions