Repository navigation
Move the code other modules import from leaf-dev commands into helper modules - #6380
Merged
Merged
Conversation
…bsite.py's header
…and read the manifest path from leaf_website in the saved-state fixture
leaf-agent
approved these changes
Nov 18, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 18, 2026
…ts a leaf-dev command module (#6407) Makes `dev/AGENTS.md`'s rule that only the CLI and tests import a `leaf-dev` command module a ruff check. `banned-api` (TID251) bans `leaf_dev.commands` everywhere except `cli.py`, the commands themselves and the two test trees, so pre-commit, CI and `wt merge` refuse 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-files` passes on main, and a used `from leaf_dev.commands.site.verify import PAGES` added to `dev/leaf_dev/website_eval.py` fails with the message. > _This was written by Claude Code on behalf of max-sixty_
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.
Follow-up to #6014, which left other code importing from
leaf-devcommand modules. Now a command module is imported only by the CLI and by the tests of that command: the code other modules borrowed lives in helper modules, anddev/AGENTS.mdstates the rule.dev/leaf_dev/website.pyreaches leaf.page or the local build from a browser: page loads, state reads, activation, user sessions, the local adapter and the local Worker, and the built site's paths (SITE,asset_site,install_tree,site_lock). It came out ofsite verify, from whichjourney runimported a dozen names, andsite build. Its browser script (website.js, formerlyverify_browser.js) andwrangler_server.mjsmoved beside it, andstartup_profileandstartup_linejoinedstartup.py.dev/leaf_dev/corpus.pyis the corpus generator, whichnamed_source,page_fixturesandstatescall on demand.server_paths.pyfolded intocommands/bench.py, its only user, which ends their import cycle. Its names that collided with bench's took aserverprefix (measure_server,SERVER_FITTED, …).arms.pyholdspreview_leaseand theterminatedstop handler, which the Codex journey andwebsite_evalimported frompreview.placement/_pin_cases.py, the cataloguetests/browser/margin/test_pins.pyasserts, andsite/_build.pyandsite/_distribution.py, the pipelinesite previewsand the product tests use.pins.py,build.pyanddistribution.pykeep their commands.The code moved unchanged apart from those renames and two paths:
website.pyreads the build's manifest throughleaf_website.SITE_MANIFESTand its lock throughsite_lock, wheresite verifyhad spelled both out a second time.To weigh:
site previewsnow ends with the buildsite buildruns (_build.build_site), which also takes the site's lock and bundles the published runtime, so the.tmp/siteit leaves is onesite verify website-workercan read; before, it rebuilt.tmp/siteunlocked and unbundled. git records_build.py,_distribution.pyand_pin_cases.pyas new files, so their history before this change is onbuild.py,distribution.pyandpins.py.Checks: every touched command's
--help;generate corpus,bench events --read server,placement pins,site distributionandsite buildend to end; the dev tests over the moved code, where only the ten tests #6374 fixes fail, as on main; the product tests that import it; and pre-commit on every changed file.site verify website-workertimes out at its first activation through the local Worker on this machine, on main as well, so that pass is unverified here. Each moved definition matches its original by AST apart from the changes above.Max asked for this as the follow-up #6014's description named.