Skip to content

feat(platform): votes through the confirm page - #128

Merged
agency-builder merged 1 commit into
stagingfrom
feature/votes-confirm-page
Nov 26, 2026
Merged

agency-builder merged 1 commit into
stagingfrom
feature/votes-confirm-page

Conversation

@agency-builder

Copy link
Copy Markdown
Collaborator

From the first real payout (brief: 'From the first real payout'):

  • A vote on a held payout is signed only on the platform's confirm page, which shows payee, amount, delivery, the held payout and repeats; the dashboard drops the readable vote text, which names neither payee nor amount.
  • Without a confirm link (the platform makes one only when it can prove the payout's terms), the vote isn't offered.
  • After preparing any confirm-page action, the card links straight to the page.
  • The scheduled run also follows unsigned, unexpired actions, so a vote signed on the confirm page with the dashboard closed is still followed.
  • e2e on the platform's local stack (main 7c3a9cd): reject and approve votes through /confirm/v1/; rejected never sent again, approved paid once.

@multi-review multi-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline findings for d8eb7eb; see the summary comment for the rest.

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)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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

multi-review Bot commented Nov 26, 2026

Copy link
Copy Markdown

Multi Review · d8eb7eb

This change routes every held-payout vote through the platform's confirm page. The server refuses to offer a vote when the platform returns no confirm link, and it stops returning the readable vote text. The UI now shows a link to the confirm page, and the scheduled sweep (followUnsettled) now also checks prepared actions that haven't expired. The server and UI changes are consistent with each other. The main risk is that local vote records may never be updated: the dashboard only learns about a confirm-page signature through polling, and polling stops once the action's local expiresAt passes.

1 issue(s) (1 commented inline)

What was checked (8 areas)
  • prepare(): new vote/confirm guard, readable intent suppression, record() of confirmUrl/expiresAt, and the same reuse path via storedIntent
  • submit(): votes now have intent=null, so submit rejects them; integration test expects this
  • followUnsettled() switch from inFlight to isOpen; only caller is platformUpkeep in index.ts:450, run from the work-orders run (runMinutes default 360)
  • signable/inFlight/isOpen/noteStatus semantics for a prepared row the owner signed outside the dashboard
  • view() following path (FOLLOWED_PER_VIEW, filter isOpen)
  • FakePlatformApp prepare response for approval_vote with voteLink toggle; confirm expiry is 10 min
  • UI confirm-page Alert vs the existing intent Alert and the confirmUrl button in the actions list
  • e2e voteOnConfirmPage helper

Findings

  • 🟠 Medium api/src/services/platform/owner-actions.ts:511 Votes signed on the confirm page are dropped from following once the link expires, so the scheduled run rarely sees them (commented inline)

Comment @multi-review to re-review new commits, or @multi-review full for a full review.

@agency-builder
agency-builder merged commit 5949e54 into staging Nov 26, 2026
6 checks passed
@agency-builder
agency-builder deleted the feature/votes-confirm-page branch November 26, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants