fix(drill): lay the harness's kit down before boot instead of reloading Kits (#22)

Run 48 deleted Kits' file for a fresh start, and the harness's
rnhrevolver kit, added after boot with `oxide.reload Kits` through the
panel's command endpoint, never reached Kits: no reload or compile job
followed, and every test profile was refused for want of the kit.

The drill now replaces kits_data.json with one holding only that kit.
Kits reads it at boot; RunicNPC's first load adds its example kits
beside it (it skips kits already there) and settles its own Kits
reload (D329). The add-after-boot stays as a fallback, now through the
console's websocket, and is a finding when Kits does not load again.

Refs #20, #22

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
2026-11-01 01:50:19 -06:00
parent 54fb1ece67
commit 4fb935d9dd
3 changed files with 47 additions and 16 deletions

View File

@@ -3,7 +3,7 @@
const test = require('node:test')
const assert = require('node:assert')
const { harnessProgress, unfinishedFinding, FRESH_DATA, HARNESS_STALL_MS } = require('./drill.js')
const { harnessProgress, unfinishedFinding, FRESH_DATA, KITS_FILE, harnessKits, HARNESS_STALL_MS } = require('./drill.js')
const MIN = 60000
const T0 = 1000000
@@ -52,7 +52,16 @@ test('a capped wait keeps the 45-minute message', () => {
})
test('the clean start deletes files only: every path ends in .json and none is a directory', () => {
assert.ok(FRESH_DATA.includes('/oxide/data/Kits/kits_data.json'))
assert.ok(FRESH_DATA.includes('/oxide/data/RunicNPC/state.json'))
for (const f of FRESH_DATA) assert.match(f, /^\/oxide\/data\/(Kits|RunicNPC)\/[a-z_]+\.json$/)
for (const f of FRESH_DATA) assert.match(f, /^\/oxide\/data\/RunicNPC\/[a-z_]+\.json$/)
})
test("Kits' file is replaced, not deleted, by one holding only the harness's kit (#22)", () => {
assert.ok(!FRESH_DATA.includes(KITS_FILE))
assert.equal(KITS_FILE, '/oxide/data/Kits/kits_data.json')
const kits = harnessKits()._kits
assert.deepEqual(Object.keys(kits), ['rnhrevolver'])
assert.equal(kits.rnhrevolver.Name, 'rnhrevolver')
assert.equal(kits.rnhrevolver.IsHidden, true)
assert.deepEqual(kits.rnhrevolver.BeltItems.map((i) => i.Shortname), ['pistol.revolver'])
})