fix(import): Eltern-/Herkunft-/Dubletten-Korrekturen — Ticket-Triage Cluster

Akane (Roni=Vater male + Mutter Fumi), Sunny (Bill+Melly), Danielle (Mutter Ella,
motherDob-Disambiguierung), Cherry Berry (female), Black-Forest-Label vereinheitlicht,
namenloser Bock entdoppelt (mergeExternalRefs).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-23 08:25:43 +02:00
parent a66739e84d
commit 72ad706ca6
4 changed files with 319 additions and 5 deletions

View File

@@ -490,6 +490,50 @@ if _os.path.exists(_resolved):
_check_parents("#35 Zac", "Zac gen. Action", "Vance", "Dorie")
_check_parents("#9 Beatrice", "Beatrice von den kleinen", "Dante", "Malina")
_check_parents("#30 Theodore", "Theodore von den Kleinen", "BlackFire", "Katara")
# ── New ticket-triage fixes (non-genetics import cluster) ─────────────────
# Akane: Roni is the FATHER (gender flipped male), mother = Fumi (stub).
_check_parents("Akane (wrong-parents)", "Akane", "Roni", "Fumi")
_roni = next((g for g in _d["gerbils"]
if g["Name"] == "Roni" and g.get("DateOfBirth") == "2022-01-27"), None)
check("Roni: gender flipped to male", _roni is not None and _roni.get("Gender") == "male")
_fumi = _find("Fumi von den Kleinen")
check("Fumi: materialised as a non-resident stub",
_fumi is not None and _fumi.get("IsResident") is False)
# Sunny von PZ Karl: father corrected Hiro → Bill von Privat.
_check_parents("Sunny (parents)", "Sunny von PZ Karl", "Bill von Privat", "Melly von Privat")
# Danielle: mother = Ella *10.06.2019 (the elder one), father unknown.
_dan = _find("Danielle von den Kleinen")
_df, _dm = _parents(_dan)
check("Danielle: mother is Ella", (_dm or "") == "Ella")
check("Danielle: father unknown (sibling pairing)", _df is None)
if _dan and _dan.get("LitterId"):
_dl = _L.get(_dan["LitterId"])
_dmom = _G.get(_dl.get("MotherId")) if _dl else None
check("Danielle: mother Ella is the *2019-06-10 one (not the *2023 Ella)",
_dmom is not None and _dmom.get("DateOfBirth") == "2019-06-10")
# Cherry Berry's Quqquluuruu: gender override female (box colour misread).
_cherry = _find("Cherry Berry")
check("Cherry Berry: gender override female",
_cherry is not None and _cherry.get("Gender") == "female")
# Origin-label: all 'of Black Forest' animals → 'Clan of Black Forest', no
# animal left on the old 'Black Forest' label and no duplicate contact.
_bf_left = [g for g in _d["gerbils"] if (g.get("OriginBreeder") or "") == "Black Forest"]
check("Origin-label: no animal still on 'Black Forest'", len(_bf_left) == 0)
_bf_contacts = [c for c in _d["contacts"] if c["Name"] == "Black Forest"]
check("Origin-label: stray 'Black Forest' contact merged away", len(_bf_contacts) == 0)
# Duplicate-merge: the nameless buck *15.02.2024 (son of Inochi gen. Picu)
# exists only once after the externalRef merge.
_bucks = [g for g in _d["gerbils"]
if g.get("DateOfBirth") == "2024-02-15"
and "unbekannt" in (g.get("ExternalRef") or "").lower()]
check("Duplicate-merge: nameless buck *15.02.2024 deduped to one record",
len(_bucks) == 1)
else:
print("note: output/resolved_import.json not present — skipped integration assertions")