Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions tests/cli_commands/test_project_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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", [
Expand Down
Loading