From d8393f77fcfee73dbd878685b3c06c4c20411ddf Mon Sep 17 00:00:00 2001 From: Tom Softreck Date: Thu, 6 Aug 2026 09:40:11 +0200 Subject: [PATCH] fix(docs): report a missing node type registry instead of failing as a defect check_node_types.py reads the node type registry from the sibling urirun checkout via MONOREPO/urirun/adapters/python. That path exists only in the monorepo layout, so an isolated clone of this repository - a CI checkout on its own - raised ModuleNotFoundError: No module named 'urirun' and failed `make test` for a reason unrelated to the documentation being checked. It now detects the missing registry and skips with a stated reason. An environment limit is reported as one instead of masquerading as a documentation defect. Where the registry must be present, set DOCS_REQUIRE_NODE_TYPE_REGISTRY=1 and its absence fails. This matters beyond this repository: subactor/repair-agent had added a hardcoded exemption swallowing exactly this failure string during its full validation stage, which turned a real failing test into a pass for every repository it validates. With the cause fixed here, that exemption can be removed. Verified: monorepo checkout runs the full check, 10 node types and 0 errors; an isolated copy skips and `make test` exits 0; with DOCS_REQUIRE_NODE_TYPE_REGISTRY=1 the isolated copy exits 1. Co-Authored-By: Claude Opus 5 --- scripts/check_node_types.py | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/scripts/check_node_types.py b/scripts/check_node_types.py index 9b0009d..999336a 100644 --- a/scripts/check_node_types.py +++ b/scripts/check_node_types.py @@ -2,6 +2,7 @@ """Validate docs/node-types.md against the host node type registry.""" from __future__ import annotations +import os import pathlib import sys @@ -9,10 +10,26 @@ ROOT = pathlib.Path(__file__).resolve().parents[1] MONOREPO = ROOT.parent NODE_TYPES_MD = ROOT / "node-types.md" +REGISTRY_PATH = MONOREPO / "urirun" / "adapters" / "python" + + +class RegistryUnavailable(RuntimeError): + """The sibling urirun checkout this check reads is not present.""" def _load_registry_ids() -> tuple[list[str], dict[str, str]]: - sys.path.insert(0, str(MONOREPO / "urirun" / "adapters" / "python")) + # The registry lives in the sibling urirun checkout, so this check can only + # run inside the monorepo layout. An isolated clone - a CI checkout of this + # repository on its own - has no urirun, and the import raised + # ModuleNotFoundError, failing `make test` for a reason that has nothing to + # do with the documentation being checked. It now reports the environment + # limit as one instead of letting it masquerade as a documentation defect. + if not (REGISTRY_PATH / "urirun" / "host" / "node_types.py").is_file(): + raise RegistryUnavailable( + f"node type registry not found at {REGISTRY_PATH}; " + "this check needs the sibling urirun checkout" + ) + sys.path.insert(0, str(REGISTRY_PATH)) from urirun.host.node_types import NODE_TYPE_ALIASES, NODE_TYPE_PROFILES # noqa: PLC0415 ids = [str(item["id"]) for item in NODE_TYPE_PROFILES] @@ -25,7 +42,18 @@ def _load_registry_ids() -> tuple[list[str], dict[str, str]]: def main() -> int: - ids, aliases = _load_registry_ids() + try: + ids, aliases = _load_registry_ids() + except RegistryUnavailable as exc: + # Skipping is the honest outcome, and it is stated rather than implied. + # Set DOCS_REQUIRE_NODE_TYPE_REGISTRY=1 where the registry must be + # present - a monorepo pipeline - so its absence is a failure there. + print(f"SKIP: {exc}") + if os.environ.get("DOCS_REQUIRE_NODE_TYPE_REGISTRY") == "1": + print("FAIL: DOCS_REQUIRE_NODE_TYPE_REGISTRY=1 but the registry is unavailable") + return 1 + return 0 + text = NODE_TYPES_MD.read_text(encoding="utf-8") errors = 0 for node_type in ids: