feat(backend): harden T5 — divergence comment + invariant tests

This commit is contained in:
Tyler
2026-06-19 21:51:43 -06:00
parent 0cc74dc173
commit 846944448a
2 changed files with 83 additions and 0 deletions
+6
View File
@@ -233,6 +233,12 @@ class Remittance(Base):
String(32), ForeignKey("batches.id", ondelete="CASCADE"), nullable=False
)
payer_claim_control_number: Mapped[str] = mapped_column(String(64), nullable=False)
# ORM policy: no ON DELETE (forward FK from Remittance → Claim). A claim
# is unlikely to be deleted in normal flow (audit trail); if it ever is,
# the application layer (T7 reconciliation) must clear this FK. The
# migration predates this rationale; amendment deferred to post-SQLite
# rollout. SQLite without `PRAGMA foreign_keys=ON` does not enforce,
# so the divergence is benign in this engine.
claim_id: Mapped[Optional[str]] = mapped_column(
String(64), ForeignKey("claims.id"), nullable=True
)