fix(provider): survive legacy order keys in the startup registry sync #21284
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 302 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.342
Real PR Conversation Timeline
1 comments
"Review active on #21284"
general
weight: 0.35
ggbdpq
Summary
Fixes #21282.
2.1.4's startup provider-registry sync feeds order keys through the fractional-indexing generator, and
zz— the old end-of-list sentinel that earlier Cherry Studio builds themselves wrote — failsvalidateOrderKeyinsidegenerateOrderKeySequenceBetween, soDbServiceinit force-exits and the install cannot boot. The failure is network-gated (the upsert only runs when the registry fetch succeeds), which is why it masquerades as flaky.On the regression window: the crash path (
batchUpsertTx→insertManyWithOrderKey) has existed since the v2 data layer (e59c7aa7f7); 2.1.3 avoided it only becauseSeedRunnerskips seeders by seed version. 2.1.4's registry major bump makes the first launch re-run the seeders, which is what finally feeds a legacyzzinto the generator.The fix is single-point tolerance at the shared root:
insertManyWithOrderKeyprobes boundary-key validity with the library's owngenerateKeyBetween(the validator isn't exported), re-keys offending rows after their nearest valid neighbor (a0when none), logs a warning, and continues — ordering preserved, bothfirstandlastscopes covered. Every caller (ProviderService.batchUpsertTx,ModelService, seeders) inherits the tolerance. The issue's separate ask — a real error dialog whenDbServiceinit fatality force-exits — is intentionally out of scope here.Verification
| Check | Result |
| --- | --- |
| New tests: legacy
order_key='zz'row survives the startup sync and is re-keyed; no-neighbor fallback;first/lastscopes; unrelated rows untouched | red before fix (6 cases threwinvalid order key: zz), all green after ||
orderKey.test.ts+ProviderService.batchUpsert.test.ts| 49/49 passed || Full
src/main/datasuite (shared module touched) | 193 files passed, 3869 tests passed / 1 skipped ||
pnpm typecheck(node / web / e2e) | all exit 0 ||
oxfmt --checkon changed files | pass |AI Use
Implemented with GLM-5.3-Flash (ZCode). Root cause localization, patch and tests by AI; regression-window archaeology corrected during investigation and stated in the commit message; verified locally as listed above.
Checklist
pnpm typecheckpasses locally