Use ALL_TOOLS as single source of truth for canonical tool ordering#1793
Merged
nathanjmcdougall merged 6 commits intoApr 4, 2026
Merged
Conversation
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/2fe957e7-5906-45a0-a2ae-bb7790076083 Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Consider using ALL_TOOLS for canonical tool ordering
Use Apr 4, 2026
ALL_TOOLS as single source of truth for canonical tool ordering
nathanjmcdougall
requested changes
Apr 4, 2026
…tion Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/a38b59a7-2008-4870-a1f4-61d44b04cbba Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
nathanjmcdougall
requested changes
Apr 4, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…CS refactor Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/f9182353-f655-4e0f-ac44-f175b44a686d Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
nathanjmcdougall
requested changes
Apr 4, 2026
nathanjmcdougall
approved these changes
Apr 4, 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.
Tool ordering was defined redundantly in three separate places (
ALL_TOOLS,OTHER_TOOLSinpyproject_toml.py,ALL_TOOL_COMMANDSintool.py), allowing them to drift.ALL_TOOL_COMMANDSalready had a bug:pyproject.tomlappeared beforepyproject-fmt, contradicting alphabetical order inALL_TOOLS.Changes
_tool/impl/spec/all_.py(new) – introducesALL_TOOL_SPECS, a canonical list of allToolSpecinstances in alphabetical order, mirroringALL_TOOLSbut at the spec layer. This avoids a circular import:_tool.impl.basecan import from_tool.impl.spec, but not from_tool.all_.pyproject_toml.py– replaces the duplicated_OTHER_TOOLSlist with a direct use ofALL_TOOL_SPECSfrom the new spec registry, filtering outPyprojectTOMLToolSpecinline and usingis_likely_used(tool_spec)in place oftool.is_used(). All sibling base-Tool imports are removed..importlinter– addsall_as the top layer in thetool_impl_speccontract to accommodate the new module.tool.py– replaces the hardcodedALL_TOOL_COMMANDSwith a derived computation:This fixes the
pyproject.toml/pyproject-fmtordering bug as a side effect.all_.py–OTHER_TOOLSis removed entirely. It had no remaining consumers in source code after theALL_TOOL_SPECSrefactor, and its only test was a circular self-validating assertion.Tests –
test_tool_matches_commandupgraded from set equality to list equality (enforces order);TestAllToolSpecs.test_in_sync_with_all_toolsguards thatALL_TOOL_SPECSstays in sync withALL_TOOLS.