diff --git a/pm-stack/aggregator/scripts/collect-fleet-feed.ts b/pm-stack/aggregator/scripts/collect-fleet-feed.ts index 0934b90bdb..e4f33cd6b8 100644 --- a/pm-stack/aggregator/scripts/collect-fleet-feed.ts +++ b/pm-stack/aggregator/scripts/collect-fleet-feed.ts @@ -74,7 +74,6 @@ import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { dnsSectionFromRegister, dnsSectionFromRegisterJson, parseDnsRegister } from "../src/dns.ts"; import { - disabledProvidersFromConfig, aaAbsent, aaSectionFromSupabase, isAaSection, @@ -199,10 +198,11 @@ function poolFor(provider: string, model: string): string | null { return "opendesign"; case "deepseek": return "deepseek"; + case "antigravity-direct": case "antigravity-ls": case "antigravity-agy": case "google": - return model.startsWith("gemini") ? "antigravity:gemini" : "antigravity:claude-gpt"; + return model.startsWith("gemini") ? "antigravity-direct.gemini" : "antigravity-direct.claude-gpt"; default: // opencode-go is deliberately unattributed in slice 1: which // workspace (Personal vs Lab) a sandbox session burns is not @@ -537,20 +537,14 @@ async function main(): Promise { let quotaViewText = ""; try { quotaViewText = await readFile(quotaViewPath, "utf8"); - // #1114: enforce the deployed config's disabled_providers at pool - // assembly. The config read mirrors the AA section's; an unreadable - // config leaves the set empty (fail soft, pools unfiltered). - let disabledProviderIds: ReadonlySet = new Set(); - try { - disabledProviderIds = disabledProvidersFromConfig(await readFile(opencodeConfigPath, "utf8")); - } catch { - console.error("collector: opencode.jsonc unreadable; quota disabled_providers filter inactive this run"); - } - pools = extractQuotaPools(quotaViewText, now, disabledProviderIds, (poolId, providerId) => - console.error( - `collector: quota pool ${poolId} filtered — provider ${providerId} is in disabled_providers (#1114)`, - ), - ); + // Pass-through (Drew, 2026-11-03): pool assembly applies NO + // disabled_providers filter. The #1114 filter dropped every pool + // whose direct config door was disabled — including live pools + // burned through model routes and measured by OpenCode (meta, the + // Antigravity splits, commandcode, anthropic:claude-pro, deepseek + // at removal time). The board displays the OpenCode quota read; + // the dated reads extracted here are only its fail-soft fallback. + pools = extractQuotaPools(quotaViewText, now); markSection("quota", "ok"); } catch (err) { console.error(`collector: quota view unreadable (${sanitizeCollectionError(err)}); emitting no pools`); diff --git a/pm-stack/aggregator/src/quota-current.ts b/pm-stack/aggregator/src/quota-current.ts index abdb2283c6..27db710f3f 100644 --- a/pm-stack/aggregator/src/quota-current.ts +++ b/pm-stack/aggregator/src/quota-current.ts @@ -224,6 +224,14 @@ function applyEntry(pool: QuotaPool, entry: QuotaCurrentEntry, state: FreshState pool.windows = windows; pool.state = poolState(pool); delete pool.wallLiftsAt; + // Pass-through (Drew, 2026-11-03): the displayed numbers are now the + // live read's, so the base pool's note — dated steward prose written + // against older numbers — must not ride along and outrank the read. + // The read carries no prose note of its own; its planLabel shows as + // the pool's plan and its freshness stamps the measurement. A pool + // whose read did NOT land (error/stale/balance-only) keeps its dated + // note, which still describes the dated values on display. + delete pool.note; return true; } @@ -314,6 +322,19 @@ function summarize(file: QuotaCurrentFile, nowMs: number): GathererSummary { }; } +/** + * Gatherer serviceIds that never become quota pools of their own: + * "turso" is a SaaS usage row (its display surface is the SaaS cards, + * via overlayTursoUsage), and "antigravity" / "opencode-go" are the + * COMBINED account rows whose pool-level rendering is their split + * rows (antigravity-direct.gemini / antigravity-direct.claude-gpt and + * opencode-go.drewrypope / opencode-go.popesdrew, produced by + * entriesWithPoolSplits in quota-gather-map.ts). Synthesizing pools + * for them would double-render the same read. Every OTHER serviceId + * the read reports renders as a pool — see the synthesis below. + */ +const NON_POOL_SERVICE_IDS: ReadonlySet = new Set(["turso", "antigravity", "opencode-go"]); + /** * Overlay a parsed quota-current document onto a quota view. Pure: * the input view is not mutated; pools are copied when changed. @@ -344,12 +365,48 @@ export function overlayQuotaCurrent(view: QuotaView, file: QuotaCurrentFile, now return pool; }); - const out: QuotaView = { ...view, pools, gatherer: summarize(file, nowMs) }; + // Unmapped-pool pass-through (Drew, 2026-11-03 — "the dashboard + // should not be doing any of that"): a gatherer entry whose + // serviceId matches no pool in the base view used to be silently + // dropped here — that key mismatch is how the OpenDesign read + // vanished in the morning of 2026-11-03, and the commandcode read + // (serviceId "command-code" until quota-gather-map learned the + // config name) never landed at all. The board is a straight display + // of the OpenCode quota read: any reported pool the base view does + // not know renders under the id the read reported, with the read's + // own provider/plan labels and freshness. Only the documented + // non-pool rows (NON_POOL_SERVICE_IDS) are exempt. + const knownIds = new Set(pools.map((p) => p.id)); + const synthesized: QuotaPool[] = []; + for (const serviceId of [...byService.keys()].sort()) { + if (knownIds.has(serviceId) || NON_POOL_SERVICE_IDS.has(serviceId)) continue; + const entries = byService.get(serviceId)!; + const newest = [...entries].sort(newestFirst(nowMs))[0]; + const pool: QuotaPool = { + id: serviceId, + provider: newest.providerName, + plan: newest.planLabel ?? "", + state: "healthy", + windows: [], + }; + const freshOk = entries.filter((e) => entryState(e, nowMs) === "ok").sort(newestFirst(nowMs)); + if (freshOk.length > 0) { + if (applyEntry(pool, freshOk[0], "ok")) anyFreshWindows = true; + const rows = credentialRows(entries, nowMs); + if (rows) pool.credentials = rows; + } else { + applyEntry(pool, newest, entryState(newest, nowMs)); + } + synthesized.push(pool); + } + const allPools = [...pools, ...synthesized]; + + const out: QuotaView = { ...view, pools: allPools, gatherer: summarize(file, nowMs) }; const credentialLifecycle = file.providers .filter((entry) => entry.credentialWatch === true) .map((entry) => lifecycleForEntry(entry, now)); if (credentialLifecycle.length) out.credentialLifecycle = credentialLifecycle; - if (anyFreshWindows) out.choices = computeChoices(pools, nowMs); + if (anyFreshWindows) out.choices = computeChoices(allPools, nowMs); return out; } diff --git a/pm-stack/aggregator/src/quota-extract.ts b/pm-stack/aggregator/src/quota-extract.ts index b99ce3c3f4..01a87c2603 100644 --- a/pm-stack/aggregator/src/quota-extract.ts +++ b/pm-stack/aggregator/src/quota-extract.ts @@ -262,21 +262,15 @@ const extractChatGptAlternate: Extractor = (s) => { }; const extractMeta: Extractor = (s, now) => { - // A dated billing-blocked read (402 billing_not_configured — the - // billing-verification wall) outranks every window/reset read: the - // pool is blocked at the account level, whatever the windows say. - // The 100% weekly window is the fleet's blocked-status mapping (it - // drives poolState → walled), NOT a measured consumption percentage; - // the note says so, and no reset is invented for when it lifts. - const blocked = - /(\d{4}-\d{2}-\d{2})[^\n]{0,200}?billing_not_configured/i.exec(s) ?? - /billing_not_configured[^\n]{0,200}?(\d{4}-\d{2}-\d{2})/i.exec(s); - if (blocked) { - return { - windows: [pctWindow("weekly", 100, null)], - note: `BLOCKED ${blocked[1]} — API returns 402 billing_not_configured (billing-verification wall); laptop meta-provider probes all walled, stewardship measurement gate closed. The 100% weekly window is a blocked-status mapping, not measured consumption.`, - }; - } + // Dated-read fallback only (Drew, 2026-11-03 — the dashboard is a + // straight display of the OpenCode quota read and must not interpose + // interpretations of its own): this extractor reports the newest + // DATED percentage/reset read in the steward's view and nothing + // more. The former billing_not_configured branch PROMOTED a dated + // prose mention into a fabricated walled 100% window + BLOCKED note + // that outranked the live read for days after the account + // recovered; a billing wall now arrives as the quota read's own + // error state (overlayQuotaCurrent), never as promoted prose. const reset = first(s, /[Ww]eekly reset (?:today )?(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}) CDT/); const resetIso = reset ? resetDateTimeCentral(reset[1], reset[2]) : null; const burned = /burned to empty/i.test(s); @@ -474,12 +468,22 @@ interface PoolSpec { // replaced (meta:high-usage, openai:codex, opencode-go:drewrypope, ...) // survive only in the historical snapshot series and the one-shot // backfill seed (scripts/backfill-usage-snapshots.ts), which keep the -// ids in use on their observation dates. Two pools keep colon ids -// because the config defines no provider with their name: -// anthropic:claude-pro (burned through the claude-code provider) and -// the antigravity:* splits (burned through antigravity-ls / -// antigravity-agy / google; the config's antigravity-direct is a -// different door and renaming would misattribute the pools). +// ids in use on their observation dates. The two Antigravity pools +// are the quota module's model-family splits of the one Antigravity +// account; they ride under the config's surviving antigravity +// provider, antigravity-direct, with the family as a dot suffix — +// antigravity-direct.gemini / antigravity-direct.claude-gpt — the +// opencode-go. pattern (Drew, 2026-11-03: "why are you not +// including antigravity in the board?"). Ground truth for the +// choice: the deployed config defines antigravity-agy, +// antigravity-direct and antigravity-ls (ls/agy are the disabled +// legacy doors; no antigravity-local provider exists), and +// antigravity-direct is the in-fork door the account's traffic was +// consolidated onto. One pool keeps a colon id because the config +// defines no provider with its name: anthropic:claude-pro (burned +// through the claude-code provider; the pool is the Claude Pro +// subscription that door spends, and the colon id keeps that +// attribution honest). export const POOL_SPECS: PoolSpec[] = [ { id: "meta", @@ -547,7 +551,7 @@ export const POOL_SPECS: PoolSpec[] = [ shellNote: "No current read.", }, { - id: "antigravity:gemini", + id: "antigravity-direct.gemini", provider: "Antigravity", plan: "Gemini pool", heading: /^### Gemini/, @@ -555,7 +559,7 @@ export const POOL_SPECS: PoolSpec[] = [ shellNote: "No current read.", }, { - id: "antigravity:claude-gpt", + id: "antigravity-direct.claude-gpt", provider: "Antigravity", plan: "Claude+GPT pool", heading: /^### Gemini/, @@ -585,107 +589,38 @@ const SHELL_POOLS: QuotaPool[] = [ ]; /** - * Pools whose consuming opencode provider ("door") is NOT the pool-id - * prefix. Source of truth: `poolFor` in scripts/collect-fleet-feed.ts, - * which attributes sessions to pools by door provider — the Claude Pro - * pool is burned exclusively through the `claude-code` provider (there - * is no `anthropic` provider in the deployed config), so disabling - * `claude-code` must filter `anthropic:claude-pro`. Every other pool's - * door is its prefix. + * REMOVED 2026-11-03 (Drew: "the dashboard should not be doing any of + * that"): the #1114 disabled-door filter family — poolProviderId, + * poolProviderIds, poolFilteredByDisabled and the FILTER_EXEMPT_POOL_IDS + * exemption hack that had to be bolted on when the filter ate the + * meta pool — used to drop pools from the board whenever their + * OpenCode config door sat in disabled_providers. That hid live, + * measured pools whose traffic runs through model routes rather than + * the disabled direct door: at removal time the deployed board was + * missing anthropic:claude-pro, commandcode, deepseek and BOTH + * Antigravity pools even though the OpenCode quota read reported + * them. Pool assembly no longer consults disabled_providers at all; + * extractQuotaPools returns every pool it knows, and the serve-time + * overlay renders every pool the read reports (see + * overlayQuotaCurrent's unmapped-pool synthesis in quota-current.ts). */ -const POOL_DOOR_PROVIDER_ID: Record = { - "anthropic:claude-pro": "claude-code", -}; - -/** - * The opencode provider id whose disablement filters a pool: the pool's - * door provider. Since the 2026-11-03 config-name alignment the pool id - * IS the door provider id for every single-door pool ("openai", - * "meta", "cline-pass", "opendesign", "opencode-go.personal", ...); - * the one exception is "anthropic:claude-pro", whose door is - * "claude-code" (there is no `anthropic` provider in the config). - */ -export function poolProviderId(poolId: string): string { - return POOL_DOOR_PROVIDER_ID[poolId] ?? poolId.split(":")[0]; -} - -/** - * Pools consumed through SEVERAL door providers, none of which is the - * pool-id prefix: there is no `antigravity` provider in the deployed - * config — the two Antigravity pools are burned through the - * `antigravity-ls`, `antigravity-agy` and `google` providers (the same - * three doors `poolFor` in scripts/collect-fleet-feed.ts attributes to - * them). Such a pool is filtered only when EVERY door is disabled; one - * usable door remaining keeps it, because sessions can still burn it. - */ -const POOL_DOOR_PROVIDER_IDS: Record = { - "antigravity:gemini": ["antigravity-ls", "antigravity-agy", "google"], - "antigravity:claude-gpt": ["antigravity-ls", "antigravity-agy", "google"], -}; - -/** Every opencode provider id that can burn a pool (its doors). */ -export function poolProviderIds(poolId: string): string[] { - return POOL_DOOR_PROVIDER_IDS[poolId] ?? [poolProviderId(poolId)]; -} - -/** - * True when a pool must be filtered for the given disabled set: single- - * door pools when their door is disabled, multi-door pools only when - * every door is disabled. - */ -export function poolFilteredByDisabled(poolId: string, disabledProviderIds: ReadonlySet): boolean { - return poolProviderIds(poolId).every((id) => disabledProviderIds.has(id)); -} - -/** - * Pools that stay on the board even when every door provider is - * disabled — #1114's filter yields to this list. The filter exists so - * the board never presents a pool nobody can burn; an exempt pool IS - * burned (through the route layer, not the disabled direct door) and - * its quota is measured through OpenCode's credential machinery, so - * hiding it would leave a live pool unreported. Drew, 2026-11-03: - * meta and opendesign are standard report members and must show real - * quotas gathered by asking OpenCode. Today the list holds only - * meta: the deployed config disables the `meta` provider - * as a direct session door, which otherwise filtered the pool at - * assembly and left the board with no Meta row at all, while the - * gatherer's module read (serviceId meta) had no pool to - * land on. - */ -export const FILTER_EXEMPT_POOL_IDS: ReadonlySet = new Set(["meta"]); - -/** True when the disabled-door filter must not drop this pool. */ -export function poolFilterExempt(poolId: string): boolean { - return FILTER_EXEMPT_POOL_IDS.has(poolId); -} /** * Extract every pool's freshest dated read from the quota view text. * - * #1114: a pool whose provider id is in the deployed opencode config's - * disabled_providers set is filtered out HERE, at pool assembly — never - * at render time — so quota.json and the guidance derived from these - * pools can never name a disabled provider. Matching is exact provider-id - * equality against the pool's DOOR provider(s) (poolProviderIds): "openai" is - * not "openai-codex", "opendesign" is not "open-design", "opencode-go" is - * not "opencode" — "anthropic:claude-pro" answers to "claude-code", - * its only door, and the antigravity pools answer to antigravity-ls / - * antigravity-agy / google jointly (filtered only when all three are - * disabled). A filtered pool is - * reported through onFiltered (visibly noted, never silently dropped). + * PASS-THROUGH (Drew, 2026-11-03): every spec pool and shell pool is + * returned, unconditionally. The dated reads here are only the + * FAIL-SOFT FALLBACK for pools the live OpenCode quota read cannot + * currently measure (console-only pools, a read in error); the live + * read overlays them at serve time (overlayQuotaCurrent) and wins + * wherever it reports. No disabled_providers filter applies — a + * disabled direct door says nothing about whether the pool is burned + * through model routes or measured by OpenCode, and filtering on it + * is what made live pools vanish from the board (#1114, reversed). */ -export function extractQuotaPools( - quotaViewText: string, - now = new Date(), - disabledProviderIds: ReadonlySet = new Set(), - onFiltered?: (poolId: string, providerId: string) => void, -): QuotaPool[] { +export function extractQuotaPools(quotaViewText: string, now = new Date()): QuotaPool[] { const pools: QuotaPool[] = []; for (const spec of POOL_SPECS) { - if (!poolFilterExempt(spec.id) && poolFilteredByDisabled(spec.id, disabledProviderIds)) { - onFiltered?.(spec.id, poolProviderIds(spec.id).join(",")); - continue; - } const section = sectionOf(quotaViewText, spec.heading); let raw: Raw | null = null; try { @@ -720,10 +655,5 @@ export function extractQuotaPools( } pools.push(pool); } - const shells = SHELL_POOLS.filter((p) => { - if (poolFilterExempt(p.id) || !poolFilteredByDisabled(p.id, disabledProviderIds)) return true; - onFiltered?.(p.id, poolProviderIds(p.id).join(",")); - return false; - }); - return [...pools, ...shells.map((p) => ({ ...p }))]; + return [...pools, ...SHELL_POOLS.map((p) => ({ ...p }))]; } diff --git a/pm-stack/aggregator/src/quota-gather-map.ts b/pm-stack/aggregator/src/quota-gather-map.ts index 2855be5470..e5d7eb9363 100644 --- a/pm-stack/aggregator/src/quota-gather-map.ts +++ b/pm-stack/aggregator/src/quota-gather-map.ts @@ -75,6 +75,8 @@ export function serviceIdFor(providerId: string): string { return "openai"; case "cline-pass": return "cline-pass"; + case "command-code": + return "commandcode"; case "deepseek": return "deepseek"; case "meta": @@ -101,8 +103,8 @@ export const GATHERER_SOURCE = "openchamber-quota"; */ export const GO_DREWRYPOPE_SERVICE_ID = "opencode-go.drewrypope"; export const GO_POPESDREW_SERVICE_ID = "opencode-go.popesdrew"; -export const ANTIGRAVITY_GEMINI_SERVICE_ID = "antigravity:gemini"; -export const ANTIGRAVITY_CLAUDE_GPT_SERVICE_ID = "antigravity:claude-gpt"; +export const ANTIGRAVITY_GEMINI_SERVICE_ID = "antigravity-direct.gemini"; +export const ANTIGRAVITY_CLAUDE_GPT_SERVICE_ID = "antigravity-direct.claude-gpt"; /** * Which split Go pool a per-workspace entry belongs to, from the diff --git a/pm-stack/aggregator/src/sources/fixtures.ts b/pm-stack/aggregator/src/sources/fixtures.ts index b79a5703f7..84c8eeab72 100644 --- a/pm-stack/aggregator/src/sources/fixtures.ts +++ b/pm-stack/aggregator/src/sources/fixtures.ts @@ -366,7 +366,7 @@ export const FIXTURE_QUOTA: QuotaView = { activeSessions: [{ session: "ses_e8e4b5a44ffe0fnmHE0FmlGpkG", model: "deepseek-v4-pro", tokens: 3_400_000 }], }, { - id: "antigravity:gemini", + id: "antigravity-direct.gemini", provider: "Antigravity", plan: "Google Antigravity", note: "Antigravity has TWO independent pools: Gemini models, and the Claude models it supports.", @@ -376,7 +376,7 @@ export const FIXTURE_QUOTA: QuotaView = { ], }, { - id: "antigravity:claude", + id: "antigravity-direct.claude-gpt", provider: "Antigravity", plan: "Google Antigravity", note: "The Claude models Antigravity supports — a separate pool from its Gemini models.", @@ -437,8 +437,8 @@ export const FIXTURE_QUOTA: QuotaView = { }, ], choices: { - hasHeadroom: ["antigravity:claude", "antigravity:gemini", "meta:model-api", "openai:chatgpt"], - burnBeforeReset: ["antigravity:gemini", "antigravity:claude"], + hasHeadroom: ["antigravity-direct.claude-gpt", "antigravity-direct.gemini", "meta:model-api", "openai:chatgpt"], + burnBeforeReset: ["antigravity-direct.gemini", "antigravity-direct.claude-gpt"], doNotStart: ["anthropic:claude-subscription", "opencode-go.drewrypope"], }, }; diff --git a/pm-stack/aggregator/test/charges-catalog.test.ts b/pm-stack/aggregator/test/charges-catalog.test.ts index edbe445d9c..835a7fac20 100644 --- a/pm-stack/aggregator/test/charges-catalog.test.ts +++ b/pm-stack/aggregator/test/charges-catalog.test.ts @@ -25,9 +25,14 @@ describe("charge service catalog", () => { expect(result.unmatchedSaas.map((row) => row.merchant)).toContain("PADDLE MYSTERY"); }); - test("deduplicates providers and respects filtered pools", () => { - const catalog = chargeServiceCatalog([], extractQuotaPools("", new Date(), new Set(["claude-code"]))); + test("deduplicates providers; every rendered pool contributes its provider", () => { + // Pass-through (Drew, 2026-11-03): this was "respects filtered + // pools" under #1114 — it passed a disabled set containing + // claude-code and expected Anthropic gone from the catalog. Pool + // assembly no longer filters, so the catalog, derived from the + // rendered pools, includes Anthropic (as the first test expects). + const catalog = chargeServiceCatalog([], extractQuotaPools("")); expect(catalog.filter((entry) => entry.name === "OpenCode Go")).toHaveLength(1); - expect(catalog.some((entry) => entry.name === "Anthropic")).toBe(false); + expect(catalog.some((entry) => entry.name === "Anthropic")).toBe(true); }); }); diff --git a/pm-stack/aggregator/test/quota-current.test.ts b/pm-stack/aggregator/test/quota-current.test.ts index b9dba5eebb..bd3c88f55e 100644 --- a/pm-stack/aggregator/test/quota-current.test.ts +++ b/pm-stack/aggregator/test/quota-current.test.ts @@ -726,8 +726,8 @@ describe("overlay: split gatherer rows land on the four split hub pools (#1331)" view.pools.push( pool("opencode-go.drewrypope", []), pool("opencode-go.popesdrew", []), - pool("antigravity:gemini", []), - pool("antigravity:claude-gpt", []), + pool("antigravity-direct.gemini", []), + pool("antigravity-direct.claude-gpt", []), ); const out = overlayQuotaCurrent( view, @@ -748,12 +748,12 @@ describe("overlay: split gatherer rows land on the four split hub pools (#1331)" }), entry({ providerId: "antigravity", - serviceId: "antigravity:gemini", + serviceId: "antigravity-direct.gemini", windows: [win("weekly", 40, iso(5 * 60_000))], }), entry({ providerId: "antigravity", - serviceId: "antigravity:claude-gpt", + serviceId: "antigravity-direct.claude-gpt", windows: [win("weekly", 90, iso(5 * 60_000))], }), ]), @@ -762,9 +762,9 @@ describe("overlay: split gatherer rows land on the four split hub pools (#1331)" const byId = new Map(out.pools.map((p) => [p.id, p])); expect(byId.get("opencode-go.drewrypope")!.windows.map((w) => [w.name, w.percent])).toEqual([["monthly", 62.5]]); expect(byId.get("opencode-go.popesdrew")!.windows.map((w) => [w.name, w.percent])).toEqual([["monthly", 50]]); - expect(byId.get("antigravity:gemini")!.windows.map((w) => [w.name, w.percent])).toEqual([["weekly", 40]]); - expect(byId.get("antigravity:claude-gpt")!.windows.map((w) => [w.name, w.percent])).toEqual([["weekly", 90]]); - for (const id of ["opencode-go.drewrypope", "opencode-go.popesdrew", "antigravity:gemini", "antigravity:claude-gpt"]) { + expect(byId.get("antigravity-direct.gemini")!.windows.map((w) => [w.name, w.percent])).toEqual([["weekly", 40]]); + expect(byId.get("antigravity-direct.claude-gpt")!.windows.map((w) => [w.name, w.percent])).toEqual([["weekly", 90]]); + for (const id of ["opencode-go.drewrypope", "opencode-go.popesdrew", "antigravity-direct.gemini", "antigravity-direct.claude-gpt"]) { expect(byId.get(id)!.freshness).toEqual({ measuredAt: iso(5 * 60_000), source: "openchamber-quota", @@ -774,6 +774,87 @@ describe("overlay: split gatherer rows land on the four split hub pools (#1331)" }); }); +describe("overlay: pass-through of the read itself (Drew, 2026-11-03)", () => { + test("a fresh ok read clears the base pool's dated-prose note", () => { + const view = baseView(); + const meta = view.pools.find((p) => p.id === "meta")!; + meta.note = "BLOCKED 2026-10-26 — API returns 402 billing_not_configured (stale steward prose)."; + const out = overlayQuotaCurrent( + view, + file([entry({ serviceId: "meta", windows: [win("weekly", 98, iso(5 * 60_000))] })]), + NOW, + ); + const p = out.pools.find((x) => x.id === "meta")!; + expect(p.windows.map((w) => [w.name, w.percent])).toEqual([["weekly", 98]]); + expect(p.note).toBeUndefined(); + }); + + test("an error read keeps the dated note — it still describes the dated values on display", () => { + const view = baseView(); + const meta = view.pools.find((p) => p.id === "meta")!; + meta.note = "Dated read context."; + const out = overlayQuotaCurrent( + view, + file([entry({ serviceId: "meta", state: "error", error: "HTTP 402", windows: [] })]), + NOW, + ); + const p = out.pools.find((x) => x.id === "meta")!; + expect(p.state).toBe("error"); + expect(p.note).toBe("Dated read context."); + }); + + test("an entry with no matching pool synthesizes one under the reported id", () => { + const out = overlayQuotaCurrent( + baseView(), + file([ + entry({ + serviceId: "brand-new-pool", + providerId: "brand-new", + providerName: "Brand New", + planLabel: "Pro", + windows: [win("weekly", 42, iso(5 * 60_000))], + }), + ]), + NOW, + ); + const p = out.pools.find((x) => x.id === "brand-new-pool")!; + expect(p).toBeDefined(); + expect(p.provider).toBe("Brand New"); + expect(p.plan).toBe("Pro"); + expect(p.windows.map((w) => [w.name, w.percent])).toEqual([["weekly", 42]]); + expect(p.freshness).toEqual({ measuredAt: iso(5 * 60_000), source: "openchamber-quota", state: "ok" }); + }); + + test("an unmatched entry in error still renders — as an errored pool, not a vanished one", () => { + const out = overlayQuotaCurrent( + baseView(), + file([entry({ serviceId: "flaky-pool", state: "error", error: "HTTP 503", windows: [] })]), + NOW, + ); + const p = out.pools.find((x) => x.id === "flaky-pool")!; + expect(p).toBeDefined(); + expect(p.state).toBe("error"); + expect(p.freshness?.state).toBe("error"); + }); + + test("combined/non-pool rows never synthesize pools (turso, antigravity, opencode-go)", () => { + const out = overlayQuotaCurrent( + baseView(), + file([ + entry({ serviceId: "turso", windows: [win("databases", 3, iso(5 * 60_000))] }), + entry({ serviceId: "antigravity", windows: [win("weekly", 26, iso(5 * 60_000))] }), + entry({ serviceId: "opencode-go", windows: [win("monthly", 10, iso(5 * 60_000))] }), + ]), + NOW, + ); + const ids = out.pools.map((p) => p.id); + expect(ids).not.toContain("turso"); + expect(ids).not.toContain("antigravity"); + expect(ids).not.toContain("opencode-go"); + expect(out.pools).toHaveLength(baseView().pools.length); + }); +}); + describe("out-of-range pctOfLimit drops, never clamps (#2582)", () => { test("a fresh ok read at 150% does not wall the pool: the window drops and prior windows stand", () => { const out = overlayQuotaCurrent( diff --git a/pm-stack/aggregator/test/quota-gather-map.test.ts b/pm-stack/aggregator/test/quota-gather-map.test.ts index f3fbfce184..913cffd220 100644 --- a/pm-stack/aggregator/test/quota-gather-map.test.ts +++ b/pm-stack/aggregator/test/quota-gather-map.test.ts @@ -534,6 +534,11 @@ describe("serviceIdFor", () => { expect(serviceIdFor("deepseek")).toBe("deepseek"); expect(serviceIdFor("meta")).toBe("meta"); expect(serviceIdFor("opendesign")).toBe("opendesign"); + // The module's provider id is "command-code"; the pool (and the + // OpenCode config provider) is "commandcode". Without the mapping + // the read filed under a key no pool carries and never landed + // (the silent-mismatch family Drew ruled out, 2026-11-03). + expect(serviceIdFor("command-code")).toBe("commandcode"); expect(serviceIdFor("openai.alternate")).toBe("openai.alternate"); }); }); diff --git a/pm-stack/aggregator/test/quota.test.ts b/pm-stack/aggregator/test/quota.test.ts index ce6f059a8f..7d81efad7b 100644 --- a/pm-stack/aggregator/test/quota.test.ts +++ b/pm-stack/aggregator/test/quota.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from "bun:test"; import { poolState, windowPercent } from "../src/derive.ts"; import { disabledProvidersFromConfig } from "../src/aa.ts"; -import { extractQuotaPools, poolProviderId, poolProviderIds } from "../src/quota-extract.ts"; +import { extractQuotaPools } from "../src/quota-extract.ts"; import { computeChoices } from "../src/quota-guidance.ts"; // A synthetic quota view carrying the same dated-read phrasing the @@ -152,7 +152,6 @@ describe("quota extractors", () => { // the pool renders as a shell; the gatherer overlay supplies the // live windows (see quota-current.test.ts). expect(p.windows).toEqual([]); - expect(poolProviderId("openai.alternate")).toBe("openai.alternate"); }); test("meta is walled until the weekly reset — and it is the only Meta pool", () => { @@ -163,15 +162,22 @@ describe("quota extractors", () => { expect(pools.filter((x) => x.provider.includes("Meta")).length).toBe(1); }); - test("meta billing-blocked read walls the pool with a truthful note, even after the reset", () => { + test("meta billing-blocked prose no longer promotes into a wall (Drew, 2026-11-03)", () => { + // The extractMeta promotion branch is REMOVED by Drew's + // pass-through ruling: a dated billing_not_configured mention in + // steward prose once fabricated a walled 100% window + BLOCKED + // note that outranked the live read for days. This view carries + // no parseable dated % read, so the pool fail-softs to its shell; + // a real billing wall now arrives as the quota read's own error + // state through overlayQuotaCurrent (quota-current.test.ts). const blockedView = VIEW.replace( "weekly quota **46% used at 03:20 CDT**, then burned to empty by morning sessions and spilled to PAYG. **Weekly reset today 2026-10-25 19:00 CDT.**", "**Freshest dated read (2026-10-26, laptop meta-provider probes 14:30–14:42Z): API returns 402 billing_not_configured (billing-verification wall) on all 11 probes — pool BLOCKED, no usable quota.** Weekly reset was today 2026-10-25 19:00 CDT (that reset has since passed).", ); const p = extractQuotaPools(blockedView, new Date("2026-10-26T17:00:00Z")).find((x) => x.id === "meta")!; - expect(p.state).toBe("walled"); - expect(p.note).toContain("billing_not_configured"); - expect(p.note).toContain("2026-10-26"); + expect(p.state).toBe("healthy"); + expect(p.windows).toEqual([]); + expect(p.note).not.toContain("billing_not_configured"); expect(p.wallLiftsAt).toBeUndefined(); }); @@ -281,8 +287,8 @@ describe("quota extractors", () => { }); test("antigravity pools are independent, remaining -> used", () => { - expect(byId.get("antigravity:gemini")!.windows[0].percent).toBeCloseTo(0.9); - expect(byId.get("antigravity:claude-gpt")!.windows[0].percent).toBe(0); + expect(byId.get("antigravity-direct.gemini")!.windows[0].percent).toBeCloseTo(0.9); + expect(byId.get("antigravity-direct.claude-gpt")!.windows[0].percent).toBe(0); }); test("unreadable doc fails soft: identity + note, no invented numbers", () => { @@ -352,10 +358,14 @@ describe("windowPercent + guidance", () => { }); }); -describe("disabled_providers enforcement (#1114)", () => { - const KEEPERS = ["cloudflare-gateway", "cloudflare-workers-ai", "code-design", "design-code", "open-design"]; - - test("config parsing reuses the AA JSONC parse: comments tolerated, junk fails soft", () => { +describe("pass-through pool assembly (Drew, 2026-11-03)", () => { + // Drew's ruling — "the dashboard should not be doing any of that": + // the board is a straight display of the OpenCode quota read. The + // #1114 disabled_providers filter and its FILTER_EXEMPT hack are + // gone; extractQuotaPools takes no disabled set and returns every + // pool. disabledProvidersFromConfig survives in aa.ts for the AA + // section's own config parsing — only its quota use was removed. + test("config parsing still reuses the AA JSONC parse: comments tolerated, junk fails soft", () => { const cfg = `{ // deployed config shape "disabled_providers": ["openrouter", "github-copilot", 42, null], @@ -366,100 +376,49 @@ describe("disabled_providers enforcement (#1114)", () => { expect(disabledProvidersFromConfig("{}").size).toBe(0); }); - test("a disabled provider's pool is filtered at assembly and visibly noted; guidance never names it", () => { - const filtered: Array<[string, string]> = []; - const disabled = new Set(["openrouter", "github-copilot", "openai", "meta"]); - const pools = extractQuotaPools(VIEW, NOW, disabled, (poolId, providerId) => filtered.push([poolId, providerId])); - const ids = pools.map((p) => p.id); - expect(ids).not.toContain("openai"); - expect(filtered).toEqual([["openai", "openai"]]); - const choices = computeChoices(pools, NOW.getTime()); - const named = [...choices.hasHeadroom, ...choices.burnBeforeReset, ...choices.doNotStart]; - expect(named).not.toContain("openai"); - // The one exemption (Drew, 2026-11-03): meta is a - // standard report member whose quota is gathered by asking - // OpenCode; its disabled entry is the direct session door only, - // so the pool stays on the board — and in guidance — while - // every other named pool still answers to an enabled door. - expect(ids).toContain("meta"); - for (const id of named) { - if (id === "meta") continue; - expect(disabled.has(poolProviderId(id))).toBe(false); - } - }); - - test("the Claude pool's door is claude-code: disabling it filters anthropic:claude-pro", () => { - expect(poolProviderId("anthropic:claude-pro")).toBe("claude-code"); - const filtered: Array<[string, string]> = []; - const disabled = disabledProvidersFromConfig(JSON.stringify({ disabled_providers: ["claude-code"], provider: {} })); - const pools = extractQuotaPools(VIEW, NOW, disabled, (poolId, providerId) => filtered.push([poolId, providerId])); - expect(pools.map((p) => p.id)).not.toContain("anthropic:claude-pro"); - expect(filtered).toContainEqual(["anthropic:claude-pro", "claude-code"]); - const choices = computeChoices(pools, NOW.getTime()); - const named = [...choices.hasHeadroom, ...choices.burnBeforeReset, ...choices.doNotStart]; - expect(named).not.toContain("anthropic:claude-pro"); - }); - - test("the issue's fixture disabled set (openrouter/copilot) emits no pool for them", () => { - const disabled = disabledProvidersFromConfig( - JSON.stringify({ disabled_providers: ["openrouter", "github-copilot"], provider: {} }), - ); - const pools = extractQuotaPools(VIEW, NOW, disabled); - for (const p of pools) { - expect(poolProviderId(p.id)).not.toBe("openrouter"); - expect(poolProviderId(p.id)).not.toBe("github-copilot"); - } + test("every pool renders, in spec order — disabled doors drop nothing", () => { + // The deployed config disables claude-code, commandcode, deepseek, + // meta, antigravity-ls and antigravity-agy (among others). Under + // #1114 the board lost anthropic:claude-pro, commandcode, deepseek + // and BOTH Antigravity pools, and meta survived only through an + // exemption hack — while the OpenCode quota read reported all of + // them. All twelve pools now render unconditionally; the dated + // reads are the live read's fail-soft fallback, nothing more. + expect(extractQuotaPools(VIEW, NOW).map((p) => p.id)).toEqual([ + "meta", + "anthropic:claude-pro", + "openai", + "openai.alternate", + "opencode-go.drewrypope", + "opencode-go.popesdrew", + "cline-pass", + "commandcode", + "antigravity-direct.gemini", + "antigravity-direct.claude-gpt", + "opendesign", + "deepseek", + ]); }); - test("keeper set can never appear in pools or guidance choices", () => { - const pools = extractQuotaPools(VIEW, NOW, new Set(KEEPERS)); + test("keeper design doors never had pools and still do not", () => { + const KEEPERS = ["cloudflare-gateway", "cloudflare-workers-ai", "code-design", "design-code", "open-design"]; + const pools = extractQuotaPools(VIEW, NOW); const choices = computeChoices(pools, NOW.getTime()); const named = [...choices.hasHeadroom, ...choices.burnBeforeReset, ...choices.doNotStart]; for (const keeper of KEEPERS) { - expect(pools.map((p) => poolProviderId(p.id))).not.toContain(keeper); - expect(named.map((id) => poolProviderId(id))).not.toContain(keeper); + expect(pools.map((p) => p.id)).not.toContain(keeper); expect(named).not.toContain(keeper); } }); - test("antigravity pools answer to antigravity-ls/antigravity-agy/google jointly: filtered only when every door is disabled", () => { - // There is no "antigravity" provider: poolFor attributes the two - // antigravity pools to these three doors (Codex P2 on PR #2377). - for (const id of ["antigravity:gemini", "antigravity:claude-gpt"]) { - expect(poolProviderIds(id)).toEqual(["antigravity-ls", "antigravity-agy", "google"]); + test("the issue's fixture disabled set (openrouter/copilot) still emits no pool for them", () => { + // No pool ever answered to those providers; with the filter gone + // the guarantee is structural (POOL_SPECS has no such pool), not + // a runtime check. + const pools = extractQuotaPools(VIEW, NOW); + for (const p of pools) { + expect(p.id).not.toBe("openrouter"); + expect(p.id).not.toBe("github-copilot"); } - // One usable door remaining (the deployed set disables google alone) - // keeps both pools. - const partial = extractQuotaPools(VIEW, NOW, new Set(["antigravity-ls", "antigravity-agy"])).map((p) => p.id); - expect(partial).toContain("antigravity:gemini"); - expect(partial).toContain("antigravity:claude-gpt"); - const deployedLike = extractQuotaPools(VIEW, NOW, new Set(["google"])).map((p) => p.id); - expect(deployedLike).toContain("antigravity:gemini"); - expect(deployedLike).toContain("antigravity:claude-gpt"); - // Every door disabled: both pools filtered at assembly, visibly - // noted, and guidance never names them. - const filtered: Array<[string, string]> = []; - const disabled = new Set(["antigravity-ls", "antigravity-agy", "google"]); - const pools = extractQuotaPools(VIEW, NOW, disabled, (poolId, providerId) => filtered.push([poolId, providerId])); - const ids = pools.map((p) => p.id); - expect(ids).not.toContain("antigravity:gemini"); - expect(ids).not.toContain("antigravity:claude-gpt"); - expect(filtered).toContainEqual(["antigravity:gemini", "antigravity-ls,antigravity-agy,google"]); - expect(filtered).toContainEqual(["antigravity:claude-gpt", "antigravity-ls,antigravity-agy,google"]); - const choices = computeChoices(pools, NOW.getTime()); - const named = [...choices.hasHeadroom, ...choices.burnBeforeReset, ...choices.doNotStart]; - expect(named).not.toContain("antigravity:gemini"); - expect(named).not.toContain("antigravity:claude-gpt"); - }); - - test("exact-match only: near-miss disabled ids do not filter lookalike pools", () => { - // The deployed disabled set contains openai-codex/chatgpt (not openai), - // open-design (not opendesign) and opencode (not opencode-go). - const disabled = new Set(["openai-codex", "chatgpt", "open-design", "opencode"]); - const ids = extractQuotaPools(VIEW, NOW, disabled).map((p) => p.id); - expect(ids).toContain("openai"); - expect(ids).toContain("opendesign"); - expect(ids).toContain("opencode-go.drewrypope"); - expect(ids).toContain("opencode-go.popesdrew"); }); });