Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 6323ad4b040d40ad448213344f7eba2841e32bc4
parent 6f38f858d4faa344ca9c36108d7da3484ef24ada
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 12 Nov 2026 22:45:23 -0500

editor: the generation-usage test pins its answer's localOnly (false, and true under the flag)

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Meditor/app/api/ops/_generation.test.ts | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/editor/app/api/ops/_generation.test.ts b/editor/app/api/ops/_generation.test.ts @@ -46,7 +46,7 @@ test("both reads are behind the token", async () => { test("generation-usage answers the day's ledger total and the daily cap", async () => { const get = await route("generation-usage"); const none = await callGet(get, "http://localhost/api/ops/generation-usage?day=2026-10-01"); - assert.deepEqual(none.body, { ok: true, day: "2026-10-01", usd: 0, jobs: 0, daily: 7, models: [] }); + assert.deepEqual(none.body, { ok: true, day: "2026-10-01", usd: 0, jobs: 0, daily: 7, models: [], localOnly: false }); await mkdir(path.dirname(usageFile), { recursive: true }); // A local job's row (demo epic D3): a model called at no cost — never in the // spend or its jobs count, always in `models`. @@ -63,9 +63,19 @@ test("generation-usage answers the day's ledger total and the daily cap", async { model: "claude-sonnet-5-5", route: "api", calls: 0, jobs: 2, inputTokens: 2, outputTokens: 2 }, { model: "qwen3:8b", route: "local", calls: 5, jobs: 1, inputTokens: 900, outputTokens: 80 }, ], + localOnly: false, }); const today = await callGet(get, "http://localhost/api/ops/generation-usage"); assert.equal(today.body.day, new Date().toISOString().slice(0, 10)); + // The editor's own flag (demo epic D5), read per request. + const was = process.env.ARCHILYZER_LOCAL_ONLY; + process.env.ARCHILYZER_LOCAL_ONLY = "1"; + try { + assert.equal((await callGet(get, "http://localhost/api/ops/generation-usage")).body.localOnly, true); + } finally { + if (was === undefined) delete process.env.ARCHILYZER_LOCAL_ONLY; + else process.env.ARCHILYZER_LOCAL_ONLY = was; + } const bad = await callGet(get, "http://localhost/api/ops/generation-usage?day=yesterday"); assert.equal(bad.status, 400); const stray = await callGet(get, "http://localhost/api/ops/generation-usage?date=2026-10-01");