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

@ -375,9 +375,51 @@ def _projection_migration_preflight(
A projection may legitimately be mixed when forge reconciliation created
some deterministic targets before the sealed migration ran. Legacy-source
and derived-target are both convergent states; both-present and neither-
present are ambiguous and remain hard refusals.
and derived-target are both convergent states. An exact task duplicate is
also convergent when the legacy row has no conflicting canonical identity
and both API representations have identical business fields; State Hub
rechecks that equivalence and proves the legacy row is unreferenced inside
the apply transaction. Other both-present and all neither-present states
remain hard refusals.
"""
duplicate_fields = (
"workplan_id",
"title",
"description",
"status",
"priority",
"assignee",
"due_date",
"blocking_reason",
"needs_human",
"intervention_note",
"parent_task_id",
)
def mergeable_task_duplicate(
mapping: dict[str, Any], current: httpx.Response, derived: httpx.Response
) -> bool:
if mapping.get("kind") != "task":
return False
try:
legacy_payload = current.json()
derived_payload = derived.json()
except ValueError:
return False
record_id = mapping.get("record_id")
return (
isinstance(legacy_payload, dict)
and isinstance(derived_payload, dict)
and legacy_payload.get("id") == mapping.get("current_uuid")
and derived_payload.get("id") == mapping.get("derived_uuid")
and legacy_payload.get("record_id") in {None, record_id}
and derived_payload.get("record_id") == record_id
and all(
legacy_payload.get(field) == derived_payload.get(field)
for field in duplicate_fields
)
)
projections: list[dict[str, Any]] = []
errors: list[dict[str, str]] = [
{
@ -422,7 +464,15 @@ def _projection_migration_preflight(
(200, 200): "both_present",
(404, 404): "neither_present",
}.get(status_pair, "unexpected_status")
check_ok = state in {"legacy_source", "derived_target"}
if state == "both_present" and mergeable_task_duplicate(
mapping, current, derived
):
state = "duplicate_target"
check_ok = state in {
"legacy_source",
"derived_target",
"duplicate_target",
}
check = {
"record_id": mapping.get("record_id"),
"kind": mapping.get("kind"),
@ -452,6 +502,7 @@ def _projection_migration_preflight(
for state in (
"legacy_source",
"derived_target",
"duplicate_target",
"both_present",
"neither_present",
"unexpected_status",
@ -463,8 +514,10 @@ def _projection_migration_preflight(
if convergent_states == {"legacy_source"}
else "file_convergence"
if convergent_states == {"derived_target"}
else "duplicate_convergence"
if convergent_states == {"duplicate_target"}
else "mixed_convergence"
if convergent_states == {"legacy_source", "derived_target"}
if convergent_states
else "blocked"
)
projections.append(