Skip to content

Commit ac709a2

Browse files
Trecekclaude
andcommitted
fix(review): move module-level assert to dedicated test (tools_recipe.py)
Replaces the module-level `assert FLEET_DISPATCH_TOOLS <= GATED_TOOLS` in tools_recipe.py with a proper pytest test in test_canonical_constant_consumption.py. Module-level asserts are silently disabled under python -O and produce unstructured AssertionError output; the invariant is now enforced by the test suite. The FLEET_DISPATCH_TOOLS import is retained with # noqa: F401 as the sole production consumer required by test_registry_constants_have_production_consumer. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f3a53a4 commit ac709a2

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/autoskillit/server/tools/tools_recipe.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
build_config_authoritative_layer,
1414
resolve_ingredient_defaults,
1515
)
16-
from autoskillit.core import FLEET_DISPATCH_TOOLS, get_logger, temp_dir_display_str
16+
from autoskillit.core import FLEET_DISPATCH_TOOLS, get_logger, temp_dir_display_str # noqa: F401
1717
from autoskillit.pipeline import GATED_TOOLS, UNGATED_TOOLS # noqa: F401
1818
from autoskillit.server import mcp
1919
from autoskillit.server._guards import _require_enabled
@@ -30,11 +30,6 @@
3030
)
3131
from autoskillit.server.tools._cancellation_shield import _cancellation_shield
3232

33-
assert FLEET_DISPATCH_TOOLS <= GATED_TOOLS, (
34-
"FLEET_DISPATCH_TOOLS must be a subset of GATED_TOOLS — "
35-
f"extra: {sorted(FLEET_DISPATCH_TOOLS - GATED_TOOLS)}"
36-
)
37-
3833
logger = get_logger(__name__)
3934

4035

tests/arch/test_canonical_constant_consumption.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,14 @@ def test_exemptions_reference_real_constants() -> None:
159159
f"Exemption dict contains names not found in constants files: {sorted(stale)}. "
160160
f"Remove stale entries."
161161
)
162+
163+
164+
def test_fleet_dispatch_tools_subset_of_gated_tools() -> None:
165+
"""FLEET_DISPATCH_TOOLS must be a subset of GATED_TOOLS."""
166+
from autoskillit.core import FLEET_DISPATCH_TOOLS
167+
from autoskillit.pipeline import GATED_TOOLS
168+
169+
extra = FLEET_DISPATCH_TOOLS - GATED_TOOLS
170+
assert not extra, (
171+
f"FLEET_DISPATCH_TOOLS must be a subset of GATED_TOOLS — extra: {sorted(extra)}"
172+
)

0 commit comments

Comments
 (0)