Skip to content

fix(action-token): do not promise tokens a pending send reserved - #577

Merged
mahdi2ba merged 1 commit into
Greenstand:keycloakfrom
samwel141:fix-share-link-skip-reserved-571
Sep 21, 2026
Merged

mahdi2ba merged 1 commit into
Greenstand:keycloakfrom
samwel141:fix-share-link-skip-reserved-571

Conversation

@samwel141

Copy link
Copy Markdown
Collaborator

Problem

Share link generation took the first N tokens of the wallet, reserved or not, while every transfer path skips reserved ones. The link was issued with no warning, and redeem refused it with a 409 that landed on the recipient, who could do nothing about it.

Token.getByOwner filters on wallet_id only, so _selectAvailableTokens excluded tokens promised by other links but not tokens reserved by a pending send. The explicit ids path checked ownership and nothing else.

Fix

Token.getAvailableTokens filters transfer_pending and claim, and the bundle path pages over that. The existing count check then produces the 409 at generate time, where the sender can act on it.

getByOwner is untouched, so GET /tokens still shows a wallet's full holdings.

The explicit ids path now applies the same rule, which is what Transfer.transferActionToken already enforces at claim time, moved earlier.

Testing

New spec: 3 of 5 tokens reserved, a link for 3 is refused with 409, a link for 2 succeeds and names no reserved token. Both assertions fail without this change, 201 instead of 409 and 3 promised tokens instead of 2.

Unit 241 passing, integration 135 passing.

Refs #571

Share link generation took the first N tokens of the wallet, reserved or
not, while every transfer path skips reserved ones. The link was issued
with no warning and redeem refused it with a 409 that landed on the
recipient, who could do nothing about it.

Add Token.getAvailableTokens, filtering transfer_pending and claim, and
page over that when picking a bundle. The existing count check then
produces the 409 at generate time, where the sender can act on it.
getByOwner is untouched, so GET /tokens still shows a wallet's full
holdings.

Apply the same rule to the explicit ids path, which checked ownership
only. This is what Transfer.transferActionToken already enforces at claim
time, moved earlier.

Refs Greenstand#571
@samwel141 samwel141 self-assigned this Sep 20, 2026
@mahdi2ba
mahdi2ba merged commit ea5f2fa into Greenstand:keycloak Sep 21, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

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

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

Development

Successfully merging this pull request may close these issues.

3 participants