Repository navigation
feat(platform): votes through the confirm page - #128
Conversation
| if (!deps.app) return followed; | ||
| const rows = await db.select().from(platformOwnerActions); | ||
| for (const action of rows.filter(inFlight)) { | ||
| for (const action of rows.filter(isOpen)) { |
There was a problem hiding this comment.
🟠 Medium · correctness: Votes signed on the confirm page are dropped from following once the link expires, so the scheduled run rarely sees them
Votes no longer go through submit(), which used to mark the row submitted straight away. The local row now stays status: "prepared" with expiresAt set to the confirm link's expiry (line 408; the fake uses 10 minutes). Only owner/status polling moves the row out of prepared: view() does it while someone has the dashboard open, and followUnsettled() does it on the scheduled run. followUnsettled now filters on isOpen, but a prepared row only counts as open through signable(), which requires expiresAt > now. The scheduled run fires every runMinutes (default 360 minutes), so it almost never lands inside the roughly 10-minute window between the owner signing on the confirm page and the link expiring.
Scenario: the owner opens the confirm link, closes the dashboard, and signs. While the platform is still processing (settleLater/PROCESSING), the link's expiresAt passes before any sweep or view runs. After that, signable() is false, and inFlight() is also false because the status is still prepared and phase is null. The row is never followed again, by either the sweep or view(). It stays prepared and shows as not open, even though the vote was cast and the payout may have settled. Before this PR, the immediate submitted status kept vote rows in flight regardless of expiry. The PR description says the scheduled run covers exactly this case, and it only does if the run happens to fall inside the window.
Suggested fix: Keep following rows that have a confirmUrl and are still prepared/adopted for a grace period after expiresAt, as long as phase isn't ended (for example, up to a day past expiry). That way a signature made just before expiry is still picked up by the next sweep or view. Another option is to keep following until the platform reports an ended phase, since noteStatus already records expired/settled.
Multi Review ·
|
From the first real payout (brief: 'From the first real payout'):