Skip to content

fix: case selection not persisting across page refresh#49

Merged
Ark0N merged 1 commit intoArk0N:masterfrom
TeigenZhang:fix/case-selection-persistence
Mar 25, 2026
Merged

fix: case selection not persisting across page refresh#49
Ark0N merged 1 commit intoArk0N:masterfrom
TeigenZhang:fix/case-selection-persistence

Conversation

@TeigenZhang
Copy link
Contributor

Summary

  • saveLastUsedCase() was silently failing with HTTP 400 because it sent the full settings object (including modelConfig) back to PUT /api/settings, which uses .strict() Zod validation
  • Changed to send only { lastUsedCase: caseName } — the backend already merges partial updates via { ...existing, ...settings }

Root Cause

SettingsUpdateSchema has .strict() mode, rejecting any fields not explicitly defined. modelConfig exists in the settings file but is not part of SettingsUpdateSchema (it has its own dedicated API at /api/execution/model-config). The GET-then-PUT pattern sent all fields including modelConfig, triggering the 400 error.

Test plan

  • Verified with Playwright: select case → refresh → selection persists
  • Manual: change case on mobile picker → refresh → verify persistence
  • Manual: change case on desktop dropdown → refresh → verify persistence

🤖 Generated with Claude Code

saveLastUsedCase() was GET-ing the full settings object and PUT-ing it
back. The settings contained `modelConfig` which is not in the strict
SettingsUpdateSchema, causing a 400 rejection. Now sends only the
`lastUsedCase` field — the backend already merges partial updates.
@Ark0N Ark0N merged commit 52e774f into Ark0N:master Mar 25, 2026
1 check passed
@Ark0N
Copy link
Owner

Ark0N commented Mar 25, 2026

Thank you for this fix! Great root cause analysis — the strict Zod schema rejecting modelConfig during the GET-then-PUT pattern was a subtle bug. Merged and I'll add test coverage for this case.

Ark0N added a commit that referenced this pull request Mar 25, 2026
…rejection

Tests that partial PUT /api/settings with just lastUsedCase works correctly
and that including modelConfig triggers strict Zod schema rejection (the bug
fixed in #49).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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