Skip to content

fix(preferences): retry failed preference sync and catch empire state patch - #566

Merged
jplacht merged 1 commit into
mainfrom
fix/562-silent-prefs-save
Oct 3, 2026
Merged

jplacht merged 1 commit into
mainfrom
fix/562-silent-prefs-save

Conversation

@jplacht

@jplacht jplacht commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

What and why

A failed PATCH /user/preferences/ was only logged to the console, so the server kept stale preferences until the user changed another one; and the PatchEmpireState call at the end of calculateEmpire had no catch, surfacing network errors as unhandled rejections. Found by /error-review (PostHog and Axiom client_error network events on /empire, release 0.31.1).

Changes

  • usePreferences.ts: on a failed sync, reschedule it once on the next debounce with the current preferences (same session guard, so it is dropped after logout); a second failure is not retried.
  • EmpireView.vue: .catch(console.error) on the PatchEmpireState call (the state is recomputed and re-sent on the next calculation).
  • usePreferences.sync.test.ts: test that a failed sync is retried exactly once (fails without the fix).

How it was verified

  • pnpm test: 118 files, 3712 passed, 1 expected fail
  • pnpm tsc: pass
  • pnpm lint: pass
  • pnpm knip: pass

Closes #562

🤖 Generated with Claude Code

… patch

- retry a failed PATCH /user/preferences/ once on the next debounce, with
  the current preferences and the same session guard
- catch the PatchEmpireState call in EmpireView (no unhandled rejection)
- test the retry-once path in usePreferences.sync.test.ts

Closes #562

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

🟢 Coverage 100.00% diff coverage · +0.03% coverage variation

Metric Results
Coverage variation ✅ +0.03% coverage variation (-1.00%)
Diff coverage ✅ 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (f053000) 3713 3625 97.63%
Head commit (5e1487b) 3715 (+2) 3628 (+3) 97.66% (+0.03%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#566) 2 2 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@netlify

netlify Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for prunplanner-preview ready!

Name Link
🔨 Latest commit 5e1487b
🔍 Latest deploy log https://app.netlify.com/projects/prunplanner-preview/deploys/6ac0a4c448b4440008fdc99d
😎 Deploy Preview https://deploy-preview-566--prunplanner-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jplacht
jplacht merged commit b9e4f79 into main Oct 3, 2026
11 checks passed
@jplacht
jplacht deleted the fix/562-silent-prefs-save branch October 3, 2026 06:51
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.

Failed preference save is silently dropped; empire state PATCH uncaught

1 participant