Skip to content

Add account state lifecycle (active → expired)#984

Merged
gudnuf merged 2 commits intomasterfrom
worktree-960-account-state
Apr 13, 2026
Merged

Add account state lifecycle (active → expired)#984
gudnuf merged 2 commits intomasterfrom
worktree-960-account-state

Conversation

@orveth
Copy link
Copy Markdown
Contributor

@orveth orveth commented Apr 7, 2026

Two commits, the first is clean and just adds the state and cron job to transition to expired. The second commit tries to add error handling, but is still a wip and I still need to test it. I'm wondering if we should just review the first commit and worry about this error handling later so we can get the account state migration on next.

@jbojcic1 we talked in discord about keeping the keyset active after expiry which I think we should do. If we do that, then I think we can probably remove this error handling entirely

Full spec: #960

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agicash Ready Ready Preview, Comment Apr 13, 2026 2:28pm

Request Review

@supabase
Copy link
Copy Markdown

supabase bot commented Apr 7, 2026

Updates to Preview Branch (worktree-960-account-state) ↗︎

Deployments Status Updated
Database Mon, 13 Apr 2026 14:27:52 UTC
Services Mon, 13 Apr 2026 14:27:52 UTC
APIs Mon, 13 Apr 2026 14:27:52 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations Mon, 13 Apr 2026 14:27:53 UTC
Migrations Mon, 13 Apr 2026 14:27:53 UTC
Seeding Mon, 13 Apr 2026 14:27:53 UTC
Edge Functions Mon, 13 Apr 2026 14:27:53 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

Comment thread app/lib/cashu/error-codes.ts Outdated
BAT_MINT_RATE_LIMIT_EXCEEDED = 31004,
}

export function isExpiredOfferError(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@orveth lets add some brief jsdoc to this to know what this is for and why it only cares about account where purpose is offer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@orveth orveth force-pushed the worktree-960-account-state branch from cd64fa2 to c3c5fd4 Compare April 8, 2026 19:34
@gudnuf gudnuf requested a review from jbojcic1 April 8, 2026 21:09
orveth added a commit that referenced this pull request Apr 9, 2026
Adds offers section to gift cards page with offer discovery,
detail view (balance, expiry, Fund/Pay), and redirect handling
for send/receive/buy flows via getAccountHomePath.

Cleaned from original branch to contain only offers-UI changes.
Account-state lifecycle changes deferred to PR #984.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@orveth orveth force-pushed the worktree-960-account-state branch from c3c5fd4 to 4cfd00e Compare April 10, 2026 03:20
@gudnuf
Copy link
Copy Markdown
Contributor

gudnuf commented Apr 10, 2026

@jbojcic1 I removed the offer expiry error handling because we discussed its not needed with the current approach. Also, I realized if we ever let expiry get set on accounts that can also be set to default, then we need to deal with this issue #987

orveth added a commit that referenced this pull request Apr 10, 2026
Adds offers section to gift cards page with offer discovery,
detail view (balance, expiry, Fund/Pay), and redirect handling
for send/receive/buy flows via getAccountHomePath.

Cleaned from original branch to contain only offers-UI changes.
Account-state lifecycle changes deferred to PR #984.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@jbojcic1 jbojcic1 left a comment

Choose a reason for hiding this comment

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

approving but lets also add a db constraint that account can't be the default if has expires_at set

Two triggers enforce from both directions:
- Trigger on users: blocks setting an expiring account as default
- Trigger on accounts: blocks adding expires_at to a default account

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gudnuf gudnuf merged commit 754c964 into master Apr 13, 2026
5 checks passed
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.

3 participants