[PR #5882] [MERGED] Launcher: give each memory store its own account lock (Windows test flakes) #6536

Closed
opened 2026-11-03 06:22:34 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5882
Author: @ludovic111
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: launcher-win-account-flaky


📝 Commits (1)

  • 8f2e53a Launcher: give each memory store its own account lock

📊 Changes

3 files changed (+30 additions, -8 deletions)

View changed files

📝 launcher/src/account.rs (+10 -1)
📝 launcher/src/account/session.rs (+11 -7)
📝 launcher/src/account/tests.rs (+9 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

The launcher 0.2.33 release build failed on Windows on a different account test each time:
expiry_is_refreshable_and_a_missing_credential_needs_sign_in (left: Retry, right: SignInRequired, run 41288299744 attempt 1) and a_status_read_gives_up_behind_a_long_operation (the final 5 s lock_within, attempt 3).

Why. Every unit test took the same process-wide account lock (session.rs's OPERATIONS). The tests' "offline" endpoints point at the closed port 127.0.0.1:9: on Windows a refused localhost connection takes about 2 s (TCP retries; the log advances in 2 s steps), on macOS/Linux it is instant. Tests that held the lock across those connects made a parallel test's status() give up after STATUS_WAIT (3 s → Retry), or starved a polling lock_within(5 s) behind tests blocked in lock().

Fix. The in-process half of the lock now comes from the store: SecretStore::operations(). Its default is the one process-wide lock (the system keychain is one per computer, so SystemStore behaves as before); a MemoryStore owns its lock as it owns its secrets. Test wrappers (Refusing, Reading) forward to their inner store. The launcher only ever uses one store (account::store()), so nothing changes for players. Operation now borrows the store's lock (Operation<'a>).

The tests check exactly what they did; a_status_read_gives_up_behind_a_long_operation also checks that another memory store is not blocked by a held one.

Checks

  • macOS (Mac mini): cargo test --release --locked --lib account:: 43 passed; cargo fmt --check, cargo clippy --release --lib --tests -D warnings clean.
  • windows-latest: launcher workflow on this branch (push run + dry run), see checks.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5882 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `launcher-win-account-flaky` --- ### 📝 Commits (1) - [`8f2e53a`](https://github.com/horizon-rust/horizon/commit/8f2e53a9667d1fd4fd3889f049f13ed2f32007c1) Launcher: give each memory store its own account lock ### 📊 Changes **3 files changed** (+30 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `launcher/src/account.rs` (+10 -1) 📝 `launcher/src/account/session.rs` (+11 -7) 📝 `launcher/src/account/tests.rs` (+9 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. The launcher 0.2.33 release build failed on Windows on a different account test each time: `expiry_is_refreshable_and_a_missing_credential_needs_sign_in` (`left: Retry, right: SignInRequired`, run 41288299744 attempt 1) and `a_status_read_gives_up_behind_a_long_operation` (the final 5 s `lock_within`, attempt 3). **Why.** Every unit test took the same process-wide account lock (`session.rs`'s `OPERATIONS`). The tests' "offline" endpoints point at the closed port `127.0.0.1:9`: on Windows a refused localhost connection takes about 2 s (TCP retries; the log advances in 2 s steps), on macOS/Linux it is instant. Tests that held the lock across those connects made a parallel test's `status()` give up after `STATUS_WAIT` (3 s → `Retry`), or starved a polling `lock_within(5 s)` behind tests blocked in `lock()`. **Fix.** The in-process half of the lock now comes from the store: `SecretStore::operations()`. Its default is the one process-wide lock (the system keychain is one per computer, so `SystemStore` behaves as before); a `MemoryStore` owns its lock as it owns its secrets. Test wrappers (`Refusing`, `Reading`) forward to their inner store. The launcher only ever uses one store (`account::store()`), so nothing changes for players. `Operation` now borrows the store's lock (`Operation<'a>`). The tests check exactly what they did; `a_status_read_gives_up_behind_a_long_operation` also checks that another memory store is not blocked by a held one. **Checks** - macOS (Mac mini): `cargo test --release --locked --lib account::` 43 passed; `cargo fmt --check`, `cargo clippy --release --lib --tests -D warnings` clean. - windows-latest: launcher workflow on this branch (push run + dry run), see checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:22:34 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6536
No description provided.