From 76329557c4a547b1797794bab0cd00a91e590510 Mon Sep 17 00:00:00 2001 From: wellkilo Date: Sun, 13 Sep 2026 05:14:26 +0800 Subject: [PATCH] test(metrics): derive oversized fixture from scan cap Export the internal scan budget for regression tests and size the oversized-line fixture as exactly two bounded passes. --- scripts/lib/session-cost-snapshot.js | 1 + tests/lib/session-cost-snapshot.test.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/lib/session-cost-snapshot.js b/scripts/lib/session-cost-snapshot.js index f95ddc8cb..779f83328 100644 --- a/scripts/lib/session-cost-snapshot.js +++ b/scripts/lib/session-cost-snapshot.js @@ -500,6 +500,7 @@ module.exports = { COST_SNAPSHOT_SCHEMA_VERSION, COST_SNAPSHOT_DIRECTORY, COST_LOG_FILENAME, + MAX_SCAN_BYTES, getCostSnapshotPath, isValidCostRow, chooseNewerCumulativeRow, diff --git a/tests/lib/session-cost-snapshot.test.js b/tests/lib/session-cost-snapshot.test.js index 5e004b49a..f941f8920 100644 --- a/tests/lib/session-cost-snapshot.test.js +++ b/tests/lib/session-cost-snapshot.test.js @@ -8,6 +8,7 @@ const path = require('path'); const { appendSessionCostRow, getCostSnapshotPath, + MAX_SCAN_BYTES, maybePruneSessionCostSnapshots, readSessionCostSnapshot, refreshSessionCostSnapshot, @@ -199,7 +200,7 @@ try { if (test('bounds oversized unterminated rows and caches the discarded prefix', () => { const caseRoot = path.join(root, 'oversized-line'); fs.mkdirSync(caseRoot, { recursive: true }); - const oversizedBytes = 32 * 1024 * 1024; + const oversizedBytes = 2 * MAX_SCAN_BYTES; fs.writeFileSync( path.join(caseRoot, 'costs.jsonl'), Buffer.alloc(oversizedBytes, 0x78)