Skip to content

fix: resolve wallet id conflicts in SQL - #28

Merged
mattgle merged 1 commit into
devfrom
fix/wallet-create-conflict-aware
Aug 6, 2026
Merged

mattgle merged 1 commit into
devfrom
fix/wallet-create-conflict-aware

Conversation

@mattgle

@mattgle mattgle commented Aug 6, 2026

Copy link
Copy Markdown

createWallet was the only insert in the package that let a constraint violation escape as an exception — every other insert resolves conflicts in SQL. It now does the same and reports whether a row was inserted.

This lets a caller tell a new wallet from an existing one without recognising a driver's constraint-violation error, which was never portable anyway: the browser adapter forwards only a message string for SQL statement errors, so the driver's error code never reaches the caller.

Breaking: createWallet returns boolean instead of the id the caller already supplied.

Coverage lives in the shared contract suite, so it is asserted against both the Node and browser adapters. A conflict on any other constraint still raises, so false means the id was taken and nothing else.

@mattgle mattgle self-assigned this Aug 6, 2026
@mattgle
mattgle requested a review from bhflm August 6, 2026 13:28
@mattgle
mattgle marked this pull request as ready for review August 6, 2026 13:29
@mattgle
mattgle force-pushed the fix/wallet-create-conflict-aware branch from ea1f627 to 0add669 Compare August 6, 2026 13:44
@mattgle
mattgle force-pushed the fix/wallet-create-conflict-aware branch from 0add669 to 7d42406 Compare August 6, 2026 14:22
@mattgle
mattgle merged commit 7d42406 into dev Aug 6, 2026
1 check passed
@mattgle
mattgle deleted the fix/wallet-create-conflict-aware branch August 6, 2026 15:30
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