fix: resolve lighthouse skill objects from TCS root

This commit is contained in:
冰朔 2026-09-08 14:17:29 +08:00
commit b1533ef23a
6 changed files with 16 additions and 3 deletions

View file

@ -80,6 +80,8 @@ def validate_root(root: dict[str, Any]) -> None:
if route_ids != ["ROUTE-BINGSHUO-FIFTH-001", "ROUTE-GUANGHU-TEAM-ZS-001", "ROUTE-PUBLIC-PERSONAL-001"]:
raise RootError("THREE_ENTRY_ROUTES_MISMATCH")
all_ids = [world["registration_path_id"], world["world_node_id"], root["root_agent"]["entry_id"], *domain_ids, *human_roots]
public_objects = root.get("registered_public_objects", [])
all_ids.extend(item["id"] for item in public_objects)
if len(all_ids) != len(set(all_ids)):
raise RootError("CURRENT_CANONICAL_ID_COLLISION")
@ -131,6 +133,7 @@ def build(repo: Path, commit: str | None = None) -> dict[str, Any]:
"world_root": root["language_world_root"],
"parallel_human_roots": root["parallel_human_roots"],
"fixed_domains": root["fixed_domains"],
"registered_public_objects": root.get("registered_public_objects", []),
"entry_routes": root["entry_routes"],
"aliases": root["aliases"],
"history_only_numbers": root["history_only_numbers"],
@ -219,6 +222,7 @@ def resolve(output: Path, requested: str, kind: str | None) -> dict[str, Any]:
{"canonical_id": current["entry_id"], "object_kind":"TCS_MOTHER_ROOT_NAVIGATION_ENTRY", "lifecycle":"CURRENT", "source_revision":current["source_revision"]},
*[{"canonical_id": item["id"], "object_kind":item["object_kind"], "lifecycle":"CURRENT", "source_revision":current["source_revision"], "route":item.get("route")} for item in current["parallel_human_roots"]],
*[{"canonical_id": item["id"], "object_kind":item["object_kind"], "lifecycle":"CURRENT", "source_revision":current["source_revision"], "name":item["name"]} for item in current["fixed_domains"]],
*[{"canonical_id": item["id"], "object_kind":item["object_kind"], "lifecycle":item["lifecycle"], "source_revision":current["source_revision"], "name":item["name"], "route":item.get("route")} for item in current.get("registered_public_objects", [])],
]
matches = [item for item in current_nodes if item["canonical_id"] == requested and (kind is None or item["object_kind"] == kind)]
if len(matches) == 1:

View file

@ -33,6 +33,8 @@ class RootAgentTest(unittest.TestCase):
self.assertEqual(MODULE.resolve(output, 'TCS-0002∞', None)['result']['object_kind'], 'GUANGHU_HUMAN_TEAM_BODY_ROOT')
self.assertEqual(MODULE.resolve(output, 'TCS-0002', 'GUANGHU_HUMAN_TEAM_BODY_ROOT')['state'], 'TYPED_ALIAS_RESOLVED')
self.assertEqual(MODULE.resolve(output, 'GLW-SYS-0001', None)['state'], 'HISTORY_ONLY_NO_CURRENT_ROUTE')
self.assertEqual(MODULE.resolve(output, 'CH-LIGHT-ARRIVAL-SKILL-0001', 'WORLD_SKILL_CONTRIBUTION_CHANNEL')['result']['route'], 'gls/light-arrivals/SKILL-CONTRIBUTION-CHANNEL.hdlp')
self.assertEqual(MODULE.resolve(output, 'SYS-GLW-LTH-SKILL-0001', None)['result']['object_kind'], 'LIGHTHOUSE_SKILL_MODULE_ZONE')
again = MODULE.refresh(ROOT, output, pointer, 'test')
self.assertEqual(again['state'], 'CURRENT_IDEMPOTENT')