← Back to Pull requests

Support `NOT DEFERRABLE` and `DEFERRABLE INITIALLY DEFERRED` Foreign Key constraints #9

Open
LilyFirefly opened this pull request with 384 lines diff across 7 files
View on GitHub
LilyFirefly LilyFirefly commented on Sep 15, 2026 09:54 UTC
Author

Rename ImmediateDeferrableFKConstraint to ForeignKeyConstraint to represent the expanded scope.
Refactor migration tests to use the correct historical models, instead of relying on the fully migrated models being backward compatible.
Add test for ForeignKeyConstraint.deconstruct.
Add tests for setting constraints to DEFERRED or IMMEDIATE at run-time on postgresql.

Fixes #7.

Diff: 384 lines (+333 / -51) across 7 files Reviewer: p-r-a-v-i-n Review duration: 117430m
All Vouch review confidence checks passed
Residual risk 0.11 = Change Risk (0.54) × (1 − Review Confidence (0.79)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.54 · 384 lines diff across 7 files
0.54
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.69 · 1 substantive comment(s)
0.69
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
79%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.356
Real PR Conversation Timeline
3 items
p-r-a-v-i-n p-r-a-v-i-n commented on Sep 16, 2026 12:57 UTC
Reviewer

Sorry for writing here randomly. ORM part really interest me these days.

Do you think we should add any positive test here for when deffered is not immediate.

for example something like

with transaction:
       create_book instance
       create_author instance


this suppose to pass.

LilyFirefly LilyFirefly commented on Sep 16, 2026 13:03 UTC
Author

Do you think we should add any positive test here for when deffered is not immediate.

Yes, good point! I'm happy to review a PR.

Reviewers
Assignees
LilyFirefly LilyFirefly
Labels
risk: low confidence: 79.3% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 54.4% (MEDIUM) · Higher = larger blast radius
54.4%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 79.3% · Lower = rushed or shallow review
79.3%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 11.3% · Safe to merge
11.3%