From 68bbe80894cf5b00fb9d6c086d70394c95c371b7 Mon Sep 17 00:00:00 2001 From: araharah-executor Date: Mon, 26 Oct 2026 07:47:30 +0800 Subject: [PATCH] test(08.1-02): pin ARG3-honest gate wording and frozen measurement constants (RED) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MG1/MG2 fail against the current scripts: the optimality gate and the oracle sweep still describe the binary-under-test in ARG2-era terms and their decode-failure messages do not name ARG3 or the rebuild command. MG3 pins the CPU gate's budget/sample constants exactly-once (already true — stays green). --- routing/test/maintainer-scripts.test.mjs | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/routing/test/maintainer-scripts.test.mjs b/routing/test/maintainer-scripts.test.mjs index 66733c6..17c7fb6 100644 --- a/routing/test/maintainer-scripts.test.mjs +++ b/routing/test/maintainer-scripts.test.mjs @@ -110,3 +110,54 @@ test("BS5 --check decodes the committed ARG3 fixture green and prints CH facts assert.match(out, /chRank length: \d+/, "the rank length must print"); assert.ok(!/landmark/i.test(out), "--check prints CH facts, never landmark facts"); }); + +/* ————— MG — the measurement gates: frozen constants + honest ARG3 wording ————— */ + +const OPTIMALITY_SCRIPT = path.join(here, "..", "scripts", "measure-optimality-gate.mjs"); +const SWEEP_SCRIPT = path.join(here, "..", "scripts", "measure-astar-oracle-sweep.mjs"); +const CPU_SCRIPT = path.join(here, "..", "scripts", "measure-route-cpu.mjs"); + +test("MG1 the optimality gate keeps the frozen D-03 constants and honestly names ARG3 when the binary does not decode", () => { + const src = readSrc(OPTIMALITY_SCRIPT); + assert.equal( + countOccurrences(src, "OPTIMALITY_EPSILON_PCT = 0.1"), + 1, + "the ±0.1% epsilon mirror must appear exactly once, unchanged", + ); + assert.equal( + countOccurrences(src, "REQUIRED_BASELINE_ARG_VERSION = 1"), + 1, + "the frozen pre-ALT record's argVersion pin must appear exactly once, unchanged", + ); + const code = stripCommentLines(src); + assert.ok(code.includes("ARG3"), "the decode-failure message must name ARG3 (the current binary's format)"); + assert.ok(code.includes("build-road-graph.mjs"), "the failure must name the rebuild command"); +}); + +test("MG2 the oracle sweep keeps the seeded 200-pair symmetric-compare constants and honestly names ARG3", () => { + const src = readSrc(SWEEP_SCRIPT); + for (const [constant, occurrences] of [ + ["SWEEP_PAIR_COUNT = 200", 1], + ["SWEEP_SEED = 0x08f1", 1], + ["SWEEP_OVERSAMPLE_FACTOR = 3", 1], + ["SWEEP_MIN_PAIR_KM = 12", 1], + ["ORACLE_EPSILON_S = 1e-6", 1], + ]) { + assert.equal(countOccurrences(src, constant), occurrences, `"${constant}" must appear exactly ${occurrences} time(s), unchanged`); + } + const code = stripCommentLines(src); + assert.ok(code.includes("ARG3"), "the decode-failure message must name ARG3 (the current binary's format)"); +}); + +test("MG3 the CPU gate keeps the budget and sample constants exactly once — the 8 ms product budget is the binding pass bar", () => { + const src = readSrc(CPU_SCRIPT); + for (const [constant, occurrences] of [ + ["P95_BUDGET_MS = 8", 1], + ["ROUTE_COUNT = 25", 1], + ["SAMPLE_SEED = 0x06d4", 1], + ["EXTENDED_PAIR_COUNT = 100", 1], + ["EXTENDED_SEED = 0x08a1", 1], + ]) { + assert.equal(countOccurrences(src, constant), occurrences, `"${constant}" must appear exactly ${occurrences} time(s), unchanged`); + } +});