Skip to content

fix(achievements): case-insensitive wallet keys in achievement store (#276 #277 #278 #279) - #359

Merged
Darkvader-ship-it merged 2 commits into
PHASE-STELLAR:mainfrom
daniella-techie:fix/276-277-278-279-achievement-wallet-case
Sep 27, 2026
Merged

Darkvader-ship-it merged 2 commits into
PHASE-STELLAR:mainfrom
daniella-techie:fix/276-277-278-279-achievement-wallet-case

Conversation

@daniella-techie

@daniella-techie daniella-techie commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #276
Closes #277
Closes #278
Closes #279

Summary

lib/achievement-store.ts used the raw wallet string as the store key, so G... (uppercase) and g... (lowercase) versions of the same Stellar address produced separate entries. Unlocks, counters and streaks were split across them, and the same achievement could be unlocked twice.

Changes

  • lib/achievement-store.ts
    • Added walletKey(), which trims the address and uppercases it. Every read and write (ensureEntry, getAchievements, getWalletData, unlockAchievement, checkAndUnlock) now uses this canonical key.
    • readStore() rewrites any existing mixed-case keys to the canonical key when it reads the file. If two entries collide, it merges them:
      • unlocked achievements are combined by id, keeping the earliest unlocked_at
      • mint_count, total_upvotes, follower_count and narrator_count keep the higher value
      • the daily streak comes from whichever entry has the most recent last_daily
  • tests/achievement-wallet-case.test.ts: new test. It checks that writes made with lowercase, uppercase and padded addresses all end up in one entry, and that existing split entries merge correctly.

Test plan

  • npx tsx tests/achievement-wallet-case.test.ts
  • npx tsc --noEmit

PHASE-STELLAR#279)

Canonicalize wallet keys to uppercase on every read/write so G... and g...
addresses resolve to a single entry, and merge legacy mixed-case entries on read.
@drips-wave

drips-wave Bot commented Sep 27, 2026

Copy link
Copy Markdown

@daniella-techie Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Darkvader-ship-it
Darkvader-ship-it merged commit 88cd8c9 into PHASE-STELLAR:main Sep 27, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment