From 88b02601b74275531654da7813e2a50a74de1314 Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Sat, 14 Nov 2026 16:59:07 -0600 Subject: [PATCH] test(aggregator): align seven test fixtures with landed type narrowings (#10379) --- pm-stack/aggregator/test/aa-batches.test.ts | 14 +++++++++----- pm-stack/aggregator/test/claude-adapter.test.ts | 12 ++++++------ pm-stack/aggregator/test/decisions-page.test.ts | 1 + pm-stack/aggregator/test/overview.test.ts | 1 + pm-stack/aggregator/test/projects.test.ts | 2 +- .../aggregator/test/quota-actions-1174.test.ts | 5 +++-- pm-stack/aggregator/test/quota-exhaustion.test.ts | 2 +- 7 files changed, 22 insertions(+), 15 deletions(-) diff --git a/pm-stack/aggregator/test/aa-batches.test.ts b/pm-stack/aggregator/test/aa-batches.test.ts index c1270cd276..445314d4c4 100644 --- a/pm-stack/aggregator/test/aa-batches.test.ts +++ b/pm-stack/aggregator/test/aa-batches.test.ts @@ -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"); }); @@ -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"); diff --git a/pm-stack/aggregator/test/claude-adapter.test.ts b/pm-stack/aggregator/test/claude-adapter.test.ts index fac45c34b3..d29b4499f7 100644 --- a/pm-stack/aggregator/test/claude-adapter.test.ts +++ b/pm-stack/aggregator/test/claude-adapter.test.ts @@ -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"); }, ]; diff --git a/pm-stack/aggregator/test/decisions-page.test.ts b/pm-stack/aggregator/test/decisions-page.test.ts index e1964adc7c..d1d9d6bdc3 100644 --- a/pm-stack/aggregator/test/decisions-page.test.ts +++ b/pm-stack/aggregator/test/decisions-page.test.ts @@ -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; } diff --git a/pm-stack/aggregator/test/overview.test.ts b/pm-stack/aggregator/test/overview.test.ts index a1b5f3e2d2..cc74d93e43 100644 --- a/pm-stack/aggregator/test/overview.test.ts +++ b/pm-stack/aggregator/test/overview.test.ts @@ -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: [] }, }; diff --git a/pm-stack/aggregator/test/projects.test.ts b/pm-stack/aggregator/test/projects.test.ts index 734a168a90..24ea508a1a 100644 --- a/pm-stack/aggregator/test/projects.test.ts +++ b/pm-stack/aggregator/test/projects.test.ts @@ -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", diff --git a/pm-stack/aggregator/test/quota-actions-1174.test.ts b/pm-stack/aggregator/test/quota-actions-1174.test.ts index 04f3ab5389..c70ca355a1 100644 --- a/pm-stack/aggregator/test/quota-actions-1174.test.ts +++ b/pm-stack/aggregator/test/quota-actions-1174.test.ts @@ -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": { @@ -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 }, ], }), diff --git a/pm-stack/aggregator/test/quota-exhaustion.test.ts b/pm-stack/aggregator/test/quota-exhaustion.test.ts index 8b6a804489..5f1379639b 100644 --- a/pm-stack/aggregator/test/quota-exhaustion.test.ts +++ b/pm-stack/aggregator/test/quota-exhaustion.test.ts @@ -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" }], }, ], };