Gulum fd48f7fc09 Fix import FK fault: derived/back-linked litter referenced a not-yet-inserted parent
BUG (blocked the supervised live re-import): /import/execute threw
Npgsql 23503 FK_Litters_Gerbils_FatherId and rolled back. Root cause was
INSERT ORDERING — synthesized derived litters were SaveChanges()'d BEFORE
the parent gerbils (created later in the animal loop), so the litter's
Father/MotherId pointed at rows that didn't exist yet. The dry-run and the
EF in-memory test provider don't enforce FKs, so it slipped through.

Fix:
- Stage synthesized litters in the context but DON'T save them early; the
  single SaveChanges after the animal loop lets EF order parents → litters →
  offspring (all FKs nullable). Saving litters first was the fault.
- FK-integrity guard (god's spec): compute the persisted set (existing DB +
  this run's loadable) and null out any litter parent FK not in it; SKIP a
  derived litter whose BOTH parents are unresolvable (offspring loads with
  LitterId=null). Quarantined parents already resolve to null via
  ResolveParentGid; this is defense-in-depth + makes the invariant explicit.
- Report litterParentFksDropped + derivedLittersSkipped (LitterSummary) +
  a German note — so a green dry-run (0/0) GUARANTEES execute won't FK-fault.

Tests: two SQLite-backed regressions (SQLite enforces FKs, unlike the
in-memory provider) — a derived litter with NEW chart parents executes
without throwing, and a quarantined parent leaves that FK null. 120 C#
tests + python green; no schema change (has-pending clean).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-06 11:32:44 +02:00
2023-10-30 16:39:14 +01:00
2023-10-30 16:39:14 +01:00
2023-10-16 20:51:16 +02:00

GerbilManager

  • GerbilManagerWebAPI/ — ASP.NET Core backend (Swagger unter /swagger)
  • gerbil-manager-web/ — React-Frontend (Vite + TypeScript), siehe gerbil-manager-web/README.md

Requirements

Install ef:

dotnet tool install --global dotnet-ef

Used cmd´s

Start containers

docker compose up

Create the initial database

dotnet ef database update

Create an migration script

dotnet ef migrations add

Docker

force compose rebuild

docker-compose build --no-cache

Frontend (gerbil-manager-web)

cd gerbil-manager-web npm install npm run dev

TODO:

  • Backup docker volume database
  • run "dotnet ef database update" if no database exist.
Description
No description provided
Readme 13 MiB
Languages
C# 43%
TypeScript 34.5%
Python 18%
CSS 3.7%
Shell 0.5%
Other 0.1%