From 413f655d21ddec2139147adad8b0e75f1eb75eed Mon Sep 17 00:00:00 2001 From: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com> Date: Tue, 27 Oct 2026 10:46:28 +0800 Subject: [PATCH] test(projects): assert canonical refusal after rejected registration Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com> --- tests/cli_commands/test_project_registry.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/cli_commands/test_project_registry.py b/tests/cli_commands/test_project_registry.py index ae9261211c..1a2e79b76c 100644 --- a/tests/cli_commands/test_project_registry.py +++ b/tests/cli_commands/test_project_registry.py @@ -101,7 +101,7 @@ def test_completed_registration_recovers_missing_display_from_current_authority( def test_pending_registration_rejects_source_changed_during_validation(recoverable_registration, monkeypatch): from loopx.control_plane.coordination import goal_storage_initialization - from loopx.control_plane.coordination.local_authority import read_canonical_todos_if_promoted + from loopx.control_plane.coordination.local_authority import CanonicalAuthorityRequired, read_canonical_todos_if_promoted arguments = recoverable_registration capture = goal_storage_initialization.build_runtime_shadow_source_snapshot @@ -114,8 +114,14 @@ def changed_capture(**kwargs): monkeypatch.setattr(goal_storage_initialization, "build_runtime_shadow_source_snapshot", changed_capture) with pytest.raises(ValueError, match="source changed during validation"): project_registry.register_project_goal(**arguments) - assert read_canonical_todos_if_promoted( - runtime_root=arguments["runtime_root"], goal_id=arguments["goal_id"]) is None + # Ordinary reads must refuse the uninitialized Goal after registration was + # rejected; the retired pre-cutover None fallback would hide that state. + with pytest.raises(CanonicalAuthorityRequired) as rejected: + read_canonical_todos_if_promoted( + runtime_root=arguments["runtime_root"], goal_id=arguments["goal_id"]) + assert rejected.value.code == "canonical_authority_required" + assert rejected.value.payload["goal_id"] == arguments["goal_id"] + assert rejected.value.payload["legacy_fallback_used"] is False @pytest.mark.parametrize("objective", [