28 lines
3.9 KiB
Markdown
28 lines
3.9 KiB
Markdown
# Pet cast failure must not serialize unmapped sentinel — 2026-11-27
|
||
|
||
Supported source0x138 converted every error byte through the reviewed spell-result profile and blindly serialized the result as uint32. The profile uses-1 for “no semantic native mapping”; this became a native PetCastFailed reason0xffffffff. A named source error without a mapping fails the integrated regression before correction ([before log](before.log)).
|
||
|
||
The fix suppresses only negative mapping results before constructing the native packet. Existing mapped reasons, opcode, spell identity, empty cast ID and absent-argument sentinels remain unchanged. No fallback error is invented. This matches ordinary `turtle_cast_failure` behavior for unmapped errors.
|
||
|
||
## Source and native contract
|
||
|
||
Source `/mnt/Games/@project/build/source-server-main-20261124/source/src/game/Objects/Unit.cpp:9600–9613`, SendPetCastFail, returns immediately for SPELL_CAST_OK. Otherwise it sends uint32 spell ID, status2, uint8 reason to the controlling player's session, with no optional argument tail. `Spells/SpellDefines.h` defines failures0..145 and CAST_OK255, explicitly not to be sent to the client.
|
||
|
||
Existing `include/gateway/spell_result_profile.hpp` is generated by semantic enum names. It returns-1 for unmapped values; `src/gameplay.cpp:208` already drops such ordinary cast failures after validating framing. Seven actual source failures lack entries:12 CANT_BE_DISENCHANTED,69 NO_CHAMPION,81 ONLY_DAYTIME,84 ONLY_NIGHTTIME,130 DISENCHANT_WHILE_LOOTING,131 PROSPECT_WHILE_LOOTING,132 PROSPECT_NEED_MORE. These remain explicit holds; this task does not assert they are all emitted by current pet abilities or choose substitute native errors. Bytes146..254 are outside this source failure enum and255 is the producer-excluded success code.
|
||
|
||
Maintained `/mnt/Games/@project/servers/trinity-forever/src/server/game/Server/Packets/SpellPackets.cpp:569`, PetCastFailed::Write, writes CastID, int32 SpellID, int32 Reason and two int32 failure arguments. The existing0x69004b route is retained. Empty CastID and -1 argument defaults are unchanged; a -1 **reason** here is the translator's unmapped sentinel, not an established source/native semantic error. No new original70334 reader or live UI proof is claimed.
|
||
|
||
## Integrated regression
|
||
|
||
The existing source_combat_event_test.cpp now checks exact complete native packets for explicit independent named pairs: source0 AFFECTING_COMBAT → native1, source35 INTERRUPTED → native63, and source145 UNKNOWN → native324. The real UNKNOWN error must remain distinct from an unmapped sentinel.
|
||
|
||
Seven named unmapped errors and all110 bytes146..255 must emit no native packet. All six truncated lengths and a trailing byte are rejected; a final mapped interruption verifies recovery. There are128 new assertions on the357-check fixture base. No test-generated implementation mapping is used as the oracle for the positive packet bytes.
|
||
|
||
Before correction the first unmapped named error leaks a native event and fails. The fixture stops there; no exhaustive before-failure count is claimed. Only the changed world_translation unit and changed fixture are compiled, linking remaining runtime against the pinned75d0ba65 shared native/protocol snapshot with6dc6e75a headers. [Input hashes](host-inputs.json). No full gate, native release-library rebuild, codec build or client action.
|
||
|
||
After correction: **485 assertions PASS, zero failures**, including128 added checks ([after log](after.log), [receipt](receipt.json)). Compilation used C++20/warnings-as-errors and the existing paired gameobject/staged item-render profile defines. This count excludes later accepted duel/level-up additions, which parent integrates separately.
|
||
|
||
## Scope
|
||
|
||
Only0x138 in world_translation.cpp, the existing combat fixture and this evidence change. No result-profile generation or mapping changes, no other accepted route edits, no ops/CMake, and no queue38/39 work. Native display acceptance remains external; parent owns integration.
|