fix(rust): a zone resource carries its deadline as until (W1)
Stage 4 of docs/modules/rust/PLAN_LAST_FIXES.md, the module's half of W1. A placed zone now reports `until`, reckoned from the answer as now plus holdMs, so it lands a round trip after the game's own deadline and never before it. Core's reconcile then files a zone gone past that deadline as expired, where a reconnect used to log resource.orphaned five seconds before the game's world.expired arrived. Crates and NPCs send no holdMs, so they carry no until. No core pin change: `until` has been in the resource contract all along, and a core without the reconcile half only shows it on the console. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -232,6 +232,29 @@ test('a zone crosses with its flags, settings, messages in the chat voice, and i
|
||||
})
|
||||
})
|
||||
|
||||
test('a zone resource carries its deadline as until, a crate none (W1)', async (t) => {
|
||||
// Core's reconcile reads `until`: a zone gone past it is expired, not
|
||||
// orphaned. Reckoned from the answer, so it never falls before the game's own.
|
||||
stubZones(t)
|
||||
stubWorld(t)
|
||||
const before = Date.now()
|
||||
const result = await action('rust.zone.open').perform({
|
||||
runId: 7, idempotencyKey: 'k', params: { monument: 'main/a', radius: 40, minutes: 30 },
|
||||
})
|
||||
assert.strictEqual(result.ok, true, result.error)
|
||||
const until = Date.parse(result.resources[0].until)
|
||||
assert.ok(until >= before + 1800000 && until <= Date.now() + 1800000, result.resources[0].until)
|
||||
|
||||
const saved = client.worldPlace
|
||||
client.worldPlace = async () => ({ ok: true, status: 'ok', data: { kind: 'world.ok', placed: [{ id: 'rg-7-1-2', kind: 'crate' }] } })
|
||||
t.after(() => { client.worldPlace = saved })
|
||||
const crate = await action('rust.crate.place').perform({
|
||||
runId: 7, idempotencyKey: 'k2', params: { monument: 'main/a', prefab: 'crate.elite', count: 1 },
|
||||
})
|
||||
assert.strictEqual(crate.ok, true, crate.error)
|
||||
assert.strictEqual('until' in crate.resources[0], false)
|
||||
})
|
||||
|
||||
test('a dome with its stack left blank stacks 3 spheres (D326)', async (t) => {
|
||||
stubZones(t, { servers: [server('main', { domes: PATCHED })] })
|
||||
const calls = stubWorld(t)
|
||||
|
||||
Reference in New Issue
Block a user