mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-02 05:12:11 +03:00
* test(ci): quarantine concurrency-sensitive flakes into a serial pass (tests/unit/serial/) glm-coding-plan-monthly-3580, quota-division-blocks and provider-health-autopilot fail under --test-concurrency>1 CPU contention but pass isolated (v3.8.45 release benchmark: this class cost ~28min re-runs per CI round). They now live in tests/unit/serial/ and run in a dedicated --test-concurrency=1 step appended to every runner (test:unit, :ci, :ci:shard, :fast, :shard:1/2, coverage:runner — sharded variants shard the serial pass too, so concurrent shard jobs never self-collide). Discovery + TIA gates know the new glob; stryker.conf.json path updated. Guard: tests/unit/test-serial-quarantine.test.ts (4 tests). * test(ci): quarantine combo-health-autopilot too (async logger writes after test end under load) Fresh evidence from this PR's own CI: all 3 subtests pass but an async log write lands after the test ends (ENOENT app.log -> uncaughtException) — same concurrency-flake family. Moved to tests/unit/serial/, imports adjusted, stryker path updated, guard test now asserts 4 quarantined files.
32 lines
1.5 KiB
TypeScript
32 lines
1.5 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { glmMonthlyRemainingPercentage } from "../../../open-sse/services/usage.ts";
|
|
|
|
// #3580 — z.ai/GLM coding plans have no monthly cap (only 5-hour windows), so the
|
|
// quota API reports the TIME_LIMIT ("Monthly") entry with total=0. The previous
|
|
// `total > 0 ? … : 0` fallback rendered that as a misleading "Monthly 0% remaining",
|
|
// which can skew downstream model-choice. With no absolute cap we now fall back to the
|
|
// percentage-derived remaining (full/100% when 0% used).
|
|
|
|
test("#3580 no monthly cap (total=0), 0% used → 100% remaining (was 0%)", () => {
|
|
assert.equal(glmMonthlyRemainingPercentage(0, 100), 100);
|
|
});
|
|
|
|
test("#3580 no monthly cap (total=0), no usage signal → defaults to full (100)", () => {
|
|
// remaining defaults to max(0, 100 - percentage); 0% used → 100
|
|
assert.equal(glmMonthlyRemainingPercentage(0, 100), 100);
|
|
});
|
|
|
|
test("#3580 absolute monthly cap still computes remaining/total", () => {
|
|
assert.equal(glmMonthlyRemainingPercentage(1000, 500), 50);
|
|
assert.equal(glmMonthlyRemainingPercentage(1000, 1000), 100);
|
|
assert.equal(glmMonthlyRemainingPercentage(1000, 0), 0);
|
|
});
|
|
|
|
test("#3580 clamps out-of-range values to [0,100]", () => {
|
|
assert.equal(glmMonthlyRemainingPercentage(0, 250), 100); // no cap, absolute remaining > 100 → clamp full
|
|
assert.equal(glmMonthlyRemainingPercentage(1000, 5000), 100);
|
|
assert.equal(glmMonthlyRemainingPercentage(0, -5), 0);
|
|
});
|