fix(typos-format): remove opt-in config-gate, run typos unconditionally - #901
fix(typos-format): remove opt-in config-gate, run typos unconditionally#901kyle-sexton wants to merge 1 commit into
Conversation
The hook previously walked ancestor directories looking for a governing typos config and skipped entirely when none was found, mirroring the ruff-format/biome-format config-gate pattern. That pattern is wrong for typos: it ships a built-in spelling dictionary and runs with zero configuration, so gating activation on a hand-authored config made the hook a silent no-op on most repos day one, defeating its zero-config auto-fix purpose. typos --write-changes now runs unconditionally on every edited file, matching markdown-format's existing unconditional pattern. typos' own config discovery is untouched — a governing config, when present, is still found and honored by typos itself to widen the allowlist/excludes. Closes #884 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1V3gkrfSf75isB8MiDy3o
|
Claude finished @kyle-sexton's task in 2m 33s —— View job PR Review
Summary: The change is correct and well-scoped. Removing the 32-line CONFIG_FOUND walk-up loop and its single gate check is the right fix — the walk-up was pure activation logic that the hook implemented itself; Hook script (
|
|
Claude finished @kyle-sexton's task in 2m 57s —— View job Security Review — PR #901
FindingsNo CRITICAL or IMPORTANT security issues found. Reviewed surfaces: command injection, path traversal, unsafe variable handling, JSON injection, supply-chain risk, secrets/credential exposure, and dangerous sink execution patterns. Details below. Hook invocation —
|
|
Closing as a duplicate of #900 — both PRs independently implemented the same fix for #884 (a genuine race: two workers ended up on the same task). #900 landed first with a fully clean review pass (2 minor non-blocking nits, no correctness/security issues) and zero pending checks. Not merging this one. |
Summary
typos-format's hook gated its entire spell-fix behavior behind a pre-existing consumer typos config (typos.toml/_typos.toml/.typos.toml/Cargo.toml/pyproject.toml), mirroring theruff-format/biome-formatopt-in pattern. That pattern is wrong fortyposspecifically: it ships a built-in spelling dictionary and runs with zero configuration, so the gate made the hook a silent no-op on any repo without a hand-authored typos config — i.e. most repos on day one, defeating the plugin's zero-config auto-fix purpose.Fix
Removed the opt-in config-gate entirely.
typos --write-changesnow runs unconditionally on every edited file (no extension filter, same as before), matchingmarkdown-format's existing unconditional pattern instead ofruff-format's config-gated one. This is a removal of an activation gate only —typos's own file-anchored config discovery still applies automatically when a config is present, to widen its allowlist (extend-words/extend-identifiers/extend-ignore-re) and excludes ([files] extend-exclude); the hook no longer implements its own ancestor config walk-up at all, since it was only ever used to decide whether to invoketypos, never to pass the config to it.Updated:
plugins/typos-format/hooks/typos-format.sh— removed theCONFIG_FOUNDwalk-up loop and its gate check; reworded the missing-binary skip notice (no longer references "a typos config governs this repo"); rewrote the header comment block to describe unconditional behavior.plugins/typos-format/hooks/typos-format.test.sh— replaced "opt-in gate OFF -> file left untouched" with a test proving the hook fixes a typo with no config present anywhere; reframed the config-precedence test as proving typos' own native discovery (not the hook's); flipped the "gate OFF -> telemetry status skipped" case to "no-config -> status ok"; updated the missing-binary test's message assertion.plugins/typos-format/README.md,plugins/typos-format/skills/setup/SKILL.md— updated to describe unconditional behavior; config presence insetup checkis now informational only (INFO), never a FAIL/PASS gate.plugins/typos-format/.claude-plugin/plugin.json— bumped0.1.0→0.2.0(minor, not patch): this changes runtime behavior for existing installs — a repo with no typos config goes from inert to actively rewriting files on edit, a surprise-on-upgrade consumers should see flagged in the version.plugins/typos-format/CHANGELOG.md— new[0.2.0]entry.Verification
All 43 hook contract tests pass (
bash plugins/typos-format/hooks/typos-format.test.sh) against a realtypos-cli 1.44.0binary.Empirical before/after against a zero-config repo (no
_typos.tomlanywhere), same inputthis has teh typo:this has teh typo.this has the typo.Closes #884
Related
typos-formathalf of typos-format/ruff-format: opt-in config grep misses TOML inline-table form for [tool.X] #876 (a grep-pattern issue against the now-removed gate check) — the gate no longer exists, so that concern is moot.