Skip to content

fix(action-token): promise a count, not named tokens - #602

Merged
dadiorchen merged 1 commit into
Greenstand:keycloakfrom
samwel141:fix-link-promises-count-574
Sep 29, 2026
Merged

dadiorchen merged 1 commit into
Greenstand:keycloakfrom
samwel141:fix-link-promises-count-574

Conversation

@samwel141

@samwel141 samwel141 commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #574
Closes #571

Problem

A bundle link resolved tokens at creation and wrote their ids into the link, throwing the requested number away. Nothing marked those tokens, so an ordinary send could take them, and the link then died at claim while the sender still held plenty of others.

Change

A bundle link carries token_count, and the tokens are chosen at claim time from whatever the wallet still holds, skipping pending and claimed ones. Links that name their tokens are unchanged, so case 1 and already issued links keep working

Trade-off

The promise becomes best effort. Spending below the count gives a clear error at claim instead of a silently dead link. No database state added

Verification

  • Unit 243, integration 111, repository 30, eslint clean.
  • Four new integration tests: the link carries a count and names nothing; it survives the sender spending the token it would have named; it 409s when the wallet drops below the count; a link naming its tokens still claims

A bundle link resolved tokens the moment it was created and wrote their
ids into the link, throwing the requested number away. Nothing in the
database marked those tokens, so an ordinary send could take them, and
the link then died at claim with a 409 while the sender still held plenty
of other tokens.

A bundle link now carries the count. The tokens are chosen at claim time
from whatever the sender wallet still holds, skipping ones already
pending or claimed, so a send can no longer kill a link.

Links that name their tokens are unchanged, which keeps the case for
sharing specific tokens and keeps already issued links working.

Selection happens on the model bound to the open transaction, not through
TokenService, which opens a session of its own.

Closes Greenstand#574
Closes Greenstand#571
@dadiorchen
dadiorchen merged commit a57deb2 into Greenstand:keycloak Sep 29, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.44.0-keycloak.37 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants