Skip to content

refactor: drop an unused attribute and redundant exception checks - #257

Merged
glebedel merged 3 commits into
mainfrom
s2d2/audit-dead-code
Nov 11, 2026
Merged

glebedel merged 3 commits into
mainfrom
s2d2/audit-dead-code

Conversation

@glebedel

@glebedel glebedel commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What

  • StackOneToolSet._execute_config was assigned in __init__ and never read anywhere (grep -rn _execute_config stackone_ai finds only that line in toolset.py; the other hits are the unrelated StackOneTool._execute_config). Two tests in tests/test_integrations_pydantic_ai.py still assigned it with a type: ignore; those lines set nothing the code reads and are removed too (second commit). account_ids and timeout are still read from the execute argument.
  • ToolsetError subclasses StackOneError (types.py:89), so except (ToolsetError, StackOneError) in toolset.py and isinstance(current, StackOneError | ToolsetError) in tools.py are the same as StackOneError alone. The two ToolsetError imports then go unused (ruff F401).

No behaviour change.

How verified

  • uv run ruff check ., uv run ruff format --check .: clean
  • uv run ty check stackone_ai examples: All checks passed
  • uv run pytest (Python 3.13, MCP mock via pnpm): 871 passed
  • uv run pytest tests/test_integrations_pydantic_ai.py after the test cleanup: 13 passed

Gates (head 5f84c60)

Gate Result
Repo skills none in repo
/forge:forge ran on ef8dd6d: no change; re-run on 5f84c60: +3 -8, 0 comment lines, 0 copies
Security scan security-reviewer agent: no finding at confidence 70 or above. Aikido: 31 open issues on main (lockfile CVEs, workflow SAST, one old test-fixture secret), none on lines this PR changes
Codex security clean on ef8dd6d (job 284aa7c6) and 5f84c60 (job b2f55e81)
/security-review ran: secrets, input validation, transport and DoS items clean; the server-side items do not apply to an SDK
/code-review medium on ef8dd6d: no correctness bugs. Fixed 1: the account_ids test is renamed for what it checks (precedence of configured accounts is covered by test_execute_config_account_ids_scope_the_catalog_fetch)
CI green on 5f84c60: 10 pass, 3 skipped
Unresolved review threads 0

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_config was assigned in __init__ but never read, and exception handling that caught ToolsetError alongside StackOneError was redundant because ToolsetError subclasses StackOneError. The now-unused ToolsetError imports 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.

View guided diff Turn on auto-fix

- 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>
@glebedel glebedel self-assigned this Nov 10, 2026
s2d2-s1 and others added 2 commits November 10, 2026 20:41
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>
@glebedel
glebedel merged commit 842fe3a into main Nov 11, 2026
15 checks passed
@glebedel
glebedel deleted the s2d2/audit-dead-code branch November 11, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants