prepare fleet identifier completion batch

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a053ff-1d6f-7fe2-ac1c-a6eb40a42a0c
This commit is contained in:
tegwick 2026-08-31 17:02:19 +02:00
parent c52d222cc6
commit 8f3b8ac2f6
8 changed files with 4691 additions and 8 deletions

View file

@ -74,6 +74,83 @@ def test_projection_preflight_accepts_mixed_convergent_states(monkeypatch) -> No
assert projection["state_counts"]["derived_target"] == 1
def test_projection_preflight_accepts_equivalent_task_duplicate(monkeypatch) -> None:
mapping = {
"action": "replace",
"kind": "task",
"record_id": "ONE-WP-0001-T01",
"current_uuid": "22222222-2222-4222-8222-222222222222",
"derived_uuid": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
}
shared = {
"workplan_id": "11111111-1111-4111-8111-111111111111",
"title": "Equivalent task",
"description": "Same source",
"status": "todo",
"priority": "high",
"assignee": None,
"due_date": None,
"blocking_reason": None,
"needs_human": False,
"intervention_note": None,
"parent_task_id": None,
}
def projection_get(self, url):
value = str(url)
derived = value.endswith(mapping["derived_uuid"])
return httpx.Response(
200,
json={
**shared,
"id": mapping["derived_uuid"] if derived else mapping["current_uuid"],
"record_id": mapping["record_id"] if derived else None,
},
request=httpx.Request("GET", url),
)
monkeypatch.setattr(httpx.Client, "get", projection_get)
result = _projection_migration_preflight([mapping], ["http://hub.test"])
assert result["ok"] is True
projection = result["projections"][0]
assert projection["mode"] == "duplicate_convergence"
assert projection["state_counts"]["duplicate_target"] == 1
def test_projection_preflight_rejects_divergent_task_duplicate(monkeypatch) -> None:
mapping = {
"action": "replace",
"kind": "task",
"record_id": "ONE-WP-0001-T01",
"current_uuid": "22222222-2222-4222-8222-222222222222",
"derived_uuid": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
}
def projection_get(self, url):
value = str(url)
derived = value.endswith(mapping["derived_uuid"])
return httpx.Response(
200,
json={
"id": mapping["derived_uuid"] if derived else mapping["current_uuid"],
"record_id": mapping["record_id"] if derived else None,
"workplan_id": "11111111-1111-4111-8111-111111111111",
"title": "Derived" if derived else "Legacy",
"status": "todo",
"priority": "high",
"needs_human": False,
},
request=httpx.Request("GET", url),
)
monkeypatch.setattr(httpx.Client, "get", projection_get)
result = _projection_migration_preflight([mapping], ["http://hub.test"])
assert result["ok"] is False
assert result["projections"][0]["state_counts"]["both_present"] == 1
def test_projection_migration_client_requires_primary_and_exact_seal(tmp_path: Path) -> None:
repo = tmp_path / "one"
path = repo / "workplans" / "one.md"