Repository navigation
fix: coalesce overlapping usage refreshes and harden companion-state decoding - #123
Merged
chattymin merged 1 commit intoJul 26, 2026
Merged
Conversation
…decoding Two resilience fixes surfaced by a code audit. Refresh coalescing (UsageStore). refresh() dropped any call that overlapped an in-flight refresh (`guard !isRefreshing`). Re-enabling keychain access (disableKeychainAccess) while a poll was running dropped the reload; in "manual" (interval 0) mode there is no follow-up poll, so Claude limits stayed blank until the next manual action. Overlapping calls now set a `refreshPending` flag and the in-flight refresh re-runs once on completion, bounded by the request arrival rate. Companion-state decode resilience (CompanionModel / CompanionStore). One corrupt or legacy field in companion-state.json could throw the whole CompanionState decode, silently resetting the entire companion, Pokedex, and inventory. Now: - the Pokedex decodes per-entry (a broken entry is dropped, the rest kept); - every field absorbs missing/null/type-mismatch into its default, so one bad field no longer resets everything (a corrupt active falls back to an egg while the dex and inventory survive); - only a non-object top-level still fails to decode, and load() then backs the original file up to `.corrupt` before starting fresh, leaving room for manual recovery. Tests: refresh coalescing (actor-gated overlap), per-entry dex isolation, corrupt-active fallback, and corrupt-file backup. Full gate: 322 tests pass, 85% core line coverage. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Closed
6 of 10 tasks
5 of 10 tasks
chattymin
pushed a commit
that referenced
this pull request
Sep 25, 2026
Korean copy wrote both particle forms after runtime Pokémon names
("유니란이(가)", "듀란(으)로") because the name is not known when the
string is translated. Pick the particle from the final syllable's coda
instead, with ㄹ taking "로".
- Add KoreanParticle (subject 이/가, object 을/를, direction 으로/로).
Names that do not end in a Hangul syllable, such as Unown's "[A]" or a
"#123" placeholder, keep the combined form.
- Use it in the six Korean strings that wrote both forms. Other
languages are unchanged.
- Add the helper to the coverage gate's logic core.
No new dependency: es-hangul is JavaScript, and the check is a few lines
of Unicode arithmetic.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Strongorange
added a commit
to Strongorange/PokeTokenBar-windows
that referenced
this pull request
Oct 20, 2026
Port macOS chattymin#356 (KoreanParticle.swift): hatch, shiny hatch, evolve, level-up status, egg confirm and mint feedback now append the particle matching the name's batchim (을/를, 이/가, 으로/로, with ㄹ-coda taking 로) instead of the parenthesized dual forms. Non-Hangul endings (Unown markers, pre-load 'chattymin#123', Latin names) keep the dual form — a wrong particle is worse than a parenthetical. Also fixes the mint feedback passing the raw enum name ('Jolly') instead of the localized nature, which would have kept '(으)로' visible in Korean copy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two resilience fixes from a code audit.
Refresh coalescing
refresh()dropped any call that overlapped an in-flight refresh(
guard !isRefreshing). Re-enabling keychain access while a poll wasrunning dropped the reload; in "manual" (interval 0) mode there is no
follow-up poll, so Claude limits stayed blank until the next manual action.
Overlapping calls now set a
refreshPendingflag and the in-flight refreshre-runs once on completion.
Companion-state decode resilience
One corrupt or legacy field in
companion-state.jsoncould throw the wholedecode, silently resetting the entire companion, Pokedex, and inventory.
corrupt
activefalls back to an egg while the dex and inventory survive.load()then backs the originalup to
.corruptbefore starting fresh, leaving room for manual recovery.Testing
isolation, corrupt-active fallback, corrupt-file backup.
./scripts/test-gate.sh— 322 tests pass, 85% core line coverage.🤖 Generated with Claude Code