Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions pm-stack/aggregator/test/aa-batches.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,14 @@ describe("live AA batch selection", () => {
);

const source = liveSource(loadConfig({ PM_AGG_SOURCE: "live", PM_AGG_FEED_FILE: feedFile }));
expect((await source.aa())?.batch).toBe(B1);
const current = await source.aa();
if (current?.status !== "ok") throw new Error("expected an ok AA section");
expect(current.batch).toBe(B1);
const selected = await source.aa(B3);
expect(selected?.status).toBe("ok");
expect(selected?.batch).toBe(B3);
expect(selected?.batches?.map((batch) => batch.importBatch)).toEqual([B1, B3]);
if (selected?.status !== "ok") throw new Error("expected an ok AA section");
expect(selected.batch).toBe(B3);
expect(selected.batches?.map((batch) => batch.importBatch)).toEqual([B1, B3]);
expect((await source.aa("44444444-4444-4444-8444-444444444444"))?.status).toBe("absent");
});

Expand Down Expand Up @@ -445,8 +448,9 @@ describe("live AA batch selection", () => {
const source = liveSource(loadConfig({ PM_AGG_SOURCE: "live", PM_AGG_FEED_FILE: feedFile }));
const selected = await source.aa(B3);
expect(selected?.status).toBe("ok");
expect(selected?.stale).toBe(true);
expect(selected?.staleReason).toContain("rebuilding");
if (selected?.status !== "ok") throw new Error("expected an ok AA section");
expect(selected.stale).toBe(true);
expect(selected.staleReason).toContain("rebuilding");
const html = renderAa(selected ?? null, new Proxy({}, { get: () => "live" }) as Provenance);
expect(html).toContain("The latest collection failed");
expect(html).toContain("rebuilding");
Expand Down
12 changes: 6 additions & 6 deletions pm-stack/aggregator/test/claude-adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,12 @@ describe("parseClaudeUsagePayload / collectClaudeAdapter properties (#1163, Code

test("property: failed collection retains the previous entry, never zeros", async () => {
const failureModes = [
() => ({ httpStatus: 401, payload: null }),
() => ({ httpStatus: 403, payload: null }),
() => ({ httpStatus: 500, payload: null }),
() => ({ httpStatus: 200, payload: { drifted: true } }),
() => ({ httpStatus: 200, payload: { five_hour: { utilization: "0x10" } } }),
() => {
async () => ({ httpStatus: 401, payload: null }),
async () => ({ httpStatus: 403, payload: null }),
async () => ({ httpStatus: 500, payload: null }),
async () => ({ httpStatus: 200, payload: { drifted: true } }),
async () => ({ httpStatus: 200, payload: { five_hour: { utilization: "0x10" } } }),
async () => {
throw new Error("network down");
},
];
Expand Down
1 change: 1 addition & 0 deletions pm-stack/aggregator/test/decisions-page.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function freePort(): number {
const s = Bun.serve({ port: 0, fetch: () => new Response("x") });
const p = s.port;
s.stop(true);
if (p === undefined) throw new Error("freePort: Bun.serve did not report a port");
return p;
}

Expand Down
1 change: 1 addition & 0 deletions pm-stack/aggregator/test/overview.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const health: HealthView = {
itemsCoverage: null,
comments: { pendingMessages: 0, pendingGithub: 0, total: 0 },
conflicts: null,
push: null,
rfa: { state: "fixtures", detail: "fixtures mode — no live harness read", repositories: [], backends: [] },
};

Expand Down
2 changes: 1 addition & 1 deletion pm-stack/aggregator/test/projects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const GQL = {
views: { nodes: [{ id: "PVTV_board", name: "Board", layout: "BOARD_LAYOUT", filter: "Status:open" }] },
items: {
totalCount: 3,
pageInfo: { hasNextPage: false, endCursor: null },
pageInfo: { hasNextPage: false, endCursor: null as string | null },
nodes: [
{
id: "PVTI_1",
Expand Down
5 changes: 3 additions & 2 deletions pm-stack/aggregator/test/quota-actions-1174.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { describe, expect, test } from "bun:test";

import { buildQuotaActions, quotaActionFlags, quotaActionTierItems } from "../src/derive.ts";
import { renderTodayBody } from "../src/render.ts";
import type { AttentionView, QuotaPool, QuotaView, TodayView } from "../src/model.ts";
import type { QuotaPool, QuotaView } from "../src/model.ts";
import type { AttentionView, TodayView } from "../src/derive.ts";

const PLANS = {
"opencode-go.personal": {
Expand Down Expand Up @@ -165,7 +166,7 @@ describe("buildQuotaActions (#1174)", () => {
provider: "OpenAI",
plan: "Codex",
windows: [
{ name: "5-hour", unit: "other", limit: 100, used: 99, percent: 99 },
{ name: "5-hour", unit: "other", limit: 100, used: 99, resetsAt: null, percent: 99 },
{ name: "weekly", unit: "other", limit: 100, used: 92, resetsAt: "2026-10-30T12:00:00Z", percent: 92 },
],
}),
Expand Down
2 changes: 1 addition & 1 deletion pm-stack/aggregator/test/quota-exhaustion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ describe("deriveExhaustionForecasts (#3983)", () => {
state: "ok",
measuredAt: NOW.toISOString(),
source: "test-gatherer",
windows: [{ name: "5h", pctOfLimit: 10, resetsAt: RESET }],
windows: [{ name: "5h", value: 10, pctOfLimit: 10, valueLabel: null, windowSeconds: 18000, resetsAt: RESET, measuredAt: NOW.toISOString(), source: "test-gatherer", state: "ok" }],
},
],
};
Expand Down