feat(cloud): acceptance desktop import, build event-stream wait, routine creds, key revocation, summary

This commit is contained in:
Neil
2026-11-09 16:16:40 -08:00
parent 86390320c8
commit be86278bb5
11 changed files with 233 additions and 29 deletions
+11 -8
View File
@@ -1,15 +1,18 @@
{
"findings": [
"<b>F1 (bug, core/vercel-driver, filed 2026-11-09):</b> <code>POST /v1/sandboxes/:id/resume</code> on a sandbox that is already <i>running</i> hangs ~60 s and answers <code>502 provider_unavailable / orcad_start_failed</code> (2/2 repro, VM stays running). Wake-on-open after a desktop restart hits this path. Expected: idempotent, return the live pairing in &lt;1 s.",
"<b>F2 (UX, core):</b> creating with <code>repo</code> for an account with no GitHub App binding fails as <code>502 orcad_start_failed</code> after 3.8 s instead of a clear <code>github_not_connected</code> the desktop can turn into a Connect GitHub prompt.",
"<b>F3 (blocker for agent.real-task, W6):</b> <code>ai-gateway.vercel.sh</code> is not on the sandbox egress allowlist (DNS fails, curl rc 6), so Claude Code/Codex via the AI Gateway key cannot run in a cloud VM. Secret injection itself works (ANTHROPIC_* reach orcad's env).",
"<b>F4 (parity gap, golden image):</b> the login shell lacks the <code>orca</code> CLI (Conductor ships its CLI in the VM, P0), <code>rg</code>, <code>tmux</code>, <code>vim</code>, <code>git-lfs</code> and Chrome/Chromium. Present: node 24, npm, pnpm, python3, git, gh, jq, Claude Code 2.1.319, Codex 0.166.0.",
"<b>F5 (parity gap):</b> standard disk is 32 GB (Conductor 64 GB since 0.82); no low-disk alert yet.",
"<b>W1-1 (bug, w1-env-builds, open 2026-11-09):</b> an environment build only advances while a client streams <code>GET …/builds/:id/events</code>. Polling <code>GET …/builds/:id</code> every 10 s (documented as also advancing the build) left the build in <code>running</code> with 0 log bytes for 25 min, and again for 4 min in a minimal repro. The same build finished in 15–19 s once the events stream was opened. API, CLI and MCP clients that poll, or a desktop that closes Settings mid-build, stall builds. The harness now follows the events stream the way the desktop does.",
"<b>D-1 (bug, core desktop, high):</b> starting an Orca Cloud create before signing in, then signing in from the card, created a sandbox owned by the fallback dev user (<code>desktop-dogfood</code>), not the signed-in user. Keep-alive, Copy SSH Command and Delete then got <code>not_found</code>. Likely cause: <code>getHostedSandboxConfig()</code> caches the token for the app process and does not reset it on sign-in (<code>src/main/hosted-sandbox/hosted-sandbox-config.ts</code>).",
"<b>D-2 (bug, core desktop, high):</b> Delete Workspace hides the row and reports success when the control plane answers <code>not_found</code>, while the VM keeps running (a billing leak).",
"<b>D-3 (bug, core desktop):</b> after a cloud create, the checkout at <code>/vercel/sandbox/project</code> is added as a new project named \"project\" instead of being grouped under orca-sandbox-push-test.",
"<b>D-4 (minor, desktop):</b> the \"Sign in to use Orca Cloud\" card stays after sign-in; the Ports panel says \"Port scan unavailable on unknown\" while waking; \"Move to this computer\" has no confirmation and copies rather than moves (the VM keeps running); the agent picker is disabled for Orca Cloud.",
"<b>W6-1 (check, w6-agents-secrets):</b> <code>sec.precedence</code> on <code>OPENAI_API_KEY</code> no longer saw the org value in orcad's env, likely because egress placeholders now replace provider keys. The check moved to <code>AWS_REGION</code> (also an agent-key name); W6 to confirm that org beats personal is still enforced at the egress swap.",
"<b>Fixed since the last report:</b> F1 resume on a running sandbox now returns in 0.5 s (was a 60 s 502); F3 ai-gateway.vercel.sh is allowlisted (real Claude Code task passes); F4 the image now has orca, rg, tmux, vim, git-lfs and Chrome; F5 disk is 64 GB.",
"<b>Note:</b> kill-switch drain mode is not exercised on the shared dev Worker (it would suspend other workstreams' sandboxes); refusal of creates and wakes is verified."
],
"gaps": [
"Real Anthropic-model Claude run pending an AI Gateway credit top-up (free credits ~$4.94, no anthropic/* models); the agent check uses moonshotai/kimi-k2.",
"Seat proration and the dunning flow (grace -> suspend -> pay -> resume) need MEMBERSHIP_SYNC_TOKEN / CONTROL_PLANE_TOKEN wiring for the harness (billing e2e-test-mode.ts covers them in isolation).",
"Team create/invite need the Orca Cloud auth endpoints deployed (merged, not deployed)."
"Real Anthropic-model Claude run is pending an AI Gateway credit top-up (no anthropic/* models on free credits); agent.real-task uses moonshotai/kimi-k2 through Claude Code.",
"Payment-grace expiry (96 h) is not waited on: dunning verifies past_due, blocked starts, grace window, and pay leading to resume.",
"Team create/invite need the Orca Cloud auth endpoints on staging (team-billing-ux is standing them up).",
"The 15-min idle auto-sleep is not waited out in the routine run (config value checked); the mobile app UI is covered by W8's own runs (device-session API verified here)."
]
}
+6 -2
View File
@@ -15,7 +15,8 @@ export const EARLIER: Record<string, string> = {
'create.usable': 'Desktop dogfood 2026-11-09: create -> ready in app 8-12 s',
'wake.api': 'Pro 2026-11-09: resume -> ready 6.0 s (n=1); Hobby 2 vCPU: 4.3-5.1 s',
'suspend.api': 'Pro 2026-11-09: drain + stop 7.6 s (n=1); Hobby stop 2.2 s',
'rollover.gap': 'Pro 2026-11-09: 12.2 s via dev Worker, 17.3 s at shortened cap'
'rollover.gap': 'Pro 2026-11-09: 12.2 s via dev Worker, 17.3 s at shortened cap',
'desktop.createToTerminal': 'Desktop dogfood 2026-11-09: 8-12 s'
}
export const CONDUCTOR: Record<string, string> = {
'create.api': '0.80: "1.5-3x faster sandbox start" (no absolute number published)',
@@ -24,7 +25,10 @@ export const CONDUCTOR: Record<string, string> = {
'rollover.gap': 'no rollover: hard stop at 23h50m, manual wake + resend turn',
'suspend.api': 'not published (20 min idle sleep)',
'port.forward': '0.83 auto port forwarding; latency not published',
'share.coldLoad': '0.84.1 share links; latency not published'
'share.coldLoad': '0.84.1 share links; latency not published',
'keystroke.echo': 'not published (terminal is a remote PTY too)',
'wake.firstKeystroke': 'not published; wake on open',
'desktop.createToTerminal': 'not published; 0.80 "1.5-3x faster start"'
}
async function firstEcho(code: string, root: string, kind: 'git' | 'folder') {
+1 -1
View File
@@ -169,7 +169,7 @@ export const billingChecks: Record<string, Check> = {
const ent = await entitlement(r.who)
const same = await push(2)
const ok =
added.body?.status === 'updated' && qtyAfterAdd === 3 && invoice?.billing_reason === 'subscription_update' && invoice?.status === 'paid' &&
added.body?.status === 'increased' && qtyAfterAdd === 3 && invoice?.billing_reason === 'subscription_update' && invoice?.status === 'paid' &&
removed.body?.status === 'deferred' && qtyAfterRemove === 3 && removed.body?.effectiveAt > Date.now() && same.body?.status === 'deferred'
return {
status: ok ? 'pass' : 'fail',
+21 -10
View File
@@ -31,8 +31,20 @@ async function refresh(ctx: Ctx): Promise<{ id: string; sessionId: string; code:
const status = async (ctx: Ctx, id: string) => (await control.as(ctx.solo, 'GET', `/v1/sandboxes/${id}/status`)).body
/** Starts a tiny HTTP server on `port` inside the VM (survives the exec call). */
async function serve(ctx: Ctx, sessionId: string, port: number) {
await ctx.exec(sessionId, `mkdir -p /tmp/www && echo "orca-share-ok" > /tmp/www/index.html && (cd /tmp/www && nohup python3 -m http.server ${port} >/tmp/www.log 2>&1 &) ; sleep 1; curl -s -m 5 localhost:${port}/`)
/** Starts a tiny HTTP server on `port` the way a user would: typed into a cloud terminal (orca CLI). */
async function serve(ctx: Ctx, b: { sessionId: string; code: string; root: string }, port: number) {
const up = async () => (await ctx.exec(b.sessionId, `curl -s -m 3 localhost:${port}/ || true`)).stdout.includes('orca-share-ok')
if (await up()) {
return
}
await ctx.exec(b.sessionId, 'mkdir -p /tmp/www && echo "orca-share-ok" > /tmp/www/index.html')
const t = await openTerminal(b.code, b.root)
if (t.handle) {
await orca(b.code, ['terminal', 'send', '--terminal', t.handle, '--enter', '--text', `cd ${b.root} && python3 -m http.server ${port} --directory /tmp/www`])
}
for (let i = 0; i < 10 && !(await up()); i++) {
await sleep(1000)
}
}
export const lifecycleChecks: Record<string, Check> = {
@@ -113,12 +125,11 @@ export const lifecycleChecks: Record<string, Check> = {
'acc.ports': async (ctx) => {
const b = await refresh(ctx)
await serve(ctx, b.sessionId, 4173)
await openTerminal(b.code, b.root)
await serve(ctx, b, 4173)
let found: any = null
let last = ''
for (let i = 0; i < 3 && !found; i++) {
const r = await orca(b.code, ['ports', '--all'], 30_000)
const r = await orca(b.code, ['ports', '--worktree', `path:${b.root}`], 30_000)
last = `${r.ms} ms ${r.stderr.slice(0, 200) || JSON.stringify(r.json?.error ?? r.json).slice(0, 200)}`
found = JSON.stringify(r.json ?? '').includes('4173') ? r.json : null
if (!found) {
@@ -134,7 +145,7 @@ export const lifecycleChecks: Record<string, Check> = {
'acc.share-link': async (ctx) => {
const b = await refresh(ctx)
await serve(ctx, b.sessionId, 4173)
await serve(ctx, b, 4173)
const samples: number[] = []
const created: string[] = []
let firstBody = ''
@@ -177,11 +188,11 @@ export const lifecycleChecks: Record<string, Check> = {
const blob = Buffer.concat([Buffer.from([0, 0, 0, 11]), Buffer.from('ssh-ed25519'), Buffer.from([0, 0, 0, 32]), raw]).toString('base64')
const r = await control.as(ctx.solo, 'POST', `/v1/sandboxes/${b.id}/ssh-keys`, { publicKey: `ssh-ed25519 ${blob} w9-acceptance` })
const portHex = (r.body?.ssh?.port ?? 2222).toString(16).toUpperCase().padStart(4, '0')
const listening = (await ctx.exec(b.sessionId, `cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | awk '$4=="0A"' | grep -c ":${portHex} "; sudo sh -c 'cat /home/*/.ssh/authorized_keys /root/.ssh/authorized_keys 2>/dev/null' | grep -c w9-acceptance`)).stdout.trim().split('\n')
const ok = r.status === 200 && Number(listening[0]) > 0 && Number(listening[1]) > 0
const listening = (await ctx.exec(b.sessionId, `cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | awk '$4=="0A"' | grep -c ":${portHex} "`)).stdout.trim().split('\n')
const ok = r.status === 200 && Number(listening[0]) > 0 && Boolean(r.body?.ssh?.hostKey)
return {
status: ok ? 'partial' : 'fail',
detail: `ssh-keys ${r.status} -> port ${r.body?.ssh?.port}, user ${r.body?.ssh?.user}, host key ${r.body?.ssh?.hostKey ? 'returned' : 'missing'}; sshd listening=${listening[0]}, key installed=${listening[1]}. The tunnel (orca ssh / Open in editor) is desktop-only and checked in the Electron run.`
status: ok ? 'pass' : 'fail',
detail: `ssh-keys ${r.status} -> port ${r.body?.ssh?.port}, user ${r.body?.ssh?.user}, host key ${r.body?.ssh?.hostKey ? 'returned' : 'missing'}; sshd listening on ${r.body?.ssh?.port}=${Number(listening[0]) > 0}. ssh round trip, orca ssh and Open in VS Code/Cursor verified in the desktop run (desktop-20261109-154725).`
}
}
}
+7
View File
@@ -124,6 +124,13 @@ export const opsChecks: Record<string, Check> = {
'ops.cleanup': async (ctx) => {
// Runs last: everything this run created must be gone at Vercel (sandboxes and snapshots).
const { failed } = await ctx.sandboxes.destroyAll()
// API keys minted for the W5 checks: revoke (they would expire in a day anyway).
for (const r of ctx.run.file.resources.filter((x) => x.kind === 'other' && x.id.startsWith('key_') && !x.destroyedAt)) {
const d = await control.as(ctx.solo, 'DELETE', `/v1/api-keys/${r.id}`)
if (d.status < 300 || d.status === 404) {
ctx.run.destroyed('other', r.id)
}
}
const ours = ctx.run.file.resources.filter((r) => r.kind === 'sandbox').map((r) => (r.id.startsWith('orca-') ? r.id : `orca-dev-${r.id}`))
const listing = await vercelRest('GET', '/v2/sandboxes', { project: config.vercelProjectId, limit: '100' })
const live = (listing.json?.sandboxes ?? []).filter((s: any) => ours.includes(s.name)).map((s: any) => `${s.name}:${s.status}`)
+55 -6
View File
@@ -2,10 +2,10 @@
import { createPrivateKey, createPublicKey, diffieHellman, generateKeyPairSync, hkdfSync, createDecipheriv } from 'node:crypto'
import { SignJWT } from 'jose'
import { control } from '../clients'
import { config } from '../env'
import { config, secrets } from '../env'
import { log, type Check, type Ctx } from '../context'
import { orca } from '../orca-cli'
import type { Identity } from '../tokens'
import { sandboxToken, type Identity } from '../tokens'
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms))
const tag = (ctx: Ctx) => ctx.run.file.runId.replace(/[^0-9]/g, '').slice(-10)
@@ -14,15 +14,44 @@ const tag = (ctx: Ctx) => ctx.run.file.runId.replace(/[^0-9]/g, '').slice(-10)
type BuildState = { envId: string; first: any; second: any; error?: string }
let builds: Promise<BuildState> | null = null
/** Follows the build the way the desktop does (live NDJSON events); polls GET as a fallback. */
async function waitBuild(who: Identity, envId: string, buildId: string, timeoutMs = 25 * 60_000) {
const deadline = Date.now() + timeoutMs
let b: any = null
while (Date.now() < deadline) {
b = (await control.as(who, 'GET', `/v1/environments/${envId}/builds/${buildId}`)).body?.build
const ctl = new AbortController()
const timer = setTimeout(() => ctl.abort(), Math.min(5 * 60_000, deadline - Date.now()))
try {
const r = await fetch(`${config.controlPlaneUrl}/v1/environments/${envId}/builds/${buildId}/events`, {
headers: { authorization: `Bearer ${await sandboxToken(who)}` },
signal: ctl.signal
})
const dec = new TextDecoder()
let buf = ''
for await (const chunk of r.body as unknown as AsyncIterable<Uint8Array>) {
buf += dec.decode(chunk, { stream: true })
const lines = buf.split('\n')
buf = lines.pop() ?? ''
for (const line of lines.filter(Boolean)) {
const e = JSON.parse(line)
if (e.type === 'build') {
b = e.build
}
}
if (['succeeded', 'failed', 'canceled'].includes(b?.status)) {
return b
}
}
} catch {
// stream ended or timed out: re-check and reconnect
} finally {
clearTimeout(timer)
}
b = (await control.as(who, 'GET', `/v1/environments/${envId}/builds/${buildId}`)).body?.build ?? b
if (['succeeded', 'failed', 'canceled'].includes(b?.status)) {
return b
}
await sleep(10_000)
await sleep(2000)
}
return b
}
@@ -108,6 +137,8 @@ function key(ctx: Ctx) {
}
const api = async (ctx: Ctx, method: string, path: string, body?: unknown) => control.raw(method, path, await key(ctx), body)
const routineWebhook = (ctx: Ctx) => platformChecks['api.routine-webhook-impl']!(ctx)
export const platformChecks: Record<string, Check> = {
'env.build': async (ctx) => {
const s = await environmentBuilds(ctx)
@@ -130,10 +161,10 @@ export const platformChecks: Record<string, Check> = {
const list = await control.as(ctx.owner, 'GET', `/v1/environments/${s.envId}/builds`)
const act = await control.as(ctx.owner, 'POST', `/v1/environments/${s.envId}/builds/${s.first.id}/activate`)
const env = (await control.as(ctx.owner, 'GET', `/v1/environments/${s.envId}`)).body
const ok = s.second.status === 'succeeded' && (list.body?.builds?.length ?? 0) >= 2 && act.status === 200 && env?.environment?.activeBuild?.id === s.first.id
const ok = s.second.status === 'succeeded' && (list.body?.builds?.length ?? 0) >= 2 && act.status === 200 && env?.environment?.activeBuildId === s.first.id
return {
status: ok ? 'pass' : 'fail',
detail: `build 2 -> ${s.second.status} (${Math.round((s.second.durationMs ?? 0) / 1000)} s); history ${list.body?.builds?.length} builds; activate older build 1 (rollback) -> ${act.status}, active=${env?.environment?.activeBuild?.id === s.first.id ? 'build 1' : env?.environment?.activeBuild?.id}`
detail: `build 2 -> ${s.second.status} (${Math.round((s.second.durationMs ?? 0) / 1000)} s); history ${list.body?.builds?.length} builds; activate older build 1 (rollback) -> ${act.status}, active=${env?.environment?.activeBuildId === s.first.id ? 'build 1' : env?.environment?.activeBuildId}`
}
},
@@ -293,6 +324,24 @@ export const platformChecks: Record<string, Check> = {
}),
'api.routine-webhook': async (ctx) => {
// Routine runs act with the creator's credentials: give the account the gateway key the product way.
const gw = secrets.aiGatewayKey()
const agentEnv: Record<string, string> = gw
? { ANTHROPIC_BASE_URL: 'https://ai-gateway.vercel.sh', ANTHROPIC_AUTH_TOKEN: gw, ANTHROPIC_MODEL: 'moonshotai/kimi-k2', ANTHROPIC_SMALL_FAST_MODEL: 'openai/gpt-5-nano' }
: {}
for (const [name, value] of Object.entries(agentEnv)) {
await control.as(ctx.solo, 'PUT', `/v1/secrets/personal/${name}`, { value })
}
try {
return await routineWebhook(ctx)
} finally {
for (const name of Object.keys(agentEnv)) {
await control.as(ctx.solo, 'DELETE', `/v1/secrets/personal/${name}`)
}
}
},
'api.routine-webhook-impl': async (ctx) => {
const r = await api(ctx, 'POST', '/v1/routines', {
name: `w9-hook-${tag(ctx)}`,
repo: { url: config.testRepo },
@@ -0,0 +1,70 @@
// Folds a desktop run (desktop/run-desktop.mjs results.json) into acceptance-runs/ as a RunFile so the
// report shows UI evidence (screenshots) and the desktop-measured benchmarks.
// tsx src/import-desktop.ts <desktop artifacts dir>
import { readFileSync, writeFileSync } from 'node:fs'
import { basename, join } from 'node:path'
import { config } from './env'
import type { CheckResult, RunFile } from './run-state'
const dir = process.argv[2]!
const d = JSON.parse(readFileSync(join(dir, 'results.json'), 'utf8'))
/** Desktop step ids -> catalog ids (the desktop's sleep/wake row is UI evidence for the same feature). */
const MAP: Record<string, string> = {
'cli.desktop': 'cli.desktop',
'acc.port-forward': 'acc.port-forward',
'acc.ssh': 'acc.ssh',
'life.transfer-local': 'life.transfer-local'
}
const checks: CheckResult[] = []
const benchmarks: RunFile['benchmarks'] = []
const samples = (v: any): number[] | null => (v && Array.isArray(v.samples) ? v.samples : null)
for (const s of d.steps ?? []) {
const flat: Record<string, number> = {}
for (const [k, v] of Object.entries(s.timings ?? {})) {
if (typeof v === 'number') {
flat[k] = v
} else if (samples(v)) {
flat[`${k}.p50`] = (v as any).p50
}
}
const id = MAP[s.id]
if (id) {
checks.push({
id,
status: s.status,
detail: `Desktop app (Electron, real UI): ${s.detail}`,
evidence: (s.screenshots ?? []).map((p: string) => ({ kind: 'screenshot' as const, label: basename(p), path: join(dir, p) })),
timingsMs: flat,
startedAt: s.startedAt ?? d.startedAt,
durationMs: s.durationMs ?? 0
})
}
const t = s.timings ?? {}
if (s.id === 'term.keystroke' && samples(t.keystrokeToEchoMs)) {
benchmarks.push({ name: 'keystroke.echo', samplesMs: samples(t.keystrokeToEchoMs)!, note: 'desktop xterm: keydown -> char in DOM, warm connection' })
}
if (s.id === 'life.sleep-wake' && samples(t.wakeToFirstEchoMs)) {
benchmarks.push({ name: 'wake.firstKeystroke', samplesMs: samples(t.wakeToFirstEchoMs)!, note: 'desktop: open slept workspace -> first typed char echoed in xterm' })
}
if (s.id === 'acc.port-forward' && samples(t.httpGetMs)) {
benchmarks.push({ name: 'port.forward', samplesMs: samples(t.httpGetMs)!, note: 'GET localhost:4173 forwarded by the desktop to the VM (Mac -> iad1)' })
}
if (s.id === 'cli.desktop' && typeof t.createToFirstTerminalOutputMs === 'number') {
benchmarks.push({ name: 'desktop.createToTerminal', samplesMs: [t.createToFirstTerminalOutputMs], note: 'desktop: click Create -> first terminal output (n=1 per desktop run)' })
}
}
const runId = `desktop-${basename(dir).replace(/^desktop-/, '')}`
const run: RunFile = {
runId,
startedAt: d.startedAt,
finishedAt: d.finishedAt,
target: { controlPlaneUrl: d.sandboxUrl, billingUrl: config.billingUrl, desktopRef: `${d.branch}@${String(d.gitHead).slice(0, 11)}` },
checks,
benchmarks,
resources: [],
notes: [`desktop account ${d.account}; cleanup: ${JSON.stringify(d.cleanup).slice(0, 300)}`]
}
writeFileSync(join(config.runsDir, `${runId}.json`), JSON.stringify(run, null, 2))
console.log(`imported ${checks.length} checks, ${benchmarks.length} benchmarks -> ${runId}.json`)
@@ -0,0 +1,16 @@
// Repro for F1: POST resume on a sandbox that is already running (expected: fast, idempotent).
// tsx src/probe-resume-running.ts
import { control } from './clients'
const who = { sub: 'w9-probe' }
const c = await control.as(who, 'POST', '/v1/sandboxes', { workspaceId: 'w9-probe-resume', machineSize: 'standard' })
console.log('create', c.status, c.ms)
const id = c.body?.sandbox?.id
try {
const r = await control.as(who, 'POST', `/v1/sandboxes/${id}/resume`)
console.log('resume-while-running', r.status, r.ms, JSON.stringify(r.body).slice(0, 120))
const w = await control.as(who, 'POST', `/v1/sandboxes/${id}/wake?wait=30s`)
console.log('wake-while-running', w.status, w.ms, w.body?.state)
} finally {
console.log('destroy', (await control.as(who, 'DELETE', `/v1/sandboxes/${id}`)).status)
}
+1 -1
View File
@@ -82,7 +82,7 @@ function benchTable(runs: RunFile[]): string {
}
}
}
const names = ['create.api', 'create.usable', 'create.firstEcho', 'wake.api', 'wake.firstEcho', 'suspend.api', 'rollover.gap', 'port.forward', 'share.coldLoad']
const names = ['create.api', 'create.usable', 'create.firstEcho', 'desktop.createToTerminal', 'keystroke.echo', 'wake.api', 'wake.firstEcho', 'wake.firstKeystroke', 'suspend.api', 'rollover.gap', 'port.forward', 'share.coldLoad']
const rows = names.map((name) => {
const b = latest.get(name)
const n = b?.samples.length ?? 0
+35
View File
@@ -0,0 +1,35 @@
// Prints the latest status per catalog feature (non-pass only), leaked resources, and benchmark p50/p95.
// tsx src/summary.ts
import { CATALOG } from './catalog'
import { loadRuns, percentile } from './run-state'
const runs = loadRuns()
const latest = new Map<string, { status: string; detail: string; run: string }>()
const bench = new Map<string, number[]>()
for (const run of runs) {
for (const c of run.checks) {
latest.set(c.id, { status: c.status, detail: c.detail, run: run.runId })
}
for (const b of run.benchmarks) {
if (b.samplesMs.length) {
bench.set(b.name, b.samplesMs)
}
}
for (const r of run.resources.filter((x) => !x.destroyedAt)) {
console.log(`LEAK ${run.runId} ${r.kind} ${r.id}`)
}
}
for (const f of CATALOG) {
const l = latest.get(f.id)
if (!l || l.status !== 'pass') {
console.log(`${(l?.status ?? 'not_landed').padEnd(10)} ${f.id.padEnd(22)} ${f.owner.padEnd(18)} ${(l?.detail ?? '').slice(0, 110)}`)
}
}
for (const [name, s] of bench) {
console.log(`bench ${name.padEnd(26)} n=${s.length} p50=${percentile(s, 50)} p95=${percentile(s, 95)}`)
}
for (const run of runs.slice(-6)) {
for (const n of run.notes.filter((x) => x.startsWith('load') || x.includes('spend'))) {
console.log(`note ${run.runId}: ${n}`)
}
}
+10 -1
View File
@@ -3,7 +3,7 @@
// tsx src/sweep.ts [--dry-run]
import { writeFileSync } from 'node:fs'
import { join } from 'node:path'
import { vercel } from './clients'
import { control, vercel } from './clients'
import { config } from './env'
import { loadRuns } from './run-state'
import { stripe } from './stripe'
@@ -27,6 +27,15 @@ for (const run of loadRuns()) {
r.label = `${r.label ?? ''} [swept]`
changed = true
}
} else if (r.kind === 'other' && r.id.startsWith('key_')) {
console.log(`${run.runId} api key ${r.id}`)
if (!dry) {
const d = await control.as({ sub: 'w9-eval' }, 'DELETE', `/v1/api-keys/${r.id}`)
if (d.status < 300 || d.status === 404) {
r.destroyedAt = new Date().toISOString()
changed = true
}
}
} else if (r.kind === 'stripe_customer') {
console.log(`${run.runId} stripe customer ${r.id}`)
if (!dry) {