Commit Graph

3 Commits

Author SHA1 Message Date
alt-glitch
e6f7b6732d fix(code-health): a folder made from a root module ships, and the guard needs __init__.py
Two review findings on the folder rule:

- A root module or an acp_adapter/ module turned into a folder drops out
  of setup.py's _root_py_modules and ships only if
  [tool.setuptools.packages.find] include matches it. The FILE_LINES fix
  text now names that step, and
  test_every_package_packaged_code_imports_is_found fails when packaged
  code imports a regular package the wheel would not ship (moving
  toolsets.py to toolsets/__init__.py fails it with ['toolsets']).
- Discovery skips a tool package without __init__.py, so
  check_tool_discovery counts only candidates whose package has one,
  and its message says so. An intent-added tools/newpkg/tool.py with no
  __init__.py now fails the guard.

Both changes are the reviewer's patches as suggested.
2026-11-16 11:52:44 +05:30
alt-glitch
9f67098233 fix(code-health): carry the tool-discovery guard into the checker fixture
tests/scripts/test_code_health_cli.py builds fixture repos with a hand-kept
copy of every guard scripts/check runs; the new guard and what it imports
(tools/registry.py, hermes_constants.py) were missing, so three hook tests
failed on "can't open file". The guard drops its empty-scan branch, which
failed any tree with no tools, and exposes `unreached_registrations` so
tests/scripts/test_check_tool_discovery.py can prove it flags a module
registering outside `<pkg>/tool.py` on a temp repo.
2026-11-16 11:52:44 +05:30
alt-glitch
72564e4b7f fix(code-health): check tool discovery in scripts/check, not in a test
The repo-wide check that every module registering a tool at import is one
discovery imports parsed production source from a test, which
tests/AGENTS.md bans. It is now the `tool-discovery` guard
(scripts/check_tool_discovery.py), run by `scripts/check` and its lint.yml
step, using discovery's own `_module_registers_tools` and
`_tool_module_candidates`.
2026-11-16 11:52:44 +05:30