[PR #3869] [MERGED] Play with Friends: leaving the world ends its invite code #5258

Closed
opened 2026-11-03 05:11:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3869
Author: @spidercraft
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/friends-code-ends-with-world


📝 Commits (1)

  • e716347 Play with Friends: leaving the world ends its invite code

📊 Changes

2 files changed (+12 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/remote.rs (+2 -0)
📝 tools/test_friends.py (+10 -0)

📄 Description

🤖 Opened by spidercraft's AI agent (Claude Code), not by spidercraft themselves.

Host a world with an invite code, Save & Quit, open the world again: the game menu still showed the old code, though nothing answered it any more.

On the server thread (the default single player) leaving goes through leave_server, which stopped the integrated server but kept self.friends. Only the in-frame path closed the code (through lan_close). leave_server now calls friends_lan_closed() before the server stops, so the code ends with its world, and sharing again gives a new one. For a guest of someone else's server, friends is None and the call does nothing.

tools/test_friends.py (server-thread mode) now shares, leaves to the title, checks the code is gone, reopens and checks the new code differs.

Tested

  • python3 tools/test_friends.py --client target/fast/horizon-client --relay target/fast/horizon-relay --offscreen: passes, including leaving the world ends its code.
  • The same run with the one line commented out fails at AssertionError: the code outlived its world.

pr_ready (tools/pr_ready.py --quick on SpiderPC, against origin/main at 668419b92, 4 min 44 s)

Check Result
Scope ✅ 2 files, +12 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 423 passed (24 s)
rustfmt ✅ (5 s)
clippy ✅ (1 min 36 s)
tests: horizon-client ✅ 867 passed (1 min 25 s)
doc tests ✅ rerun alone with the worktree's own target dir (the pr_ready run failed on a shared target dir's stale rlib)
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses

Not covered: quitting the game outright from a shared world doesn't release the code explicitly. The process exit ends it, but a UPnP mapping may stay until the router expires it.

🤖 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/3869 **Author:** [@spidercraft](https://github.com/spidercraft) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/friends-code-ends-with-world` --- ### 📝 Commits (1) - [`e716347`](https://github.com/horizon-rust/horizon/commit/e71634732930e579497ff8d71de395d2647bce2f) Play with Friends: leaving the world ends its invite code ### 📊 Changes **2 files changed** (+12 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+2 -0) 📝 `tools/test_friends.py` (+10 -0) </details> ### 📄 Description > 🤖 Opened by spidercraft's AI agent (Claude Code), not by spidercraft themselves. Host a world with an invite code, Save & Quit, open the world again: the game menu still showed the old code, though nothing answered it any more. On the server thread (the default single player) leaving goes through `leave_server`, which stopped the integrated server but kept `self.friends`. Only the in-frame path closed the code (through `lan_close`). `leave_server` now calls `friends_lan_closed()` before the server stops, so the code ends with its world, and sharing again gives a new one. For a guest of someone else's server, `friends` is `None` and the call does nothing. `tools/test_friends.py` (server-thread mode) now shares, leaves to the title, checks the code is gone, reopens and checks the new code differs. **Tested** - `python3 tools/test_friends.py --client target/fast/horizon-client --relay target/fast/horizon-relay --offscreen`: passes, including `leaving the world ends its code`. - The same run with the one line commented out fails at `AssertionError: the code outlived its world`. **pr_ready** (`tools/pr_ready.py --quick` on SpiderPC, against origin/main at 668419b92, 4 min 44 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +12 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 423 passed (24 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (1 min 36 s) | | tests: horizon-client | ✅ 867 passed (1 min 25 s) | | doc tests | ✅ rerun alone with the worktree's own target dir (the pr_ready run failed on a shared target dir's stale rlib) | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | Not covered: quitting the game outright from a shared world doesn't release the code explicitly. The process exit ends it, but a UPnP mapping may stay until the router expires it. 🤖 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 05:11:19 +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#5258
No description provided.