Repository navigation
refactor: drop an unused attribute and redundant exception checks - #257
Merged
Merged
Conversation
- StackOneToolSet._execute_config was assigned in __init__ and never read; account_ids and timeout are taken from the execute argument directly. - ToolsetError subclasses StackOneError, so catching or isinstance-checking both is the same as StackOneError alone. The ToolsetError imports in tools.py and toolset.py then go unused. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
Two pydantic_ai tests assigned the attribute on a toolset built with __new__. Nothing reads it, so the assignments set state no code uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
With the dead _execute_config setup gone, nothing configured is overridden; the test checks that pydantic_ai() passes account_ids to fetch_tools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
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
StackOneToolSet._execute_configwas assigned in__init__and never read anywhere (grep -rn _execute_config stackone_aifinds only that line intoolset.py; the other hits are the unrelatedStackOneTool._execute_config). Two tests intests/test_integrations_pydantic_ai.pystill assigned it with atype: ignore; those lines set nothing the code reads and are removed too (second commit).account_idsandtimeoutare still read from theexecuteargument.ToolsetErrorsubclassesStackOneError(types.py:89), soexcept (ToolsetError, StackOneError)intoolset.pyandisinstance(current, StackOneError | ToolsetError)intools.pyare the same asStackOneErroralone. The twoToolsetErrorimports then go unused (ruff F401).No behaviour change.
How verified
uv run ruff check .,uv run ruff format --check .: cleanuv run ty check stackone_ai examples: All checks passeduv run pytest(Python 3.13, MCP mock via pnpm): 871 passeduv run pytest tests/test_integrations_pydantic_ai.pyafter the test cleanup: 13 passedGates (head 5f84c60)
test_execute_config_account_ids_scope_the_catalog_fetch)Requested by guillaume@stackone.com in Slack (repo audit thread).
🤖 Generated with Claude Code
Summary by cubic
Removes dead code from the tool classes:
StackOneToolSet._execute_configwas assigned in__init__but never read, and exception handling that caughtToolsetErroralongsideStackOneErrorwas redundant becauseToolsetErrorsubclassesStackOneError. The now-unusedToolsetErrorimports are dropped, and tests no longer assign the removed attribute. No behavior change; ruff, ty, and the full test suite (871 passed) remain clean.Written for commit ef8dd6d. Summary will update on new commits.