Repository navigation
test(servers): enforce explicit tool imports and exports via AST audit and CI - #330
Merged
dandye merged 3 commits intoNov 1, 2026
Merged
Conversation
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.
Summary
Stacked on top of #328 (
fix__secops-splat-imports) so only the verification delta is shown.@server.tool()audit (server/secopsandserver/gti):_audit_secops_tools_exports(server/secops/tests/test_secops_tools_unit.py) and_audit_gti_tools_exports(server/gti/tests/test_tools.py) to inspect alltools/*.pyfiles on disk viaast.parseand verify:tools/<submodule>.pyis explicitly imported viafrom .<submodule> import ...intools/__init__.pyand listed in sortedtools.__all__, reportingfile.py:linenoon any missing import or export.@server.tool()decorated function intools/*.pyis registered onserver._tool_manager._tools(both on standard module import and when runningserver.pyas__main__).server/secops/secops_mcp/tools/*.pycarries@server.tool()(requiring internal helpers to be prefixed with_).test_tools_init_flags_unimported_new_function(server/secops/tests/test_secops_tools_unit.py) andtest_gti_tools_init_flags_unimported_new_function(server/gti/tests/test_tools.py) verifying that appending a new@server.tool()function to atools/*.pymodule without importing it intools/__init__.pyis immediately flagged with the exact filename, line number, and symbol name.pytestworkflow (.github/workflows/verify-tool-exports.yml):server/secopsandserver/gtiand runspytest tests/*_unit.py -v(server/secops, 41 tests) andpytest tests/ -v(server/gti, 61 tests) on every pull request so the unit tests are the single source of truth.Verification
pytest server/secops/tests/*_unit.py(41 passed)pytest server/gti/tests/(61 passed)