Update Healer Man server

This commit is contained in:
phenom committed 2026-09-19 21:01:51 -04:00
1 parent f8314e7de1
commit 1fedb9368d
76 files changed
+20556 -2523

No files matched your search

+56 -1
View File
@@ -1,6 +1,6 @@
import assert from "node:assert/strict";
import { EventEmitter } from "node:events";
import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import os from "node:os";
import path from "node:path";
import { PassThrough } from "node:stream";
@@ -20,6 +20,12 @@ test("disables public assets and filesystem watching in Balance Lab Vite mode",
assert.deepEqual(config.server.watch?.ignored, ["**/*"]);
});
test("enables the local Balance Lab GUI without watching its generated reports", async () => {
const config = await resolveConfig({}, "serve", "balance-lab-gui");
assert.equal(config.define["import.meta.env.VITE_LOCAL_BALANCE_LAB_GUI"], '"true"');
assert.ok(config.server.watch?.ignored?.includes("**/artifacts/balance-lab-gui-runtime/**"));
});
test("normalizes and bounds server Balance Lab requests", () => {
const spec = normalizeBalanceLabJobSpec({
source: "ALL",
@@ -30,6 +36,8 @@ test("normalizes and bounds server Balance Lab requests", () => {
simulationsPerParty: 3,
durationSeconds: 45,
partySeed: 17,
seatSweep: true,
includeBetaSpecs: true,
bossCategory: "all",
bossKeys: ["gundrak/entry-29932", "gundrak/entry-29932"],
});
@@ -37,6 +45,8 @@ test("normalizes and bounds server Balance Lab requests", () => {
assert.equal(spec.specSelection, "specific");
assert.deepEqual(spec.selectedBuildIds, ["balance-wow-priest-healer-holy-level-40"]);
assert.deepEqual(spec.bossKeys, ["gundrak/entry-29932"]);
assert.equal(spec.seatSweep, true);
assert.equal(spec.includeBetaSpecs, true);
assert.throws(
() => normalizeBalanceLabJobSpec({ source: "wow", level: 81 }),
/Level must be a whole number/,
@@ -69,6 +79,8 @@ test("builds an argument-array command without a shell", () => {
const spec = normalizeBalanceLabJobSpec({
source: "rom", level: 60, partyConfigurations: 4, simulationsPerParty: 2,
durationSeconds: 30, partySeed: 9, bossCategory: "rom", bossKeys: ["abbey/boss-1"],
seatSweep: true,
includeBetaSpecs: true,
specSelection: "specific", selectedBuildIds: ["balance-rom-mage-damage-primary-level-60"],
});
const command = balanceLabCommand(spec, "C:/reports/job", {
@@ -81,6 +93,8 @@ test("builds an argument-array command without a shell", () => {
assert.equal(command.args.includes("specific"), true);
assert.equal(command.args.includes("balance-rom-mage-damage-primary-level-60"), true);
assert.equal(command.args.includes("abbey/boss-1"), true);
assert.equal(command.args.includes("--seat-sweep"), true);
assert.equal(command.args.includes("--include-beta-specs"), true);
assert.equal(command.cwd, path.resolve("C:/app"));
});
@@ -162,6 +176,47 @@ test("queues a job, reports progress, and exposes only allow-listed artifacts",
}
});
test("snapshots the published companion readiness policy for each server job", async () => {
const directory = mkdtempSync(path.join(os.tmpdir(), "healer-man-balance-readiness-"));
try {
let launchedArgs = [];
const spawnProcess = (_executable, args) => {
launchedArgs = args;
const child = new EventEmitter();
child.stdout = new PassThrough();
child.stderr = new PassThrough();
child.kill = () => child.emit("close", null);
return child;
};
const policy = {
revision: 7,
updatedAt: 123,
updatedBy: "Phenom",
config: { schemaVersion: 1, statuses: { "warrior:protection": "ready" } },
};
const service = createBalanceLabJobService({
dataDir: directory,
projectRoot: directory,
spawnProcess,
pythonExecutable: "python-test",
readinessPolicyProvider: () => policy,
});
const job = service.start({
source: "wow", level: 40, partyConfigurations: 1, simulationsPerParty: 1,
durationSeconds: 5, partySeed: 1, bossCategory: "all", bossKeys: ["gundrak/entry-29932"],
includeBetaSpecs: true,
}, { username: "Phenom" });
const policyPath = path.join(directory, "balance-lab", "jobs", job.id, "companion-spec-readiness.json");
assert.equal(JSON.parse(readFileSync(policyPath, "utf8")).revision, 7);
assert.equal(launchedArgs.includes("--companion-readiness-policy"), true);
assert.equal(launchedArgs.includes(policyPath), true);
assert.equal(launchedArgs.includes("--include-beta-specs"), true);
service.close();
} finally {
rmSync(directory, { recursive: true, force: true });
}
});
test("reports exhausted file watchers as a specific startup failure", async () => {
const directory = mkdtempSync(path.join(os.tmpdir(), "healer-man-balance-watchers-"));
try {