Skip to content

fix(gateway): replay resident creature movement after CREATE - #450

Merged
Mathih13 merged 1 commit into
mainfrom
fix/issue-272-resident-replay
Sep 7, 2026
Merged

Mathih13 merged 1 commit into
mainfrom
fix/issue-272-resident-replay

Conversation

@Mathih13

@Mathih13 Mathih13 commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Refs #272

A viewer that entered an area during an active creature leg received the creature CREATE without its current movement. The creature appeared idle until the next leg arrived.

The shared CREATE path now appends a resident creature spline in the same writer work item after visibility and duplicate admission. A partial leg starts at its elapsed position and carries the rounded-up remaining duration, expired movement is skipped, and facing reuses the existing facing encoder. Taxi replay is unchanged.

What you verified

  • cargo fmt --all -- --check
  • cargo clippy -p lyracore-gateway --all-targets --all-features -- -D warnings
  • Four focused resident replay and production-wiring tests passed
  • cargo test -p lyracore-gateway: 1,302 passed and 3 ignored; the known unrelated writer_trace_dump_writes_a_file_with_the_traced_frames fixture failed because /tmp/gw-writer-crash belongs to another account

What you did NOT verify

No live realm or build-5875 client was used. Issue #272 stays open for real-client acceptance and its separate movement shedding and sensing work.

Risk

  • Protocol change: the Gateway sends the existing SMSG_MONSTER_MOVE encoding after an admitted CREATE. The wire codec and durable schema are unchanged.

Notes for the reviewer

The source Architecture Test pins the resident append after the production visibility, duplicate, and CREATE steps because the SDK cache boundary cannot be constructed in unit tests. Behavior tests assert the resulting CREATE and movement packets, including their matching creature guid.

Authored by GPT-5.6 Sol at high effort through Codex in T3 Code.

Summary by CodeRabbit

  • Bug Fixes
    • Creature state replay now restores movement and facing direction more accurately when creatures are created.
    • In-progress movement resumes from the creature’s interpolated position with the correct remaining duration.
    • Replay results are filtered to the appropriate viewing context and exclude expired, invalid, or zero-duration movement data.
    • Creature creation and subsequent spline state updates now appear in the correct order.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 8751bf1a-86b5-4971-a9b7-2d0c16f25226

📥 Commits

Reviewing files that changed from the base of the PR and between 38a78b8 and 153f55f.

📒 Files selected for processing (1)
  • gateway/src/stdb/subscriptions.rs

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


📝 Walkthrough

Walkthrough

Resident creature spline state is appended after CREATE relays. Replay filters legs by viewer instance and timing, preserves facing updates, and reconstructs active movement from interpolated position with remaining duration. Tests cover ordering, filtering, interpolation, and admission behavior.

Changes

Resident spline replay

Layer / File(s) Summary
Spline replay path
gateway/src/stdb/subscriptions.rs
offer_peer_create_for appends eligible resident movement after CREATE data. Replay uses interpolated positions, remaining duration, instance filtering, expiry checks, and Unix microsecond timing.
Spline replay validation
gateway/src/stdb/subscriptions.rs
Fixtures and tests validate replay ordering, interpolation, duration rounding, filtering, facing-only updates, peer admission, and deduplication.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 153f5

CREATE relays now include eligible active resident creature movement, allowing newly admitted viewers to receive current movement state. Focused and Gateway suite coverage supports the replay behavior, with no concrete merge-blocking risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 73.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: replaying resident creature movement after the CREATE path in the gateway.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ 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/issue-272-resident-replay

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

@Mathih13
Mathih13 merged commit 6ccfe68 into main Sep 7, 2026
7 checks passed
@Mathih13
Mathih13 deleted the fix/issue-272-resident-replay 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.

1 participant