Skip to content

fix(world): remove motion after cross-map teleport - #438

Merged
Mathih13 merged 1 commit into
mainfrom
fix/teleport-motion-cleanup
Sep 7, 2026
Merged

Mathih13 merged 1 commit into
mainfrom
fix/teleport-motion-cleanup

Conversation

@Mathih13

@Mathih13 Mathih13 commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

A cross-map teleport deleted the live world entity but left its public motion row on the source Shard. Nearby subscriptions could continue to match that orphan row after the Character had departed.

Delete the public motion row in the cross-map branch of teleport_player. A Standalone integration test now drives movement and teleport reducers against a fresh database. It verifies that same-map teleports preserve motion while cross-map teleports remove the live entity, public motion, and pending motion in one transition.

Closes #80.

Verification:

  • cargo test -p lyracore-module --test teleport_motion teleport_motion_rows_follow_the_live_entity_boundary -- --ignored --nocapture
  • cargo test -p lyracore-module
  • cargo test -p lyracore-module --lib --features=debug_reducers
  • ./lyracore preflight

Before the fix, the integration test found one public motion row after the cross-map teleport. Remaining verification gaps: none for this Module state transition; the test observes committed rows through the real reducers on an isolated SpacetimeDB Standalone.

Implemented by GPT-5.6 Sol through the Codex harness.

Summary by CodeRabbit

  • Bug Fixes
    • Cross-map teleports now clear combat, stealth, and public movement state before the entity is removed.
    • Pending movement data is also removed during cross-map teleports, preventing stale motion from persisting.
  • Tests
    • Added coverage for preserving motion during same-map teleports and clearing motion during cross-map teleports.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 77d756b2-b2b6-4c10-9e28-58f41c70026e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 1f5076f3-1c56-468a-beba-8bbeca7aeaf5

📥 Commits

Reviewing files that changed from the base of the PR and between b4c17c4 and 0734b3b.

📒 Files selected for processing (2)
  • module/src/world.rs
  • module/tests/teleport_motion.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

Cross-map teleport now deletes the source entity’s public motion row before entity removal. An ignored integration test verifies motion publication, same-map retention, and cross-map cleanup of public and pending motion rows.

Changes

Teleport motion cleanup

Layer / File(s) Summary
Cross-map teleport cleanup
module/src/world.rs
The cross-map teleport path deletes the player’s game_entity_motion row before deleting the live entity. The documentation describes this cleanup.
Teleport motion lifecycle validation
module/tests/teleport_motion.rs
The ignored integration test verifies motion publication, same-map retention, and cross-map removal of the source entity and its public and pending motion rows. Helpers issue movement updates, poll for publication, and count rows.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 0734b

Cross-map teleports now clean up the departing entity’s public motion row along with existing entity teardown, preventing stale source-shard motion records. The change is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation deletes the player's public game_entity_motion row during cross-map teleport. The integration test verifies that cross-map teardown removes the entity, public motion, and pending mo…
Out of Scope Changes check ✅ Passed The documentation update and integration test directly support the linked issue and pull request objectives. No unrelated changes are present.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: removing motion data after a cross-map teleport.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/teleport-motion-cleanup

Comment @coderabbitai help to get the list of available commands.

@Mathih13
Mathih13 force-pushed the fix/teleport-motion-cleanup branch from 875a2ab to 97ea5b2 Compare September 5, 2026 06:51
@Mathih13
Mathih13 force-pushed the fix/teleport-motion-cleanup branch from 97ea5b2 to 0734b3b Compare September 7, 2026 13:11
@Mathih13

Mathih13 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Current-head review on 0734b3bb47f43ecd88445263d9ae8117a1e405d3:

  • Rebased onto main at b4c17c481f66784fd24677f583e0368fc3ac8c95.
  • Updated the durable test for the current mutable Standalone publish API.
  • Replaced its custom wait loop with the shared poll_until deadline helper.
  • The isolated teleport test passed and observed same-map retention plus cross-map deletion of the live entity, public motion, and staged motion.
  • Module library: 1,477 passed.
  • Importer: 337 passed, 2 fixture-data tests ignored as designed.
  • Shared: 155 passed.
  • Workspace build, formatting, and offline preflight passed.

The gateway run passed 1,298 tests and hit one local filesystem-permission failure in writer_trace_dump_writes_a_file_with_the_traced_frames. The exact test fails on current main in the same checkout because /tmp/gw-writer-crash belongs to another account. The PR does not change gateway code. GitHub CI will run it in a clean environment.

@Mathih13

Mathih13 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Mathih13
Mathih13 merged commit 3e750af into main Sep 7, 2026
7 checks passed
@Mathih13
Mathih13 deleted the fix/teleport-motion-cleanup branch October 11, 2026 18:20
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.

teleport_player cross-map branch leaks a game_entity_motion row per hop

1 participant