Repository navigation
fix(settings): keep a coverage edit typed during its pending service PUT - #638
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour. 📝 WalkthroughWalkthroughService coverage saving now initializes from the loaded service value or global default. Successful saves preserve edits made while a request is pending and update the saved snapshot. Tests cover failed global and service requests, retries, in-flight edits, and payment save-state clearing. ChangesSettings save-state tracking
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue is established for the settings save-state change; it is mergeable after normal checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Closes #576. Stacked on PR #635 (same function and test block); base is its branch and retargets to main when #635 merges.
Present on main (3413591): saveGlobalSettings service
.thenranel.value = String(coverage)unconditionally, so a value typed while that PUT was pending was replaced by the sent value (frontend/src/settings.ts, the coverageId block after updateServiceConfig). The final TRACKED_FIELDS advance loop had no test.Fix: write the persisted value to the card only when the card still equals what this Save read (sentFields[coverageId]); the snapshot always records the persisted value. An edit typed during the PUT therefore stays dirty and is sent by the next Save. Untouched cards still show the propagated default (the existing propagation tests cover it). Edits to payment, term and enabled were already preserved.
Tests (settings.test.ts, coverage block): (1) 77 typed during the pending PUT survives, isUnsavedChanges stays true, the next Save sends 77, then clean. On main step 1 fails: card.value is reset to 60. (2) edit aws-ec2-payment, Save, isUnsavedChanges() is false; pins the advance loop (passes on main by design; it kills the removal mutant from the review). Jest cannot run offline here; verified by tracing the code, CI is the authority.
Not changed: the theoretical revert-during-PUT case from the issue, #539, #617.
Summary by CodeRabbit