Files

28 lines
3.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Cast result framing before state changes — 2026-11-27
At source0x130, the gateway could record partial result diagnostics and clear a deferred standing cast, then return without parsing when no active/superseded/melee cast existed. A malformed result was therefore accepted and could lose deferred state. The first new malformed case fails against the accepted d1e2643c baseline ([before log](before.log)).
The fix calls the existing strict turtle_cast_failure parser once at route entry, before diagnostics or mutation, and reuses that parsed result in the existing stance and active-cast paths. It does **not** change valid-result retirement, correlation, failure mapping, or native output policy. In particular, this task does not assert that a complete unrelated valid result should preserve a local deferred cast; that policy is deliberately unchanged.
## Source and native contracts
Source `/mnt/Games/@project/build/source-server-main-20261124/source/src/game/Spells/Spell.cpp:4581–4611`, SendCastResult, writes uint32 spell ID, status0 for success or status2+reason for failure. Success is exactly5 bytes. Ordinary failure is6 bytes; SPELL_FAILED_REQUIRES_SPELL_FOCUS and REQUIRES_AREA append one uint32, and EQUIPPED_ITEM_CLASS appends three uint32 words. The source request targets the player's session. It is not the broadcast casterGUID+spell interruption0x2a6.
The existing [parser](../../../../src/gameplay.cpp#L208) already enforces these exact variants, status values and end-of-packet. No parser rules or field mappings change. The defect was conditionally bypassing that parser, not absence of a new inferred client rule.
Existing native failure production still requires a correlated cast identity through the route's pending/stance logic. Maintained `servers/trinity-forever/src/server/game/Server/Packets/SpellPackets.cpp`, CastFailed/SpellFailure writers, carry native cast/spell identities; this change neither fabricates one nor changes those serialized packets. No original70334 reader reanalysis or new opcode claim.
## Integrated regression
Added cases to the existing native_stand_cast_pipeline_test.cpp after the accepted0x2a6 tests. Each malformed packet is sent through NativeWorldTranslation::translate with a genuine deferred stand-cast and also with no active cast. Deferred identity and exact source payload must survive; the next genuine source stand acknowledgement makes the original cast sendable.
Cases cover every truncated prefix and one trailing byte for success, ordinary failure, both one-argument failure forms, and the three-argument failure form, plus unsupported statuses1/3. Complete controls for all five layouts retain existing behavior: no uncorrelated native failure event and the same valid-result deferred retirement. This isolates framing atomicity from local cast policy.
The before executable reused the accepted d1e2643c world_translation object so its0x2a6 behavior was already fixed; it did not regress to the older shared library implementation. The remaining native/protocol functions use the pinned75d0ba65 snapshot. [Input hashes](host-inputs.json) include the reused baseline object. The after executable compiles only the changed world_translation unit and changed fixture with C++20/warnings-as-errors; no full gate, codec or client run.
After correction: **607 counted checks PASS**, plus uncounted exception-rejection checks, zero failures. This includes the accepted190-check0x2a6 fixture base and417 additional counted setup/validation/recovery assertions. [After log](after.log), [receipt](receipt.json).
## Scope
Only the0x130 parser placement in world_translation.cpp, existing stand-cast fixture and this evidence change. Parent movement_sent, book, ops/CMake, and integrated build/gate are untouched. The branch is based on accepted d1e2643c, which parent already merged. Live native behavior is not newly verified; no queue43 attribution or local-cast policy fix is claimed.