commit dc118a98cdb7a71087b24a9e1915546c40d14464
parent a9703776dd6fa9a5a8037b797a7eff6ec5c3e256
Author: anon <anon@example.com>
Date: Sun, 25 Oct 2026 18:11:49 +0000
Verify living NPC takeover after browser reconnect grace
Expand the real WebSocket expiry regression to check retained eligibility,
ordered target replacement, unchanged swing timing and independent damage
credit. Verify the actual two-minute interval on two hardware WASM clients,
including a living former target and a fresh rejoin without reclaimed threat.
Record bounded native holder-state and public packet-recording findings for
the still unresolved combat-healing delivery contract.
Diffstat:
4 files changed, 99 insertions(+), 13 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -365,12 +365,15 @@ for exact records, protocol, tests and remaining reconstruction assumptions.
decay/reset, disconnect/reconnect and healing/pet/proximity threat. The
current additive, current-target ties and encounter restart policy are
explicit reconstruction choices, not recovered server formulas.
-- [ ] Verify NPC takeover after browser reconnect grace with two native clients.
+- [x] Verify NPC takeover after browser reconnect grace with two native clients.
Check: the closed tab's living character remains eligible during transport
grace, then its threat disappears and a surviving participant takes over with
- no phantom hit. The first smoke's disconnected character died in the last
- tick before expiry, so that capture verifies death cleanup, not clean expiry.
- Controlled socket disconnect/retarget is separately covered in automation.
+ no phantom hit. A living target remained selected at 112 seconds and 379 HP
+ survived expiry. At 120.046 seconds, the observer received StopFight, Attack
+ on the remaining participant, then actor removal. Subsequent outcomes used
+ only the new target; reconnect did not restore old threat. The real WebSocket
+ expiry regression checks retained swing timing and independent damage credit.
+ See [native grace verification](docs/npc-threat.md#verification).
- [ ] Navigate around one simple obstacle. Check: a pursuing creature takes a
valid route around a wall rather than walking through it.
- [x] Recover NPC resources outside combat. Check: one profile follows an
diff --git a/docs/combat-healing-delivery.md b/docs/combat-healing-delivery.md
@@ -120,3 +120,35 @@ weapon queues, or forbidding the authored in-combat use of First Aid. A
correlated original-server capture, or footage with readable HP and a
successful heal overlapping a weapon impact, remains the strongest next
evidence. Combat-healing completion remains unproven.
+
+## Idle-holder and additional recording checks
+
+The immediate-drain branch in original AttackInfo receiver1007a660 checks
+holder state1, the idle state installed by construction and StopFight. Received
+Attack sets state2 before ordinary outcomes. Attack's serialized byte is ignored
+by its activation, as is StopFight's decoded boolean. Neither field supplies a
+neutral impact-drain mode. Current Go start-before-result delivery shows no
+active/idle inversion. Repeated Attack would reset weapon timers, while forcing
+idle requires actually stopping the encounter.
+
+The NPC pump's timer-hold/retry/line-of-sight branch and the selected receiver,
+start/stop, animation and timer paths match the maintained instruction lifts;
+all 23 selected dispatch entries are present. Fourteen complete retained
+original evidence records and source hashes were verified under
+`local/combat-heal-holder-research/`. This bounds the negative result to those
+paths. A predicate for state6 exists, but its meaning and setter remain
+unresolved; the audit does not claim exhaustive coverage of all holder states.
+The original start/stop evidence IDs are
+`ev_39bfbb5aa465c2bd44878c0e66677c6828387fa32d70cc5675b9d0e15ce9229c`
+and `ev_839516fbf9737749e969200bc7698259fa6decf43f39b3025dc440c60acd95f3`.
+
+A new public [aorust recording corpus](https://github.com/reiserFSs/aorust/tree/3e66d7384c0a0c74e47f89a14a1a5a4053d9bfb9/docs/captures)
+contains 31 `.rec` fixtures, including health clamping and combat-buff examples.
+The [producer](https://github.com/reiserFSs/aorust/blob/3e66d7384c0a0c74e47f89a14a1a5a4053d9bfb9/docs/protocol.md)
+explicitly selects the PRK 00.7.2_EP1 client and private Ithaca server in
+October 2026. Some fixtures are synthetic replays. The health-clamp file's three
+same-timestamp messages contain no adjacent AttackInfo or observed impact queue.
+These bytes therefore do not establish original Funcom 14.9.1 healing semantics.
+The separate SmokeLounge messaging fixtures are individual InfoPackets without
+a correlated encounter. Complete inventories, exact fetched bytes, provenance,
+URLs and hashes are retained in `local/combat-heal-new-capture-research/`.
diff --git a/docs/npc-threat.md b/docs/npc-threat.md
@@ -121,10 +121,31 @@ repeated taunts switched it. Both clients received eight one-point energy hits
on the primary fixture across the initial and ordinary-stat runs, with ordered
StopFight/Attack on target changes and no timed nano or application errors.
A fresh login correctly retained the other participant as the NPC target.
-The two-minute browser grace observation ended with the disconnected actor
-dying in its last combat tick before expiry. Its native observer saw the NPC
-stop at death while the other fight continued. That run is inconclusive for
-clean disconnect-expiry takeover; a living-target native repeat remains open.
+The two-minute browser grace has also been verified with a living disconnected
+target. Two fresh native clients uploaded Aggression Prod; one cast established
+the surviving participant's threat, and two casts selected the other player.
+Closing that player's tab retained the target through grace: the observer read
+392 HP at 111.914 seconds. At 120.046 seconds after close, it received StopFight,
+Attack on the remaining participant, then removal of the expired actor. The
+saved former target remained alive at 379 HP. All 33 outcomes during grace used
+the old target; all 17 later observed outcomes used the new target, with none
+sent late to the expired target. Damage credit remained 1/2 independently of
+threat removal. Reconnecting the former target did not steal the encounter.
+Across the takeover window, the survivor's native HP changed from 457 to 426
+exactly with the five received hits: 5, 5, 7, 8 and 6. The NPC weapon ring was empty at both
+snapshot endpoints; no extra native damage was observed in this bounded check.
+
+`TestExpiredBrowserWorldSessionRemovesLivingTargetAndRetargetsNPC` exercises
+the real WebSocket detach/expiry path, with only the two-minute timer advanced
+in automation. It verifies eligibility before expiry, StopFight/Attack/removal
+order, unchanged swing deadline, living saved state, transient threat removal,
+unchanged lifetime credit and exclusion from a later observer's initial replay.
+Native snapshots, wire/SQLite assertions and hardware identity are retained in
+`local/npc-grace-smoke/`. Owned fixtures were removed with unrelated rows
+unchanged and database integrity checks passing. No production change was needed.
+The broader browser/threat run passed 144 tests/subtests in 73.049s. Expiry and
+disconnect integration checks passed three times under the race detector in
+135.078s; vet passed.
The initial Body Development5000 fixtures showed player HP differences between
native observers. At Body Development80, both clients read 326/347 HP after
diff --git a/server/browser_stream_test.go b/server/browser_stream_test.go
@@ -417,7 +417,7 @@ func TestBrowserDisconnectedStreamExpiresAndRejectsResume(t *testing.T) {
}
}
-func TestExpiredBrowserWorldSessionRemovesPlayerFromOtherClients(t *testing.T) {
+func TestExpiredBrowserWorldSessionRemovesLivingTargetAndRetargetsNPC(t *testing.T) {
world := newTestServer(t)
closeTestBrowserStreams(t, world)
world.newCharacter()
@@ -450,16 +450,21 @@ func TestExpiredBrowserWorldSessionRemovesPlayerFromOtherClients(t *testing.T) {
}
world.mutex.Lock()
client := world.clients[2]
+ client.ready, client.loading = true, false
+ npc := world.characters[1000000]
+ npc.playfield, npc.health = world.characters[1].playfield, 100
+ npc.threat = map[uint32]int64{1: 5, 2: 10}
+ npc.damageContributors = map[damageContributor]uint32{{player: 1}: 5, {player: 2}: 10}
+ npc.fighting, npc.nextAttack = 2, time.Now().Add(10*time.Second)
+ clock := npc.nextAttack
+ world.fighting[npc.id] = npc
+ world.clients[1].npcs[npc.id], client.npcs[npc.id] = true, true
world.mutex.Unlock()
socket.CloseNow()
for {
client.stream.mutex.Lock()
detached := client.stream.expiry != nil
- if detached {
- // Advance the reconnect grace period without waiting two minutes.
- client.stream.expiry.Reset(0)
- }
client.stream.mutex.Unlock()
if detached {
break
@@ -470,6 +475,23 @@ func TestExpiredBrowserWorldSessionRemovesPlayerFromOtherClients(t *testing.T) {
case <-time.After(time.Millisecond):
}
}
+ world.mutex.Lock()
+ if world.clients[2] != client || world.characters[2].health == 0 || npc.fighting != 2 || npc.threat[2] != 10 {
+ t.Error("transport loss must retain the living target during reconnect grace")
+ }
+ world.mutex.Unlock()
+ // Advance the real transport expiry callback without waiting two minutes.
+ client.stream.mutex.Lock()
+ client.stream.expiry.Reset(0)
+ client.stream.mutex.Unlock()
+ stopped, err := readPacket(observer)
+ if err != nil {
+ t.Fatal(err)
+ }
+ started, err := readPacket(observer)
+ if err != nil {
+ t.Fatal(err)
+ }
despawn, err := readPacket(observer)
if err != nil {
t.Fatal(err)
@@ -489,6 +511,10 @@ func TestExpiredBrowserWorldSessionRemovesPlayerFromOtherClients(t *testing.T) {
t.Fatal(err)
}
+ if binary.BigEndian.Uint32(stopped[20:24]) != 0x4a41203e || binary.BigEndian.Uint32(stopped[28:32]) != npc.id ||
+ binary.BigEndian.Uint32(started[20:24]) != 0x28494070 || binary.BigEndian.Uint32(started[28:32]) != npc.id || binary.BigEndian.Uint32(started[40:44]) != 1 {
+ t.Fatalf("expiry must stop the old target before starting the remaining participant: %x / %x / %x", stopped, started, despawn)
+ }
if binary.BigEndian.Uint32(despawn[20:24]) != 0x36510078 || binary.BigEndian.Uint32(despawn[28:32]) != 2 {
t.Fatalf("expired player was not removed: %x", despawn)
}
@@ -502,4 +528,8 @@ func TestExpiredBrowserWorldSessionRemovesPlayerFromOtherClients(t *testing.T) {
if world.clients[2] != nil || world.characters[2] == nil {
t.Fatal("expiry should remove the connection and retain the saved character")
}
+ if world.characters[2].health == 0 || npc.fighting != 1 || npc.nextAttack != clock || len(npc.threat) != 1 || npc.threat[1] != 5 ||
+ npc.damageContributors[damageContributor{player: 1}] != 5 || npc.damageContributors[damageContributor{player: 2}] != 10 {
+ t.Fatal("expiry lost living state, swing timing, remaining threat or lifetime damage credit")
+ }
}