Back to sandboxing
Database sandbox / May 13, 2026

Imladri patched branch-local foreign-key actions in governed Postgres sandboxes.

The previous 5B-row follow-up found that COW branch views needed explicit FK enforcement. This patch rerun proves branch-local orphan rejection, restrict, cascade, set-null, and set-default behavior, plus deferred constraints, composite MATCH FULLkeys, self-referential FKs, and multi-branch regression coverage while keeping source mutations at zero. A May 15 rerun also put the FK fixture under 100-way concurrent branch pressure and passed after the database pool burst path was hardened.

Result

The patched COW branch trigger generator now carries source FK metadata into the branch view triggers. Child writes are checked against the branch-local parent view, deferrable checks run on the overlay at transaction end, and parent updates/deletes apply the configured FK action to branch-local child rows.

This keeps the article chain honest: the 1B article proves the original branch lifecycle, the 5B article records the scale upgrade and FK gap, and this article records the fix.

Patch

The FK fix is branch-local.

The source database is not mutated to make the branch work. Imladri creates overlay/deleted tables and view triggers inside the branch schema, then enforces FK behavior at that boundary.

ProblemCopy-on-write branch views protected the source table but did not automatically inherit table-level FK behavior.
FixGenerated branch triggers now check outgoing FK writes, deferred overlay checks, and parent-side referential actions against the cloned branch views.
RerunThe patched benchmark rejected orphan children, rejected restricted parent changes, cascaded branch-local children, applied set-null/default, honored composite MATCH FULL, deferred repair/rejection, self-reference, and multi-branch isolation without source mutations.
Concurrency hardeningA first 100-way FK regression exposed connection acquisition timeouts under burst load. The benchmark now uses bounded shared verification and configurable target pool timeouts; the rerun completed 100/100 concurrent FK branches with no deadlocks and zero source mutations.
Hardening completeThe listed FK gaps are now covered by the public boundary benchmark. Future work is broader production schema coverage, not this specific gap list.
Rerun

The full boundary benchmark passed after the patch.

The rerun kept the broader database-agent checks intact: concurrent branches, heavy branch writes, cleanup, source isolation, composite keys, deferred checks, self-references, and separate branch visibility all passed while the FK behavior moved from a known gap to a passing proof. The latest artifact adds the missing concurrency answer: 100 simultaneous FK branches completed valid writes, denied orphan writes, applied update/delete cascades, and cleaned up with zero source mutations.

CheckResultStatusTimingSource state
Concurrent branches100 / 100 succeeded0 deadlocks2339.46ms p50 / 4030.78ms p95 create0 source mutations
1M branch writes1,000,000 overlay rows20,924 rows/sec35.58ms cleanup0 source mutations
10M branch writes10,000,000 overlay rows15,797 rows/sec434.34ms cleanup0 source mutations
Multi-table FK actions10 related tablesrestrict, cascade, set-null, set-default, MATCH FULL, deferred, self-ref, multi-branch passed7/7 proof0 source mutations
Concurrent FK branches100 / 100 succeededvalid writes, denied orphans, update/delete cascade0 deadlocks0 source mutations
Hardening update

The named FK gap list is now covered.

This closes the previously listed FK hardening targets: deferred constraints, composite MATCH FULL keys, self-referential foreign keys, and multi-branch regressions. The May 15 concurrency rerun also closed the pool-timeout issue found by the first 100-way FK attempt. It does not claim every possible production schema shape is exhausted; it claims this named gap set now has passing artifact-backed coverage.

Evidence

Artifact is public.

The JSON artifact records the full fixed run, including the parent-side FK action booleans, deferred/MATCH FULL/self-ref/ multi-branch booleans, the 100-way FK concurrency result, and0 source mutations.

Open FK fix JSON