test(8249): the caller-scoping contract is a property of the services, not four lists of names
Review of the signature-flagged tests:
- Four route files each listed service names by hand and checked each takes
user_id. A new service without the caller passed them, and a renamed one
failed them. They become one test over services/{design_systems,systems,
rulebooks,snippets}.py: every public coroutine takes user_id, except eight
named with the reason each needs none, and an exception for a function that
is gone or now takes the caller fails too.
- test_routes_trash was four existence checks: blueprint name, registered,
handlers callable, the service surface, delete's parameter names. It
becomes one check that the three trash routes are on the app; what they do
is proven by test_services_trash and test_mcp_tool_trash.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -37,23 +37,6 @@ def test_topic_handlers_callable():
|
||||
assert callable(getattr(rb_routes, name))
|
||||
|
||||
|
||||
def test_service_signatures_require_user_id():
|
||||
"""Routes must call services with user_id — verify the contract."""
|
||||
from grimoire.services import rulebooks as svc
|
||||
for fn_name in (
|
||||
"create_rulebook", "list_rulebooks", "get_rulebook",
|
||||
"update_rulebook", "delete_rulebook", "find_rulebook_by_title",
|
||||
"create_topic", "list_topics", "get_topic", "update_topic", "delete_topic",
|
||||
"create_rule", "create_project_rule", "rule_detail",
|
||||
"set_rule_systems", "add_rule_relation", "remove_rule_relation",
|
||||
"list_rules",
|
||||
"get_rule", "update_rule", "delete_rule",
|
||||
"get_applicable_rules",
|
||||
):
|
||||
sig = inspect.signature(getattr(svc, fn_name))
|
||||
assert "user_id" in sig.parameters, f"{fn_name} missing user_id param"
|
||||
|
||||
|
||||
def test_rule_model_carries_project_id_and_topic_id_nullable():
|
||||
"""Migration 0059 made topic_id nullable and added project_id."""
|
||||
from grimoire.models.rulebook import Rule
|
||||
@@ -112,7 +95,6 @@ def test_the_rule_list_zero_fills_usage_on_every_row():
|
||||
reading `undefined` on almost every row — and the difference between "no
|
||||
events" and "no field" is exactly the distinction a readout must keep.
|
||||
"""
|
||||
import inspect
|
||||
|
||||
from grimoire.routes import rulebooks as rb_routes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user