Skip to content

fix(appearance): avoid first theme switch timeout - #2665

Merged
kev1n77 merged 1 commit into
GCWing:1.0.0-explorefrom
kev1n77:fmy/ui-sys
Aug 29, 2026
Merged

fix(appearance): avoid first theme switch timeout#2665
kev1n77 merged 1 commit into
GCWing:1.0.0-explorefrom
kev1n77:fmy/ui-sys

Conversation

@kev1n77

@kev1n77 kev1n77 commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix the first theme switch becoming disabled for approximately 20 seconds due to a circular wait between the Web UI appearance transaction and the Desktop ProductControl runtime-effect callback.

The Web UI now acknowledges a pending theme selection only when the corresponding theme has actually been applied to AppearanceRuntime. External theme changes continue through the existing persisted-state reconciliation path.

Adds regression coverage for:

  • Theme persistence remaining in flight after runtime application.
  • ProductControl callbacks received while the new theme is pending.

Fixes #

Type and Areas

Type:

Regression fix

Areas:

Web UI, Desktop/Tauri ProductControl integration

Motivation / Impact

The first theme change after startup entered the applying state and disabled the theme selectors while waiting for configuration persistence. Desktop ProductControl then requested confirmation from the Web UI, but the Web UI queued reconciliation behind the transaction that was already waiting for that confirmation.

This circular wait ended only after the 20-second ProductControl timeout. It could also roll back the first theme selection and mark the presentation surface as unavailable.

After this change, the first theme switch completes normally without waiting for the timeout. External or Agent-initiated theme changes retain their existing reconciliation behavior.

Verification

  • pnpm --dir src/web-ui run test:run src/app/global-search/bitfunControlBridge.test.ts src/infrastructure/appearance/runtime/AppearanceService.test.ts
    • Passed: 2 test files, 30 tests.
  • pnpm run check:web
    • Passed appearance contract audit.
    • Passed theme color governance checks.
    • Passed theme visual contract validation.
    • Passed Web UI TypeScript type checking.
  • git diff --check
    • Passed.

Manual Peer Device and remote workspace scenarios were not exercised.

Reviewer Notes

The fix does not remove the normal applying-state UI lock or shorten the backend timeout. It prevents the self-originated ProductControl callback from re-entering the serialized appearance mutation queue.

The acknowledgement requires all of the following:

  • The appearance service is currently applying a selection.
  • The pending selection matches the ProductControl event value.
  • AppearanceRuntime confirms that the resolved theme is already active.

No user-facing strings, persisted data shapes, migrations, or backend contracts were changed.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@kev1n77
kev1n77 merged commit 4a49387 into GCWing:1.0.0-explore Aug 29, 2026
2 checks passed
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.

1 participant