Skip to content

fix(music): send Started callbacks for native instant music - #45

Merged
NickMesser merged 2 commits into
rust-rewritefrom
test/bevy-music-live3
Oct 27, 2026
Merged

NickMesser merged 2 commits into
rust-rewritefrom
test/bevy-music-live3

Conversation

@NickMesser

Copy link
Copy Markdown
Owner

Summary

The original 1.2 client only reacts to the play / pause score skills (special effects 93 / 94) when it receives its own non-zero-timeline SCSkillStarted: that is the trigger for CS121 (MIDI cache) and CS124 (End). Those skills (22213 play, 22214 pause, 22217 close) are instant (casting_time 0, effect_delay 200 ms), and the server sent SCSkillStarted only for casts with a cast time. The client therefore never sent CS121 / CS124 and the play effect broadcast an empty MIDI cache.

A validated player cast of a skill whose catalog join skill_effects -> effects(SpecialEffect) -> special_effects contains type 93 or 94 now sends SCSkillStarted immediately before the existing SCSkillFired, with the same non-zero timeline id, cast-time fields 0 and no extra data (skill::schedule_effects, SkillRunState::music_started_pending).

Unchanged:

  • the authored 200 ms effect_delay and the existing SCSkillFired / effect timing;
  • every permission, validation, cooldown and caster rule (the pending flag is set only after use_skill accepted the cast; rejected casts keep their failure SCSkillStarted);
  • the item-caster refusal of 22213 (sheet 28051 has no use_skill_id);
  • NPC casters, other instant skills, mounts;
  • CSEndMusicPacket: its WARN and the early return while the 30 s ScoreMemorized buff (6010) is active are exactly the old C# behaviour. No End policy change.

No ids are hard-coded and there is no application_method filter.

Validation

  • 4 new unit goldens (music_started_tests.rs): exact Started bytes and order directly before Fired, the 200 ms effect arriving afterwards, no Started for an unrelated instant skill or a client-only special effect, a rejected cast sends only the failure Started, NPC casters do not qualify.
  • Full CI on df222a3e1 (Scripts/lane.sh check, cargo xtask ci): 3674 passed, 0 failed, 162 ignored. Scoped clippy on aaemu-game and aaemu-testclient (--all-targets -D warnings) is clean.
  • Strict live suites on a lane stack (rust/verify/musicrun1.vtest, musicrun2.vtest; composer + listener, then relogin). They fail on any missing callback, sheet, broadcast or End:
    • compose: item cast 22215, CS122 sent after the received own Fired, upload logged before the save effect, sheet 28051 with detail-8 song id, paper -1, labor -100;
    • CS123 cold, tooltip, unknown id and buff-only replies;
    • play: own Started -> CS121 -> SCSendUserMusic to both clients with an identical hash, buff 6177;
    • pause / close: own Started -> CS124 (server log receipt), buffs per the catalog dispels; CS124 while 6010 is active keeps 6177, after it expired removes it;
    • relogin: sheet detail, paper stack, equipped lute, stored title / notes and play all survive.
  • Independent real-client verification (Bevy client, QA account on the same lane): compose with CS122, fresh sheet selected, cold tooltip query, then two plays (two CS121 of 56 bytes), Stop (22214) and Close (22217), each with its CS124 logged before the pause effect; DB shows the new title, notes, song id and the paper stack reduced. The root music-only run passed with one independently proven original Lua error allowed.

Limits

  • Derived from the client contract that was proven in the native client, not a retail server capture.
  • No MIDI hash claim for the real-client run: the server logs only the size (56 bytes), no packet trace was taken. The suites compare hashes of the bot's own fixed SMF.
  • Latency window: unchanged effect_delay means CS121 / CS122 must reach the server within about 200 ms minus one-way latency of the fire (compose relies on the same window for CS122). Loopback measured ~0 ms; a WAN client was not measured.
  • CS124 / 6010 behaviour is documented, not changed (PORTING.md).

Also adds the m* testclient music commands and a LIVE-TESTING.md paragraph.

Not merged, not deployed to any existing stack.

🤖 Generated with Claude Code

NickMesser and others added 2 commits October 23, 2026 18:48
The 1.2 client reacts to its own SCSkillStarted of the play / pause score skills
(special effects 93 / 94) with CS121 (MIDI) / CS124 (End). Those skills are instant, so
the cast-time-only SCSkillStarted never came and the play effect broadcast an empty MIDI
cache. A validated player cast whose catalog join skill_effects -> SpecialEffect ->
special_effects has type 93 or 94 now sends SCSkillStarted right before its
SCSkillFired; other instant skills, NPC casters, rejected casts and the item-caster
refusal are unchanged. Adds goldens, the testclient music commands (m*) and the strict
live suites musicrun1 / musicrun2.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 40040123456

Coverage decreased (-0.2%) to 76.828%

Details

  • Coverage decreased (-0.2%) from the base build.
  • Patch coverage: 659 uncovered changes across 2 files (38 of 697 lines covered, 5.45%).
  • 43 coverage regressions across 2 files.

Uncovered Changes

File Changed Covered %
rust/crates/aaemu-testclient/src/scenario/music.rs 654 0 0.0%
rust/crates/aaemu-testclient/src/scenario/script.rs 6 1 16.67%
Total (3 files) 697 38 5.45%

Coverage Regressions

43 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
rust/crates/aaemu-game/src/systems/social/crime.rs 25 64.42%
rust/crates/aaemu-game/src/systems/services/commands/scripts/sub/crimes.rs 18 92.62%

Coverage Stats

Coverage Status
Relevant Lines: 262295
Covered Lines: 201516
Line Coverage: 76.83%
Coverage Strength: 29547.94 hits per line

💛 - Coveralls

@NickMesser
NickMesser merged commit 57248e4 into rust-rewrite Oct 27, 2026
12 checks passed
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.

2 participants