Repository navigation
fix(ruff): fail fix() when ruff exits with an error code instead of silently returning an empty Changeset - #114
Merged
danielgafni merged 1 commit intoOct 11, 2026
Conversation
RuffChecker.fix and RuffFormatter.fix used expect=ReturnType.ANY without inspecting the exit code, so a ruff configuration/usage/runtime error returned an empty Changeset that reads as a successful no-op, and ruff's error output was invisible in dagger call. lint() already fails loudly in the same situations (default expect=SUCCESS), so the two fix paths disagreed with the rest of the module. Exit codes 0 (clean) and 1 (violations remain after --fix) still return a Changeset as before; 2+ now raises RuntimeError with the exit code. Fixes typesafe-ai#99
danielgafni
approved these changes
Oct 11, 2026
Contributor
|
thanks! |
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.
What changed
RuffChecker.fixandRuffFormatter.fixran ruff withexpect=dagger.ReturnType.ANY, awaited onlycombined_output(), and built aChangesetwithout ever inspecting the exit code. When ruff itself fails — a brokenruff.toml(unknown option), a usage error, a runtime error — the function returned an empty Changeset, which reads as a successful no-op ("everything is already clean"), and ruff's error text never reached the terminal indagger call. The same input makeslint()fail loudly (it uses the defaultexpect=SUCCESS), so the module disagreed with itself.Fix
After
combined_output(), readexit_code()and raiseRuntimeErrorwhen it is not0or1:0— clean,1— violations remain after--fix— are normal outcomes and still return aChangesetexactly as before (an over-strict check would break the "fix what's fixable" flow).2+— ruff's error code (configuration / usage / runtime) — now fails the function with the exit code in the message.lint()is untouched.Verification (Dagger engine, all six runs against the same source dirs)
ruff.tomlwith an unknown option →check fixno changes to apply)FunctionError:ruff check --fixfailed with exit code 2format fixruff formatcheck fix1) →check fixformat fixlintTOML parse error ...)ruff check --config ruff.tomlpasses on both changed files.Fixes #99.
Prepared and engine-verified with an AI coding agent; verification matrix above was run with
daggerv0.21.10 on darwin/arm64, not inferred from reading the code.