Repository navigation
Fail ruff when code outside the CLI, the commands and the tests imports a leaf-dev command module - #6407
Merged
Conversation
…ts a leaf-dev command module dev/AGENTS.md says only the CLI and tests import a command module. Five commits between 2026-10-19 and 2026-11-03 (98f9d2f, 2872ba3, 46533e2, 13e3081, aa787c5) added imports of command modules to helper modules, and #6014 and #6380 moved them out again. ruff's banned-api now refuses such an import in pre-commit, CI and wt merge, and its message says where the code goes.
leaf-agent
approved these changes
Nov 18, 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.
Makes
dev/AGENTS.md's rule that only the CLI and tests import aleaf-devcommand module a ruff check.banned-api(TID251) bansleaf_dev.commandseverywhere exceptcli.py, the commands themselves and the two test trees, so pre-commit, CI andwt mergerefuse a helper module that imports a command, with a message saying where the code goes.Five commits between 19 October and 3 November added such imports, and #6014 and #6380 then took two PRs to move them out; this check would have refused each one at commit time. It doesn't see one group's command importing another group's command. Nothing on main does that: every import inside
commands/is of the importer's own group's_name.py.Max asked whether to add this as the follow-up to #6380.
Checks:
pre-commit run ruff-check --all-filespasses on main, and a usedfrom leaf_dev.commands.site.verify import PAGESadded todev/leaf_dev/website_eval.pyfails with the message.