Ziel
The database itself rejects impossible line-item indexes in field_corrections.item_index (added in migration 0014, PR #42). Today only the review service validates the index before the insert.
Akzeptanzkriterien
Nicht Teil dieser Aufgabe
- An upper bound tied to the number of extracted line items (stays in the app – it depends on the latest run).
Betroffene Bereiche
src/db/schema/app.ts, new migration under src/db/migrations/, docs/technical/data-model.md
Testplan
| Kriterium |
Prüfart |
| Negative index rejected |
integration test (real Postgres) |
| Migration applies on existing data |
pnpm verify on a fresh DB + migration test |
Security/Privacy betroffen?
Nein.
Deliberately not done in PR #42 so the stacked migration numbers (0014/0015) stayed stable. Must be created after the stack #21 … #45 is merged.
Ziel
The database itself rejects impossible line-item indexes in
field_corrections.item_index(added in migration 0014, PR #42). Today only the review service validates the index before the insert.Akzeptanzkriterien
CHECK (item_index IS NULL OR item_index >= 0)onapp.field_corrections.item_indexasapp_rwfails with a constraint violation.docs/technical/data-model.mdlists the constraint.Nicht Teil dieser Aufgabe
Betroffene Bereiche
src/db/schema/app.ts, new migration undersrc/db/migrations/,docs/technical/data-model.mdTestplan
pnpm verifyon a fresh DB + migration testSecurity/Privacy betroffen?
Nein.
Deliberately not done in PR #42 so the stacked migration numbers (0014/0015) stayed stable. Must be created after the stack #21 … #45 is merged.