Repository navigation
fix: name a mistyped --rule or --file instead of "Nothing to fix" - #231
Merged
laaielichter merged 1 commit intoNov 17, 2026
Merged
Conversation
…aielichter#214) `fix --rule` and `--file` (and `migrate --file`) narrowed what is fixed, and a rule id or path with a typo matched nothing: the answer was the same as for a clean project, "0 fixes" and exit code 0, which reads as "done, clean" in a CI step or to an agent. The check sits in `fixProject` and `migrateProject`, so the CLI and the MCP tools (`godot_fix`, `godot_migrate`) both get it: - an unknown rule id is an error that names the nearest rule, from the same `nearest()` helper the model commands use: `unknown rule "api/infer-varaint"; did you mean api/infer-variant? (fixable rules: ...)`, exit code 1; - a rule that exists but has no mechanical fix says so: `api/unknown-member has no mechanical fix (fixable rules: ...)`, exit code 1; - a `--file` that is not in the project says `res://mian.gd does not exist in the project`, exit code 1; - nothing is written in any of these cases, also with `--write`, and a correct rule, file or a project with nothing to fix behaves as before (exit code 0). Tests cover the typo, the rule without a fix, a name with nothing close, the missing file for `fix` and `migrate`, the write case, and the two MCP tools.
laaielichter
approved these changes
Nov 17, 2026
laaielichter
left a comment
Owner
There was a problem hiding this comment.
Thank you @tnalbant, this is exactly what #214 asked for. Putting the check in src/project/options.ts means the CLI and godot_fix/godot_migrate all fail the same way. Exit code 1 for a rule without a mechanical fix is the right call: the whole point is that exit 0 read as "clean".
Verified on 07028c2 (current main is its base): npm run check passes here (typecheck, 2699 tests passed, 1034 skipped without Godot, build). I reran the issue's reproduction against main and this head:
fix --rule api/infer-varaint:mainsays0 fixes, exit 0. Here it saysunknown rule "api/infer-varaint"; did you mean api/infer-variant?, exit 1.fix --rule api/unknown-member: here it sayshas no mechanical fix, exit 1.fix --rule zzzzgets no suggestion, exit 1.fix --file res://mian.gd --write,fix --file ../outside.gdandmigrate --file res://mian.gd: here they say... does not exist in the project, exit 1, andmain.gdis byte-identical afterwards.fix --rule api/infer-variantandfix --file main.gdstill propose the fix. A clean project still printsNothing to fix mechanically.with exit 0.
Mutation check: dropping the checkRules call, or the existence check in checkFiles, makes 4 tests fail in fix/migrate/mcp. CI is 8/8 green. Merging; I will add the CHANGELOG credit.
Generated by Claude Code
laaielichter
added a commit
that referenced
this pull request
Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix --rule,fix --fileandmigrate --filenarrowed what is fixed, and a rule id or a path with a typo matched nothing, so the answer was the same as for a clean project:0 fixes,Nothing to migrate, exit code 0. In a CI step, or to an agent that reads the output, that says "done, clean".The four cases this issue lists, on the project from the report:
Nothing is written in any of these cases, also with
--write. A correct--ruleand--filework as before, and a project with nothing to fix still printsNothing to fix mechanically.with exit code 0.Where the check lives.
checkRules()andcheckFiles()insrc/project/options.ts, called at the top offixProject()(src/fix/fix.ts) andmigrateProject()(src/migrate/migrate.ts), so the CLI and the MCP toolsgodot_fixandgodot_migratefail the same way instead of returning an empty result. The nearest name comes fromnearest(), the helper added in #222, so a suggestion matches what the model commands already say; the unknown-rule sentence keeps theunknown rule "x"; did you mean y?shape they use, and the rule without a fix gets its own sentence as the issue asks.One decision to flag: a rule that exists but has no mechanical fix is exit code 1 too, because the point of the issue is that exit 0 read as "clean". Say if you would rather keep that one at 0.
Tests.
test/fix.test.tscovers the typo (nearest rule named, nothing written), the rule without a fix, a name with nothing close, the missing file, the exit codes and the--writecase;test/migrate.test.tsthe missing--file(and the named file still migrating);test/mcp.test.tsthatgodot_fixanswers with the same two errors. The oldfix --file res://missing.gdexpectation intest/fix.test.tsassertedNothing to fix, which is the behaviour this issue changes, so it now asserts the error and exit code 1.npm run check: typecheck and build clean, 4 tests fail. Three of them fail the same way on a clean worktree ofmain(9d54706) on this machine:build-apiwith a path with spaces, andhooks-protecttwice. The fourth,test/archetype/check.test.ts, hits vitest's 60 s timeout in the full parallel run and passes alone in 29 s.CHANGELOG.md is untouched, as the issue asks. The optional
--writewording extra in the issue is not in this PR.