Repository navigation
fix: spark exit repeat fee ask notification - #1333
Conversation
A withdrawn fee ask now forgets that its reminder fired, so a later ask for the same amount posts a notification again.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 727fe2e0ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
[Low impact] The change is limited to fee-reminder notifications for Spark exits. The background withdrawal path needs the same cleanup before this fix is ready to merge. Findings
SummaryClears remembered funding reminders when a foreground tick withdraws a fee ask.
Reviews (1) · Last reviewed commit: "fix: spark exit repeat fee ask notificat..." · Reviewed by Greptile |
talosmachina
left a comment
There was a problem hiding this comment.
No findings. When a fee ask is withdrawn, dismissDeliveredFundingNotifications now also drops the exit's funding- ids from the remembered reminders, so a later ask for the same requiredSats (same id) is no longer treated as fired for 30 days. Reviewed 727fe2e, light tier (one function in SparkExitManager.swift, plus the test).
What I checked, and 3 candidates I ruled out
Read: tick(), afterTick, scheduleReminders, reminderDate, keepingFired, notificationId, isFundingAskWithdrawn and clearReminders in SparkExitManager.swift.
Ordering traced: the class is @MainActor. tick() calls dismissDeliveredFundingNotifications synchronously right after isFundingAskWithdrawn, then afterTick runs scheduleReminders, which reads rememberedReminders() after the UserDefaults write. So that same tick cannot put the forgotten id back through keepingFired.
Ruled out
- The forgotten id coming back from
kept:isFundingAskWithdrawnrequiresrecord.phase == .running, so the plan forupdatedholds no funding reminder andkepthas nofunding-id. - Forgetting more than the withdrawn ask: the filter matches the same ids the delivered notification removal already matched (this exit's prefix plus
funding-). Other steps' fired reminders stay, and the test asserts that for1-h3000. - A concurrent writer of
sparkExitReminders:scheduleRemindersandclearRemindersrun on the main actor too, and every tick path is serialised byisTicking.
Build: not built here. iOS does not build on this Linux reviewer, so this is reasoned from the code. SwiftFormat passed; Run Tests was still running when this review was posted.
Merge confidence: 4/5, no findings and the change is covered by testAFeeAskAskedAgainAfterAWithdrawalPostsAReminder, but the unit tests had not finished in CI at review time.
Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed (the run's metadata available to this reviewer does not carry the setting)
A background run that withdraws a fee ask now takes back its notification and forgets its fired reminder, as a foreground tick does.
pwltr
left a comment
There was a problem hiding this comment.
Reviewed ba1e87f. No issues found.
Withdrawing a fee ask now drops the exit's fired funding-<sats> and await-funding-<sats> ids from sparkExitReminders, so a later ask for the same amount posts again. Other steps' fired reminders stay. The write happens synchronously before afterTick runs scheduleReminders, so keepingFired can't restore the id in the same run. runInBackground now runs the same check against the record it started from. A fee ask that funding actually satisfied keeps its 30-day memory, as before.
Review details
General review
Model: Claude Opus 5.5
Reasoning effort: high
jvsena42
left a comment
There was a problem hiding this comment.
No findings at ba1e87f65.
Checked:
- The withdrawal path now removes only this exit's
funding-/await-funding-ids fromsparkExitReminders(SparkExitManager.swift:1604-1610), on the foreground tick and, since ba1e87f, on background runs. A later same-amount ask (funding-<requiredSats>) now notifies again instead of staying silent for 30 days. - Ordering: the class is main-actor isolated and the reminders write happens before the same run schedules reminders, so that run cannot re-add the forgotten id.
- Funds: the driver,
isFundingAskWithdrawn, funding adoption and the in-flight savings-payment check are untouched; only notification bookkeeping changes. A re-ask still requires the same unconfirmed-payment conditions as before, and an earlier payment stays adoptable or sweepable at the funding address. - Parity: Android posts the funding alert on every transition into
NeedsFundingwith no per-amount memory, so this brings iOS in line; no Android twin needed. - No upgrade concern:
SparkExitManager.swiftis not in v3.1.1. Not performance-relevant (one UserDefaults read/write per withdrawal).
needsFunding through an unverified rebuild (a chain host that fails to read a step across two checks), which needs fault injection in the chain backend that is not available on my setup. The approval rests on the code trace, SparkExitTests, and green CI; the notification repost is still unrun on a device.
Reviewer model: claude-opus-5-5 (primary review and coordination)
Reasoning effort: not exposed (subagent), default (coordinator)
Fixes #1324
Description
isFundingAskWithdrawn) now also forgets the exit's firedfunding-reminders insparkExitReminders, not only its delivered notifications. A later ask for the samerequiredSatsreuses the idfunding-<requiredSats>, so before thisreminderDatesaw it as fired for 30 days and posted nothing.dismissDeliveredFundingNotifications, before the same tick'sscheduleRemindersreads the remembered dates, so that run never puts the id back.runInBackground) now check for a withdrawn ask too, as the foreground tick does, so an ask a background run withdraws gets the same cleanup.Found by Greptile in #1323 (comment).
Out of Scope
None.
Design
N/A — no UI changes.
Preview
N/A — no user-visible changes.
QA Notes
Setup
N/A — no device testing required: staging a withdrawn fee ask and a repeat ask for the same amount needs a Spark exit on regtest with controlled fee builds; the unit test covers the reminder bookkeeping.
Journeys
N/A — not drivable; see Manual Tests.
Manual Tests
N/A
Automated Checks
SparkExitTests.swift— a fee ask withdrawn and asked again for the same amount posts a reminder, while another step's fired reminder stays rememberedEvidence
SparkExitTestsandSparkExitReviewTestspass on this PR's head on an iPhone 17 simulator.swiftformat --lintpasses on the changed files.Gaps
forgettingFundingReminders,keepingFired,reminderDate), notUNUserNotificationCenteror the background run's wiring.Models used
claude-opus-5-5(reasoning:medium)claude-opus-5-5(reasoning:medium)