Skip to content

refactor(tray,config): own AppCaches from AppState, delete quarantine-era statics (#758, slice 2) - #1167

Merged
Carme99 merged 4 commits into
mainfrom
w2-s2
Oct 8, 2026
Merged

Carme99 merged 4 commits into
mainfrom
w2-s2

Conversation

@Carme99

@Carme99 Carme99 commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Summary

Slice 2 of the behavioural-statics move: tray caches/mirrors + config quarantine/conflict flags now owned from AppState (SessionState carries AppCaches), QUARANTINE_TEST_LOCK deleted, MODE_ATOM_LOCK deleted. Isolation test proves two AppStates do not share caches. No behaviour change in the single-session path.

PARTIAL for #758 — do NOT close: LOCALE_TEST_LOCK survives (i18n::CURRENT stays process-wide per the issue step-3 keeps list); locale-table ownership is slice-3 scope.

What changed

  • AppCaches threaded through tray (mod/cache/dedup/snooze/devices/actions), config (io/migrate/mod), updater_bg, cli, menu, polling/iteration, commands
  • load_config/explain_rules take runtime-injected State/AppHandle (frontend invoke args unchanged)
  • playback-state-changed listener consumes inline on the emitter thread (a spawn raced the rebuild and could paint a stale Play/Pause mark on same-track pause); guard pins the inline shape
  • Process-wide keeps intact: TRAY handle, TRAY_WRITE_LOCK, i18n::CURRENT, macos CLAIMED, keychain/HTTP caches
  • Stale LAST_*_STATE refs repointed to playing/shuffle/repeat_flag accessors

Tests

  • cargo test --lib: 913/913 (new test_two_app_states_do_not_share_caches)
  • cargo clippy --all-targets -D warnings: 0 errors
  • cargo fmt --check: clean
  • python3 docs/link-audit.py: clean

Review

Two independent critics scored the tree: 97/100 (2 comment-only gaps, both fixed) and 88/100 (P1 spawn-race, now inline with a guard; dead lock/static refs cleared). All gaps closed and re-verified (tray 36/36, lib 913/913).

Carme99 added 4 commits October 8, 2026 18:36
…-era statics (#758, slice 2)

Thread &AppCaches through load_config, quarantine/conflict emitters,
tray rebuild/paint helpers, and every window/config/updater/snooze
caller; delete CONFIG_QUARANTINED, CONFLICT_EVENT_SENT, tray cache
statics and QUARANTINE_TEST_LOCK; fix the Tauri 2.11 event-listener
handle capture; add test_two_app_states_do_not_share_caches.
LOCALE_TEST_LOCK survives (i18n::CURRENT is an issue-blessed keep).
No behaviour change in the single-session path.
#758, slice 2)

- listener consumes on emitter thread (spawn raced the rebuild, could
  paint stale Play/Pause on same-track pause); guard pins inline shape
- delete dead MODE_ATOM_LOCK imports + static (zero live uses)
- repoint LAST_*_STATE refs to playing/shuffle/repeat_flag accessors
@Carme99
Carme99 merged commit 9b41cb0 into main Oct 8, 2026
14 checks passed
@Carme99
Carme99 deleted the w2-s2 branch October 8, 2026 19:43
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