← Back to Pull requests

atepg: Switch to Serializable isolation level for transactions by default #3475

Open
unknown opened this pull request with 282 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 30, 2026 01:18 UTC
Author

As discussed in the community meeting, and in issue #3044, we need to switch to using Serializable isolation by default before 1.0.

Summarizing the arguments so that they are available in the commit history:
It is actually quite difficult to write fully correct applications using Read Committed or Repeatable Read isolation levels. Even Google doesn't try (we set both internal and external Spanner to default to "External Consistency", which is even stronger than Serializable).
We have not explicitly audited for correctness at the default Read Committed isolation level, so it is very likely that there are currently subtle correctness bugs in our implementation that will only be revealed under high load.

Individual code paths can use downgraded consistency levels once we have audited their use of locking or other correctness strategies. Maintaining this auditing will be a heavy ongoing commitment, so we should only do it in places where it truly matters for performance (which might end up being nowhere).

The primary side-effect of upgrading from Read Committed to Serializable is that, when there are n racing transactions that touch the same rows, it is possible for all but one of them to fail with a conflict error. The losing clients must then retry their read-modify-write loops.

Most of the complication in this change comes from ResumeActor, which is covered by a test (TestResumeActor_ConcurrentOntoOneWorker) that checks that, of 128 concurrently resumed actors targeting a single worker, none fail with a conflict error. This test seems like a bad idea, it will always be possible for it to flake. And as a matter of system/production hygiene, retry loops should almost always be driven from the outermost client (the client calling the Substrate API in this case). However, I've preserved the existing behavior for now, which required adding some additional retry loops in the workflow, and cleaning up some error wrapping so that store-layer conflict errors properly reach the workflow code.

Fixes #3044

AI use: AI-assisted, I reviewed, heavily edited, tested, and debugged.

This change is not breaking. Enjoy the same great Substrate flavor you know and love, with fewer heart-stopping data-loss incidents.

Diff: 282 lines (+211 / -71) across 3 files Reviewer: haiyanmeng Review duration: 47229m
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.47) × (1 − Review Confidence (0.41)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 282 lines diff across 3 files
0.47
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
40%
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
Shallow Review Depth shallow_review_depth
0.344
Diff Size diff_size
0.338
Real PR Conversation Timeline
1 comments
"Review active on #3475"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 40.9% 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: 46.7% (MEDIUM) · Higher = larger blast radius
46.7%
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: 40.9% · Lower = rushed or shallow review
40.9%
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: 27.6% · Safe to merge
27.6%