From f9a95bc7ec3743c67167ea0d6923a7807f0014f2 Mon Sep 17 00:00:00 2001 From: Sylvain Utard Date: Sun, 8 Nov 2026 09:51:52 +0100 Subject: [PATCH 1/3] feat(query): add `query top` to monitor running queries List running queries with their details fetched in parallel: start time, elapsed time, progress, processed and estimated rows, compute size, worker, memory, disk, and client. `--sort` orders by elapsed|progress|rows|memory|disk; `--watch` (`-w`) redraws on the alternate screen every `--interval` seconds until Ctrl+C. The redraw loop lives in a reusable `ui/terminal/live-view.ts`, and table columns gain an optional `minWidth` so live views do not shift. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + COMMANDS.md | 31 +- DEVELOPMENT.md | 2 +- README.md | 1 + cli-reference.json | 65 +++- cli/AGENTS.md | 2 +- cli/scripts/command-reference.test.ts | 2 +- cli/src/commands/query/index.ts | 3 + cli/src/commands/query/lib/top.test.ts | 350 +++++++++++++++++++++ cli/src/commands/query/lib/top.ts | 403 +++++++++++++++++++++++++ cli/src/commands/query/top.test.ts | 100 ++++++ cli/src/commands/query/top.ts | 92 ++++++ cli/src/lib/usage.test.ts | 5 +- cli/src/ui/document.ts | 2 + cli/src/ui/terminal/live-view.test.ts | 70 +++++ cli/src/ui/terminal/live-view.ts | 81 +++++ cli/src/ui/terminal/table.test.ts | 11 + cli/src/ui/terminal/table.ts | 7 +- tests/lakehouse.test.ts | 17 ++ 19 files changed, 1235 insertions(+), 10 deletions(-) create mode 100644 cli/src/commands/query/lib/top.test.ts create mode 100644 cli/src/commands/query/lib/top.ts create mode 100644 cli/src/commands/query/top.test.ts create mode 100644 cli/src/commands/query/top.ts create mode 100644 cli/src/ui/terminal/live-view.test.ts create mode 100644 cli/src/ui/terminal/live-view.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 75410ef..712674f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - List running queries with `altertable query list`. +- Monitor running queries with `altertable query top`: start time, elapsed time, progress, processed and estimated rows, compute size, worker, memory, disk, and client. Sort with `--sort elapsed|progress|rows|memory|disk`, and add `--watch` (`-w`) to refresh every second until Ctrl+C. - Preview a single-file data app locally with `altertable app dev --file index.tsx`. The file's `defineDataApp` scope must match the selected profile, and queries run through the CLI's loopback proxy. ### Changed diff --git a/COMMANDS.md b/COMMANDS.md index 0e640a3..1ea4acc 100644 --- a/COMMANDS.md +++ b/COMMANDS.md @@ -884,7 +884,7 @@ Run SQL queries against the lakehouse. ```bash altertable query [options] -altertable query list|show|cancel +altertable query list|show|top|cancel ``` **Arguments** @@ -914,6 +914,7 @@ altertable query list|show|cancel - `list` — List running queries in the current environment. - `show` — Fetch metadata for a completed or running query. +- `top` — Show running queries with progress, rows, and memory; --watch refreshes live. - `cancel` — Cancel a running query. **Examples** @@ -925,6 +926,7 @@ altertable query "SELECT 1" --format csv --output results.csv altertable query @report.sql --format csv --output results.csv altertable query list altertable query show +altertable query top --watch ``` #### `altertable query list` @@ -953,6 +955,33 @@ altertable query show | --- | --- | | `` | Query id returned by the API Required. | +#### `altertable query top` + +Show running queries with progress, rows, and memory; --watch refreshes live. + +**Usage** + +```bash +altertable query top [options] +``` + +**Options** + +| Option | Description | +| --- | --- | +| `-w, --watch` | Keep refreshing the view until interrupted (Ctrl+C) | +| `--interval ` | Seconds between refreshes in --watch mode Default: "1". | +| `--sort ` | Column to sort by, largest first Values: elapsed, progress, rows, memory, disk. Default: "elapsed". | + +**Examples** + +```bash +altertable query top +altertable query top --watch +altertable query top -w --interval 5 +altertable query top --sort memory +``` + #### `altertable query cancel` Cancel a running query. diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index cce9168..556769b 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -275,7 +275,7 @@ When bumping the `specs/` submodule, extend the mapped tests before merge. | --------------------------- | ---------------------------- | -------------------------------- | --------------------- | | POST /query (streamed) | `query ""` | `lakehouse.test.ts` stream tests | `integration.e2e.ts` | | POST /query (buffered json) | `query --json` | `lakehouse.test.ts` | `integration.e2e.ts` | -| GET /queries | `query list` | `lakehouse.test.ts` | — | +| GET /queries | `query list`, `query top` | `lakehouse.test.ts` | — | | GET/DELETE /query/{id} | `query show`, `query cancel` | `lakehouse.test.ts` | `integration.e2e.ts` | | POST /append + GET /tasks | `append`, `append status` | `lakehouse.test.ts` | `integration.e2e.ts` | | POST /upload | `upload` | `lakehouse.test.ts` | `integration.e2e.ts` | diff --git a/README.md b/README.md index 4aecba8..233b56d 100644 --- a/README.md +++ b/README.md @@ -398,6 +398,7 @@ inside a component, for example `customer%2E360.main.users`. ```bash altertable query list +altertable query top --watch altertable query show altertable query cancel --session-id altertable append status diff --git a/cli-reference.json b/cli-reference.json index 91d7638..b61e1e0 100644 --- a/cli-reference.json +++ b/cli-reference.json @@ -1526,7 +1526,7 @@ "description": "Run SQL queries against the lakehouse.", "usage": [ "altertable query [options] ", - "altertable query list|show|cancel" + "altertable query list|show|top|cancel" ], "aliases": [], "arguments": [ @@ -1686,7 +1686,8 @@ "altertable query \"SELECT 1\" --format csv --output results.csv", "altertable query @report.sql --format csv --output results.csv", "altertable query list", - "altertable query show " + "altertable query show ", + "altertable query top --watch" ], "subcommands": [ { @@ -1727,6 +1728,66 @@ "examples": [], "subcommands": [] }, + { + "id": "altertable-query-top", + "command": "altertable query top", + "description": "Show running queries with progress, rows, and memory; --watch refreshes live.", + "usage": [ + "altertable query top [options]" + ], + "aliases": [], + "arguments": [], + "options": [ + { + "name": "watch", + "aliases": [ + "w" + ], + "type": "boolean", + "description": "Keep refreshing the view until interrupted (Ctrl+C)", + "required": false, + "repeatable": false, + "scope": "command", + "values": [] + }, + { + "name": "interval", + "aliases": [], + "type": "string", + "description": "Seconds between refreshes in --watch mode", + "required": false, + "repeatable": false, + "scope": "command", + "values": [], + "valueHint": "SECONDS", + "default": "1" + }, + { + "name": "sort", + "aliases": [], + "type": "enum", + "description": "Column to sort by, largest first", + "required": false, + "repeatable": false, + "scope": "command", + "values": [ + "elapsed", + "progress", + "rows", + "memory", + "disk" + ], + "default": "elapsed" + } + ], + "examples": [ + "altertable query top", + "altertable query top --watch", + "altertable query top -w --interval 5", + "altertable query top --sort memory" + ], + "subcommands": [] + }, { "id": "altertable-query-cancel", "command": "altertable query cancel", diff --git a/cli/AGENTS.md b/cli/AGENTS.md index 4288c39..2353a08 100644 --- a/cli/AGENTS.md +++ b/cli/AGENTS.md @@ -135,7 +135,7 @@ altertable ├── catalog │ └── create ├── query -│ └── list, show, cancel +│ └── list, show, top, cancel ├── schema, duckdb ├── append │ └── status diff --git a/cli/scripts/command-reference.test.ts b/cli/scripts/command-reference.test.ts index d976d1f..e68ca43 100644 --- a/cli/scripts/command-reference.test.ts +++ b/cli/scripts/command-reference.test.ts @@ -62,7 +62,7 @@ describe('command reference', () => { const reference = renderCommandReferenceMarkdown(await resolveReference()); expect(reference).toContain( - '```bash\naltertable query [options] \naltertable query list|show|cancel\n```' + '```bash\naltertable query [options] \naltertable query list|show|top|cancel\n```' ); expect(reference).toContain('```bash\naltertable profile env [NAME]\n```'); expect(reference).toContain( diff --git a/cli/src/commands/query/index.ts b/cli/src/commands/query/index.ts index 8dba733..a07bed9 100644 --- a/cli/src/commands/query/index.ts +++ b/cli/src/commands/query/index.ts @@ -3,6 +3,7 @@ import { queryRunArgs } from '@/commands/query/lib/args.ts'; import { parseQueryStatement } from '@/commands/query/lib/statement.ts'; import { queryListCommand } from '@/commands/query/list.ts'; import { queryShowCommand } from '@/commands/query/show.ts'; +import { queryTopCommand } from '@/commands/query/top.ts'; import { optionalStringArg } from '@/lib/args.ts'; import { defineCommand } from '@/lib/command.ts'; import { CliError } from '@/lib/errors.ts'; @@ -30,12 +31,14 @@ export const queryCommand = defineCommand({ 'altertable query @report.sql --format csv --output results.csv', 'altertable query list', 'altertable query show ', + 'altertable query top --watch', ], }, args: queryRunArgs, subcommands: { list: queryListCommand, show: queryShowCommand, + top: queryTopCommand, cancel: queryCancelCommand, }, async run({ args, rawArgs, execution, sink }) { diff --git a/cli/src/commands/query/lib/top.test.ts b/cli/src/commands/query/lib/top.test.ts new file mode 100644 index 0000000..a9c7b6d --- /dev/null +++ b/cli/src/commands/query/lib/top.test.ts @@ -0,0 +1,350 @@ +import { afterEach, beforeEach, describe, expect, test } from 'bun:test'; + +import { + createQueryTopFrameRenderer, + fetchQueryTopSnapshot, + formatBytes, + formatClockTime, + formatCount, + formatElapsed, + renderQueryTopTable, + type QueryTopSnapshot, + type QueryTopSortKey, +} from '@/commands/query/lib/top.ts'; +import { createExecutionContext } from '@/lib/execution-context.ts'; +import { getCliRuntime } from '@/lib/runtime.ts'; +import { + createLakehouseTestWorkspace, + type LakehouseTestWorkspace, +} from '@/test-utils/lakehouse.ts'; +import { setTerminalColorMode } from '@/ui/terminal/styles.ts'; + +const OLDER_ID = '11111111-2222-3333-4444-555555555555'; +const NEWER_ID = '22222222-3333-4444-5555-666666666666'; + +function runningDetails(id: string, startTime: string) { + return { + uuid: id, + duration_ms: null, + start_time: startTime, + query: 'SELECT sum(i)\n FROM range(20000000000) t(i)', + percentage: 4.78, + rows_processed: 956_012_544, + total_rows: 20_000_000_002, + user_agent: 'altertable-cli/1.14.0', + worker: { + slug: 'api-worker-xs-646cbf4877-7csgb', + compute_size: 'XS', + memory_usage_bytes: 3_030_078, + memory_by_tag: [ + { + tag: 'HASH_TABLE', + memory_usage_bytes: 65_536, + temporary_storage_bytes: 1_048_576, + }, + { + tag: 'ORDER_BY', + memory_usage_bytes: 2_964_542, + temporary_storage_bytes: 524_288, + }, + ], + }, + }; +} + +function snapshotWith(count: number): QueryTopSnapshot { + return { + queries: Array.from({ length: count }, (_, index) => ({ + id: `query-${index}`, + started_at: '2026-11-08T08:00:00Z', + details: null, + })), + }; +} + +function cells(line: string | undefined): string[] | undefined { + return line?.trimEnd().split(/\s{2,}/); +} + +describe('fetchQueryTopSnapshot', () => { + let workspace: LakehouseTestWorkspace; + + beforeEach(() => { + workspace = createLakehouseTestWorkspace('query-top'); + }); + + afterEach(() => workspace.cleanup()); + + function mockTwoQueries(): void { + workspace.writeMocks([ + { + urlPattern: '/queries', + method: 'GET', + body: JSON.stringify({ + queries: [ + { id: NEWER_ID, started_at: '2026-11-08T08:20:00Z' }, + { id: OLDER_ID, started_at: '2026-11-08T08:18:00Z' }, + ], + }), + }, + { + urlPattern: `/query/${OLDER_ID}`, + method: 'GET', + body: JSON.stringify(runningDetails(OLDER_ID, '2026-11-08T08:18:00Z')), + }, + { + urlPattern: `/query/${NEWER_ID}`, + method: 'GET', + status: 404, + body: '{"error":"not found"}', + }, + ]); + } + + async function fetchIds(sortKey: QueryTopSortKey): Promise { + const snapshot = await fetchQueryTopSnapshot( + createExecutionContext(getCliRuntime()), + sortKey + ); + return snapshot.queries.map(query => query.id); + } + + test('fetches details for each listed query and keeps failed lookups', async () => { + mockTwoQueries(); + + const snapshot = await fetchQueryTopSnapshot( + createExecutionContext(getCliRuntime()), + 'elapsed' + ); + + expect(snapshot.queries[0]?.details).toMatchObject({ uuid: OLDER_ID }); + expect(snapshot.queries[1]).toEqual({ + id: NEWER_ID, + started_at: '2026-11-08T08:20:00Z', + details: null, + }); + const log = workspace.readHttpLog(); + expect(log).toContain('URL=https://example.com/queries'); + expect(log).toContain(`URL=https://example.com/query/${OLDER_ID}`); + expect(log).toContain(`URL=https://example.com/query/${NEWER_ID}`); + }); + + test('sorts largest first, with missing values last', async () => { + mockTwoQueries(); + expect(await fetchIds('elapsed')).toEqual([OLDER_ID, NEWER_ID]); + expect(await fetchIds('memory')).toEqual([OLDER_ID, NEWER_ID]); + expect(await fetchIds('rows')).toEqual([OLDER_ID, NEWER_ID]); + expect(await fetchIds('disk')).toEqual([OLDER_ID, NEWER_ID]); + }); + + test('skips detail lookups when nothing is running', async () => { + workspace.writeMocks([ + { urlPattern: '/queries', method: 'GET', body: '{"queries":[]}' }, + ]); + + expect(await fetchIds('progress')).toEqual([]); + expect(workspace.readHttpLog()).not.toContain('/query/'); + }); +}); + +describe('renderQueryTopTable', () => { + beforeEach(() => setTerminalColorMode('never')); + afterEach(() => setTerminalColorMode(undefined)); + + test('renders progress, estimated rows, worker, and a single-line statement', () => { + const startTime = '2026-11-08T08:18:41Z'; + const output = renderQueryTopTable( + { + queries: [ + { + id: OLDER_ID, + started_at: startTime, + details: runningDetails(OLDER_ID, startTime), + }, + ], + }, + { nowMs: Date.parse(startTime) + 75_000, terminalWidth: 260 } + ); + + const [header, row] = output.split('\n'); + expect(cells(header)).toEqual([ + 'ID', + 'STARTED', + 'ELAPSED', + 'PROGRESS', + 'ROWS', + 'COMPUTE SIZE', + 'WORKER', + 'MEM', + 'DISK', + 'CLIENT', + 'QUERY', + ]); + expect(cells(row)).toEqual([ + OLDER_ID, + formatClockTime(Date.parse(startTime)), + '1m15s', + '4.8%', + '956M / ~20B', + 'XS', + 'api-worker-xs-646cbf4877-7csgb', + '2.9 MiB', + '1.5 MiB', + 'altertable-cli/1.14.0', + 'SELECT sum(i) FROM range(20000000000) t(i)', + ]); + }); + + test('falls back to the listed start time when details are missing', () => { + const output = renderQueryTopTable( + { + queries: [ + { id: NEWER_ID, started_at: '2026-11-08T08:20:00Z', details: null }, + ], + }, + { nowMs: Date.parse('2026-11-08T08:20:02.5Z'), terminalWidth: 260 } + ); + + expect(cells(output.split('\n')[1])).toEqual([ + NEWER_ID, + formatClockTime(Date.parse('2026-11-08T08:20:00Z')), + '2.5s', + '-', + '-', + '-', + '-', + '-', + '-', + '-', + '-', + ]); + }); + + test('shows a dash for rows when nothing was scanned or estimated', () => { + const output = renderQueryTopTable( + { + queries: [ + { + id: OLDER_ID, + started_at: null, + details: { rows_processed: 0, total_rows: 0 }, + }, + ], + }, + { terminalWidth: 260 } + ); + + expect(cells(output.split('\n')[1])?.[4]).toBe('-'); + }); + + test('shows unknown progress when the server reports a negative estimate', () => { + const output = renderQueryTopTable( + { + queries: [ + { + id: OLDER_ID, + started_at: null, + details: { percentage: -1, rows_processed: 10 }, + }, + ], + }, + { terminalWidth: 260 } + ); + + expect(cells(output.split('\n')[1])?.slice(3, 5)).toEqual(['-', '10 / ~?']); + }); + + test('prefers the reported duration once a query has finished', () => { + const output = renderQueryTopTable( + { + queries: [ + { + id: OLDER_ID, + started_at: '2026-11-08T08:18:00Z', + details: { duration_ms: 1_250 }, + }, + ], + }, + { nowMs: Date.parse('2026-11-08T09:00:00Z'), terminalWidth: 260 } + ); + + expect(output).toContain('1.3s'); + }); + + test('shows an unstyled empty-state message', () => { + expect(renderQueryTopTable({ queries: [] })).toBe('No running queries.'); + }); +}); + +describe('createQueryTopFrameRenderer', () => { + beforeEach(() => setTerminalColorMode('never')); + afterEach(() => setTerminalColorMode(undefined)); + + test('keeps the last snapshot on screen when a refresh fails', async () => { + const responses: Array<() => Promise> = [ + async () => snapshotWith(1), + async () => { + throw new Error('lakehouse unavailable'); + }, + async () => snapshotWith(2), + ]; + const render = createQueryTopFrameRenderer( + () => (responses.shift() as () => Promise)(), + { intervalMs: 1_000, sortKey: 'memory' } + ); + + const first = await render({}); + const failed = await render({}); + const recovered = await render({}); + + expect(first).toContain('1 running query · sorted by memory'); + expect(first).toContain('every 1s'); + expect(failed).toContain('lakehouse unavailable'); + expect(failed).toContain('query-0'); + expect(recovered).toContain('2 running queries'); + expect(recovered).not.toContain('lakehouse unavailable'); + }); + + test('truncates rows to the terminal height', async () => { + const render = createQueryTopFrameRenderer(async () => snapshotWith(20), { + intervalMs: 1_000, + sortKey: 'elapsed', + }); + + const lines = (await render({ rows: 10 })).split('\n'); + + expect(lines.length).toBeLessThanOrEqual(9); + expect(lines.at(-1)).toBe('… 15 more'); + }); +}); + +describe('formatters', () => { + test('formatElapsed', () => { + expect(formatElapsed(undefined)).toBe('-'); + expect(formatElapsed(420)).toBe('420ms'); + expect(formatElapsed(3_000)).toBe('3s'); + expect(formatElapsed(12_340)).toBe('12.3s'); + expect(formatElapsed(65_000)).toBe('1m05s'); + expect(formatElapsed(3_723_000)).toBe('1h02m03s'); + }); + + test('formatCount', () => { + expect(formatCount(undefined)).toBe('?'); + expect(formatCount(999)).toBe('999'); + expect(formatCount(1_500)).toBe('1.5K'); + expect(formatCount(2_312_087_435)).toBe('2.3B'); + }); + + test('formatBytes', () => { + expect(formatBytes(undefined)).toBe('-'); + expect(formatBytes(512)).toBe('512 B'); + expect(formatBytes(12_286_243_248)).toBe('11.4 GiB'); + }); + + test('formatClockTime', () => { + expect(formatClockTime(undefined)).toBe('-'); + expect(formatClockTime(Date.parse('2026-11-08T08:18:41Z'))).toMatch( + /^\d{2}:\d{2}:41$/ + ); + }); +}); diff --git a/cli/src/commands/query/lib/top.ts b/cli/src/commands/query/lib/top.ts new file mode 100644 index 0000000..a0ab4d8 --- /dev/null +++ b/cli/src/commands/query/lib/top.ts @@ -0,0 +1,403 @@ +import type { ExecutionContext } from '@/lib/execution-context.ts'; +import { sendHttp } from '@/lib/http-request.ts'; +import { + buildLakehouseQueryListRequest, + buildLakehouseQueryShowRequest, +} from '@/lib/lakehouse/query.ts'; +import { isRecord } from '@/lib/object.ts'; +import { parseApiJson } from '@/lib/parse-api-json.ts'; +import { pluralizeLabel } from '@/lib/pluralize.ts'; +import { + span, + type DisplayTableColumn, + type DisplayTableOptions, +} from '@/ui/document.ts'; +import type { LiveViewport } from '@/ui/terminal/live-view.ts'; +import { renderDisplayText } from '@/ui/terminal/styles.ts'; +import { renderFixedTable } from '@/ui/terminal/table.ts'; + +/** Caps concurrent `GET /query/{id}` calls so large lists do not flood the API. */ +const DETAIL_CONCURRENCY = 8; +/** Widest `formatBytes` output below the next unit, e.g. `1023.9 MiB`. */ +const BYTES_WIDTH = 10; +/** Table header row plus the line the cursor rests on after a frame. */ +const TABLE_CHROME_LINES = 2; + +/** `--json` contract: the listed query plus its raw `GET /query/{id}` body. */ +export type QueryTopEntry = { + id: string; + started_at: string | null; + /** Null when the query finished before its lookup, or the lookup failed. */ + details: Record | null; +}; + +export type QueryTopSnapshot = { + queries: QueryTopEntry[]; +}; + +/** Display model: every API field `query top` reads, narrowed in one place. */ +type QueryTopRow = { + id: string; + startedAtMs?: number; + durationMs?: number; + statement?: string; + /** Undefined when the server has no progress estimate (it reports -1). */ + progress?: number; + rowsProcessed?: number; + /** Server-side scan estimate, not an exact count. */ + estimatedTotalRows?: number; + computeSize?: string; + workerSlug?: string; + userAgent?: string; + /** Reported on the worker running the query (`worker.memory_usage_bytes`). */ + memoryBytes?: number; + /** Spill to disk: the worker's `temporary_storage_bytes` summed over tags. */ + diskBytes?: number; +}; + +/** Every key sorts largest first; queries missing the value sort last. */ +const SORT_VALUES = { + elapsed: row => + row.startedAtMs === undefined ? undefined : -row.startedAtMs, + progress: row => row.progress, + rows: row => row.rowsProcessed, + memory: row => row.memoryBytes, + disk: row => row.diskBytes, +} satisfies Record number | undefined>; + +export type QueryTopSortKey = keyof typeof SORT_VALUES; +export const QUERY_TOP_SORT_KEYS = Object.keys( + SORT_VALUES +) as readonly QueryTopSortKey[]; + +export async function fetchQueryTopSnapshot( + execution: ExecutionContext, + sortKey: QueryTopSortKey +): Promise { + const listResponse = await sendHttp( + buildLakehouseQueryListRequest(), + execution + ); + const listed = parseRunningQueries(parseApiJson(listResponse)); + const details = await mapWithConcurrency(listed, DETAIL_CONCURRENCY, query => + fetchQueryDetails(query.id, execution) + ); + const queries = listed.map((query, index) => ({ + ...query, + details: details[index] ?? null, + })); + const sortValue = (entry: QueryTopEntry) => + SORT_VALUES[sortKey](toQueryTopRow(entry)) ?? -Infinity; + queries.sort((left, right) => sortValue(right) - sortValue(left)); + return { queries }; +} + +export function renderQueryTopTable( + snapshot: QueryTopSnapshot, + options: { nowMs?: number } & Pick< + DisplayTableOptions, + 'terminalWidth' | 'horizontalScroll' + > = {} +): string { + if (snapshot.queries.length === 0) { + // Match `query list`, which prints this message unstyled. + return 'No running queries.'; + } + const { nowMs = Date.now(), ...tableOptions } = options; + const columns: DisplayTableColumn[] = [ + { header: 'id', cell: row => row.id }, + { header: 'started', cell: row => formatClockTime(row.startedAtMs) }, + { + header: 'elapsed', + cell: row => formatElapsed(row.durationMs ?? elapsedSince(row, nowMs)), + minWidth: 9, // 10h02m03s + }, + { header: 'progress', cell: row => formatPercentage(row.progress) }, + { header: 'rows', cell: formatRowsCell, minWidth: 16 }, // 999.9M / ~999.9B + { header: 'compute size', cell: row => row.computeSize ?? '-' }, + { header: 'worker', cell: row => row.workerSlug ?? '-' }, + { + header: 'mem', + cell: row => formatBytes(row.memoryBytes), + minWidth: BYTES_WIDTH, + }, + { + header: 'disk', + cell: row => formatBytes(row.diskBytes), + minWidth: BYTES_WIDTH, + }, + { header: 'client', cell: row => row.userAgent ?? '-' }, + { + header: 'query', + cell: row => formatStatement(row.statement), + flex: true, + }, + ]; + return renderFixedTable( + snapshot.queries.map(toQueryTopRow), + columns, + undefined, + tableOptions + ); +} + +/** + * Builds `--watch` frames. Keeps the last good snapshot on screen when a + * refresh fails, with the error shown above it. + */ +export function createQueryTopFrameRenderer( + fetchSnapshot: () => Promise, + options: { intervalMs: number; sortKey: QueryTopSortKey } +): (viewport: LiveViewport) => Promise { + let snapshot: QueryTopSnapshot = { queries: [] }; + return async viewport => { + let errorMessage: string | undefined; + try { + snapshot = await fetchSnapshot(); + } catch (error) { + errorMessage = error instanceof Error ? error.message : String(error); + } + return renderQueryTopFrame(snapshot, { + ...options, + nowMs: Date.now(), + errorMessage, + maxRows: viewport.rows, + }); + }; +} + +function renderQueryTopFrame( + snapshot: QueryTopSnapshot, + options: { + nowMs: number; + intervalMs: number; + sortKey: QueryTopSortKey; + errorMessage?: string; + maxRows?: number; + } +): string { + const { queries } = snapshot; + const lines = [ + renderDisplayText([ + span( + pluralizeLabel(queries.length, 'running query', 'running queries'), + 'strong' + ), + span( + ` · sorted by ${options.sortKey}` + + ` · refreshed ${formatClockTime(options.nowMs)}` + + ` · every ${formatElapsed(options.intervalMs)} · Ctrl+C to quit`, + 'subtle' + ), + ]), + ]; + if (options.errorMessage !== undefined) { + lines.push(renderDisplayText([span(options.errorMessage, 'error')])); + } + lines.push(''); + + // At least one query row plus the "more" line when the list overflows. + const rowBudget = + options.maxRows === undefined + ? Infinity + : Math.max(2, options.maxRows - lines.length - TABLE_CHROME_LINES); + const overflows = queries.length > rowBudget; + const shown = overflows ? queries.slice(0, rowBudget - 1) : queries; + lines.push(renderQueryTopTable({ queries: shown }, { nowMs: options.nowMs })); + if (overflows) { + lines.push( + renderDisplayText([ + span(`… ${queries.length - shown.length} more`, 'subtle'), + ]) + ); + } + return lines.join('\n'); +} + +function toQueryTopRow(entry: QueryTopEntry): QueryTopRow { + const details = entry.details ?? {}; + const worker = isRecord(details.worker) ? details.worker : {}; + const progress = optionalNumber(details.percentage); + return { + id: entry.id, + startedAtMs: + optionalTimestamp(details.start_time) ?? + optionalTimestamp(entry.started_at), + durationMs: optionalNumber(details.duration_ms), + statement: optionalString(details.query), + progress: progress !== undefined && progress >= 0 ? progress : undefined, + rowsProcessed: optionalNumber(details.rows_processed), + estimatedTotalRows: optionalNumber(details.total_rows), + computeSize: optionalString(worker.compute_size), + workerSlug: optionalString(worker.slug), + userAgent: optionalString(details.user_agent), + memoryBytes: optionalNumber(worker.memory_usage_bytes), + diskBytes: sumTemporaryStorageBytes(worker.memory_by_tag), + }; +} + +function parseRunningQueries(data: unknown): Omit[] { + if (!isRecord(data) || !Array.isArray(data.queries)) { + return []; + } + return data.queries.filter(isRecord).flatMap(query => + typeof query.id === 'string' + ? [ + { + id: query.id, + started_at: optionalString(query.started_at) ?? null, + }, + ] + : [] + ); +} + +async function fetchQueryDetails( + queryId: string, + execution: ExecutionContext +): Promise | null> { + try { + const response = await sendHttp( + buildLakehouseQueryShowRequest(queryId), + execution + ); + const data = parseApiJson(response); + return isRecord(data) ? data : null; + } catch { + // The query may finish between listing and lookup; keep the listed row. + return null; + } +} + +async function mapWithConcurrency( + items: readonly T[], + limit: number, + mapper: (item: T) => Promise +): Promise { + const results: R[] = []; + let nextIndex = 0; + async function worker(): Promise { + for (let index = nextIndex++; index < items.length; index = nextIndex++) { + results[index] = await mapper(items[index] as T); + } + } + await Promise.all( + Array.from({ length: Math.min(limit, items.length) }, worker) + ); + return results; +} + +function sumTemporaryStorageBytes(memoryByTag: unknown): number | undefined { + if (!Array.isArray(memoryByTag)) { + return undefined; + } + return memoryByTag + .filter(isRecord) + .reduce( + (total, tag) => + total + (optionalNumber(tag.temporary_storage_bytes) ?? 0), + 0 + ); +} + +function optionalString(value: unknown): string | undefined { + return typeof value === 'string' ? value : undefined; +} + +function optionalNumber(value: unknown): number | undefined { + return typeof value === 'number' && Number.isFinite(value) + ? value + : undefined; +} + +function optionalTimestamp(value: unknown): number | undefined { + const parsed = typeof value === 'string' ? Date.parse(value) : Number.NaN; + return Number.isNaN(parsed) ? undefined : parsed; +} + +function elapsedSince(row: QueryTopRow, nowMs: number): number | undefined { + return row.startedAtMs === undefined + ? undefined + : Math.max(0, nowMs - row.startedAtMs); +} + +function formatRowsCell(row: QueryTopRow): string { + // Nothing scanned and nothing to scan (missing or 0) carries no information. + if (!row.rowsProcessed && !row.estimatedTotalRows) { + return '-'; + } + return `${formatCount(row.rowsProcessed)} / ~${formatCount(row.estimatedTotalRows)}`; +} + +function formatStatement(statement: string | undefined): string { + return statement === undefined ? '-' : statement.replace(/\s+/g, ' ').trim(); +} + +export function formatClockTime(timestampMs: number | undefined): string { + if (timestampMs === undefined) { + return '-'; + } + const date = new Date(timestampMs); + return [date.getHours(), date.getMinutes(), date.getSeconds()] + .map(part => String(part).padStart(2, '0')) + .join(':'); +} + +export function formatElapsed(milliseconds: number | undefined): string { + if (milliseconds === undefined) { + return '-'; + } + if (milliseconds < 1_000) { + return `${Math.round(milliseconds)}ms`; + } + const totalSeconds = Math.floor(milliseconds / 1_000); + if (totalSeconds < 60) { + return `${(milliseconds / 1_000).toFixed(1).replace(/\.0$/, '')}s`; + } + const hours = Math.floor(totalSeconds / 3_600); + const minutes = Math.floor((totalSeconds % 3_600) / 60); + const seconds = String(totalSeconds % 60).padStart(2, '0'); + return hours > 0 + ? `${hours}h${String(minutes).padStart(2, '0')}m${seconds}s` + : `${minutes}m${seconds}s`; +} + +function formatPercentage(value: number | undefined): string { + return value === undefined ? '-' : `${value.toFixed(1)}%`; +} + +const COUNT_UNITS = [ + { value: 1e12, suffix: 'T' }, + { value: 1e9, suffix: 'B' }, + { value: 1e6, suffix: 'M' }, + { value: 1e3, suffix: 'K' }, +] as const; + +export function formatCount(value: number | undefined): string { + if (value === undefined) { + return '?'; + } + const unit = COUNT_UNITS.find( + candidate => Math.abs(value) >= candidate.value + ); + if (unit === undefined) { + return String(Math.round(value)); + } + return `${(value / unit.value).toFixed(1).replace(/\.0$/, '')}${unit.suffix}`; +} + +const BYTE_UNITS = ['B', 'KiB', 'MiB', 'GiB', 'TiB'] as const; + +export function formatBytes(value: number | undefined): string { + if (value === undefined) { + return '-'; + } + let scaled = value; + let unitIndex = 0; + while (Math.abs(scaled) >= 1024 && unitIndex < BYTE_UNITS.length - 1) { + scaled /= 1024; + unitIndex++; + } + const digits = unitIndex === 0 ? 0 : 1; + return `${scaled.toFixed(digits)} ${BYTE_UNITS[unitIndex]}`; +} diff --git a/cli/src/commands/query/top.test.ts b/cli/src/commands/query/top.test.ts new file mode 100644 index 0000000..bf55441 --- /dev/null +++ b/cli/src/commands/query/top.test.ts @@ -0,0 +1,100 @@ +import { afterEach, beforeEach, describe, expect, test } from 'bun:test'; + +import { runCommandWithTestRuntime } from '@/test-utils/cli.ts'; +import { + createLakehouseTestWorkspace, + type LakehouseTestWorkspace, +} from '@/test-utils/lakehouse.ts'; + +const QUERY_ID = '11111111-2222-3333-4444-555555555555'; +const HUMAN = { debug: false, json: false, agent: false }; + +describe('query top command', () => { + let workspace: LakehouseTestWorkspace; + + beforeEach(() => { + workspace = createLakehouseTestWorkspace('query-top-command'); + workspace.writeMocks([ + { + urlPattern: '/queries', + method: 'GET', + body: JSON.stringify({ + queries: [{ id: QUERY_ID, started_at: '2026-11-08T08:00:00Z' }], + }), + }, + { + urlPattern: `/query/${QUERY_ID}`, + method: 'GET', + body: JSON.stringify({ + uuid: QUERY_ID, + query: 'SELECT 1', + percentage: 50, + }), + }, + ]); + }); + + afterEach(() => workspace.cleanup()); + + test('lists running queries with details and exits', async () => { + const harness = await runCommandWithTestRuntime(['query', 'top'], HUMAN); + + const output = harness.stdout.join(''); + expect(output).toContain(QUERY_ID); + expect(output).toContain('50.0%'); + expect(output).toContain('SELECT 1'); + }); + + test('emits merged list and detail entries as JSON', async () => { + const harness = await runCommandWithTestRuntime(['query', 'top']); + + expect(JSON.parse(harness.stdout.join(''))).toEqual({ + queries: [ + { + id: QUERY_ID, + started_at: '2026-11-08T08:00:00Z', + details: { uuid: QUERY_ID, query: 'SELECT 1', percentage: 50 }, + }, + ], + }); + }); + + test('rejects --watch with JSON output', async () => { + expect(runCommandWithTestRuntime(['query', 'top', '-w'])).rejects.toThrow( + '--watch cannot be combined with --json or --agent.' + ); + }); + + test('rejects --watch outside an interactive terminal', async () => { + const originalIsTTY = process.stdout.isTTY; + Object.defineProperty(process.stdout, 'isTTY', { + configurable: true, + value: false, + }); + try { + expect( + runCommandWithTestRuntime(['query', 'top', '--watch'], HUMAN) + ).rejects.toThrow('--watch requires an interactive terminal.'); + } finally { + Object.defineProperty(process.stdout, 'isTTY', { + configurable: true, + value: originalIsTTY, + }); + } + }); + + test('rejects unknown sort keys', async () => { + expect( + runCommandWithTestRuntime(['query', 'top', '--sort', 'cpu'], HUMAN) + ).rejects.toThrow('--sort'); + }); + + test('rejects intervals below the minimum', async () => { + expect( + runCommandWithTestRuntime(['query', 'top', '--interval', '0.1'], HUMAN) + ).rejects.toThrow('Invalid --interval'); + expect( + runCommandWithTestRuntime(['query', 'top', '--interval', 'soon'], HUMAN) + ).rejects.toThrow('Invalid --interval'); + }); +}); diff --git a/cli/src/commands/query/top.ts b/cli/src/commands/query/top.ts new file mode 100644 index 0000000..3b10c7b --- /dev/null +++ b/cli/src/commands/query/top.ts @@ -0,0 +1,92 @@ +import { + createQueryTopFrameRenderer, + fetchQueryTopSnapshot, + QUERY_TOP_SORT_KEYS, + renderQueryTopTable, +} from '@/commands/query/lib/top.ts'; +import { booleanArg, enumArg, stringArg } from '@/lib/args.ts'; +import { defineCommand } from '@/lib/command.ts'; +import { CliError } from '@/lib/errors.ts'; +import { runLiveView } from '@/ui/terminal/live-view.ts'; + +export const queryTopCommand = defineCommand({ + metadata: { + name: 'top', + description: + 'Show running queries with progress, rows, and memory; --watch refreshes live.', + examples: [ + 'altertable query top', + 'altertable query top --watch', + 'altertable query top -w --interval 5', + 'altertable query top --sort memory', + ], + }, + args: { + watch: { + type: 'boolean', + alias: 'w', + description: 'Keep refreshing the view until interrupted (Ctrl+C)', + }, + interval: { + type: 'string', + description: 'Seconds between refreshes in --watch mode', + default: '1', + valueHint: 'SECONDS', + }, + sort: { + type: 'enum', + description: 'Column to sort by, largest first', + options: QUERY_TOP_SORT_KEYS, + default: 'elapsed', + }, + }, + async run({ args, execution, sink }) { + const intervalMs = parseIntervalMs(stringArg(args, 'interval')); + const sortKey = enumArg(args, 'sort', QUERY_TOP_SORT_KEYS); + const fetchSnapshot = () => fetchQueryTopSnapshot(execution, sortKey); + + if (!booleanArg(args, 'watch')) { + const snapshot = await fetchSnapshot(); + if (sink.json) { + sink.writeJson(snapshot); + return; + } + // Piped output keeps full statements instead of fitting a phantom 80 columns. + sink.writeHuman( + renderQueryTopTable(snapshot, { + horizontalScroll: process.stdout.isTTY !== true, + }) + ); + return; + } + + if (sink.json) { + throw new CliError('--watch cannot be combined with --json or --agent.'); + } + if (process.stdout.isTTY !== true) { + throw new CliError('--watch requires an interactive terminal.'); + } + const encoder = new TextEncoder(); + await runLiveView({ + intervalMs, + render: createQueryTopFrameRenderer(fetchSnapshot, { + intervalMs, + sortKey, + }), + write: text => sink.writeBytes(encoder.encode(text)), + }); + }, +}); + +const MIN_INTERVAL_MS = 200; + +function parseIntervalMs(value: string): number { + const seconds = Number(value.trim()); + const intervalMs = Math.round(seconds * 1_000); + if (!Number.isFinite(seconds) || intervalMs < MIN_INTERVAL_MS) { + throw new CliError( + `Invalid --interval: must be a number of seconds >= ${MIN_INTERVAL_MS / 1_000}.` + ); + } + return intervalMs; +} diff --git a/cli/src/lib/usage.test.ts b/cli/src/lib/usage.test.ts index d9a4a10..a540399 100644 --- a/cli/src/lib/usage.test.ts +++ b/cli/src/lib/usage.test.ts @@ -211,7 +211,7 @@ describe('renderAltertableUsage', () => { expect(help.command).toBe('altertable query'); expect(help.usage).toEqual([ 'altertable query [flags] ', - 'altertable query list|show|cancel', + 'altertable query list|show|top|cancel', ]); expect(help.arguments).toContainEqual( expect.objectContaining({ name: 'statement', type: 'positional' }) @@ -234,6 +234,7 @@ describe('renderAltertableUsage', () => { expect(help.subcommands.map(command => command.name)).toEqual([ 'list', 'show', + 'top', 'cancel', ]); }); @@ -249,7 +250,7 @@ describe('renderAltertableUsage', () => { const queryUsage = await renderAltertableUsage(query, queryParent); expect(queryUsage).toContain( - 'Usage\n altertable query [flags] \n altertable query list|show|cancel' + 'Usage\n altertable query [flags] \n altertable query list|show|top|cancel' ); expect(queryUsage).not.toContain('[STATEMENT] show|cancel'); diff --git a/cli/src/ui/document.ts b/cli/src/ui/document.ts index ffa2001..8e966ec 100644 --- a/cli/src/ui/document.ts +++ b/cli/src/ui/document.ts @@ -29,6 +29,8 @@ export type DisplayRow = { export type DisplayTableColumn = { header: string; cell: (row: Row) => DisplayText; + /** Reserves width so live views do not shift as values grow. */ + minWidth?: number; maxWidth?: number; flex?: boolean; }; diff --git a/cli/src/ui/terminal/live-view.test.ts b/cli/src/ui/terminal/live-view.test.ts new file mode 100644 index 0000000..ff2d498 --- /dev/null +++ b/cli/src/ui/terminal/live-view.test.ts @@ -0,0 +1,70 @@ +import { describe, expect, test } from 'bun:test'; + +import { runLiveView } from '@/ui/terminal/live-view.ts'; + +const ENTER_SCREEN = '\u001b[?1049h\u001b[?25l'; +const LEAVE_SCREEN = '\u001b[?25h\u001b[?1049l'; + +function interrupt(): void { + process.emit('SIGINT', 'SIGINT'); +} + +describe('runLiveView', () => { + test('redraws frames until Ctrl+C, then restores the terminal', async () => { + const writes: string[] = []; + let renders = 0; + const sigintListeners = process.listenerCount('SIGINT'); + + await runLiveView({ + intervalMs: 1, + render: async () => { + renders += 1; + if (renders === 3) interrupt(); + return `frame ${renders}\nsecond line`; + }, + write: text => { + writes.push(text); + }, + }); + + expect(writes[0]).toBe(ENTER_SCREEN); + expect(writes.at(-1)).toBe(LEAVE_SCREEN); + expect(writes.slice(1, -1)).toEqual([ + '\u001b[Hframe 1\u001b[K\nsecond line\u001b[K\u001b[J', + '\u001b[Hframe 2\u001b[K\nsecond line\u001b[K\u001b[J', + ]); + expect(process.listenerCount('SIGINT')).toBe(sigintListeners); + }); + + test('discards a frame still rendering when interrupted', async () => { + const writes: string[] = []; + + await runLiveView({ + intervalMs: 1_000, + render: () => { + interrupt(); + return new Promise(() => {}); + }, + write: text => { + writes.push(text); + }, + }); + + expect(writes).toEqual([ENTER_SCREEN, LEAVE_SCREEN]); + }); + + test('stops waiting between frames when interrupted', async () => { + const startedAt = Date.now(); + + await runLiveView({ + intervalMs: 60_000, + render: async () => { + setTimeout(interrupt, 5); + return 'frame'; + }, + write: () => {}, + }); + + expect(Date.now() - startedAt).toBeLessThan(5_000); + }); +}); diff --git a/cli/src/ui/terminal/live-view.ts b/cli/src/ui/terminal/live-view.ts new file mode 100644 index 0000000..4530bb2 --- /dev/null +++ b/cli/src/ui/terminal/live-view.ts @@ -0,0 +1,81 @@ +const CSI = '\u001b['; +const ENTER_SCREEN = `${CSI}?1049h${CSI}?25l`; +const LEAVE_SCREEN = `${CSI}?25h${CSI}?1049l`; + +export type LiveViewport = { + /** Terminal height in lines, when known. */ + rows?: number; +}; + +export type LiveViewOptions = { + intervalMs: number; + /** Builds the next frame. A frame still pending at Ctrl+C is discarded. */ + render: (viewport: LiveViewport) => Promise; + write: (text: string) => void | Promise; +}; + +/** + * Redraws a full-screen view on the alternate screen every `intervalMs` until + * Ctrl+C, then restores the terminal. The caller checks for an interactive TTY. + */ +export async function runLiveView(options: LiveViewOptions): Promise { + const controller = new AbortController(); + const interrupt = () => controller.abort(); + process.on('SIGINT', interrupt); + await options.write(ENTER_SCREEN); + try { + while (!controller.signal.aborted) { + const frame = await untilAborted( + options.render({ rows: process.stdout.rows }), + controller.signal + ); + if (frame === undefined || controller.signal.aborted) { + return; + } + await options.write(redrawInPlace(frame)); + await abortableSleep(options.intervalMs, controller.signal); + } + } finally { + process.off('SIGINT', interrupt); + await options.write(LEAVE_SCREEN); + } +} + +/** Homes the cursor and clears each line's tail, then everything below. */ +function redrawInPlace(frame: string): string { + const body = frame + .split('\n') + .map(line => `${line}${CSI}K`) + .join('\n'); + return `${CSI}H${body}${CSI}J`; +} + +async function untilAborted( + promise: Promise, + signal: AbortSignal +): Promise { + let onAbort = () => {}; + const aborted = new Promise(resolve => { + onAbort = () => resolve(undefined); + // `promise` may have aborted the signal while it was being created. + if (signal.aborted) onAbort(); + signal.addEventListener('abort', onAbort, { once: true }); + }); + try { + return await Promise.race([promise, aborted]); + } finally { + signal.removeEventListener('abort', onAbort); + } +} + +function abortableSleep(milliseconds: number, signal: AbortSignal) { + return new Promise(resolve => { + const timer = setTimeout(done, milliseconds); + signal.addEventListener('abort', done, { once: true }); + function done() { + clearTimeout(timer); + signal.removeEventListener('abort', done); + resolve(); + } + }); +} diff --git a/cli/src/ui/terminal/table.test.ts b/cli/src/ui/terminal/table.test.ts index 6f213ab..63a548a 100644 --- a/cli/src/ui/terminal/table.test.ts +++ b/cli/src/ui/terminal/table.test.ts @@ -42,6 +42,17 @@ describe('renderFixedTable', () => { expect(output).toBe('NAME ROLE \nAlice admin'); }); + test('pads columns to minWidth', () => { + const output = renderFixedTable( + [{ label: 'ab', value: 'x' }], + [ + { header: 'LABEL', cell: row => row.label, minWidth: 8 }, + { header: 'VALUE', cell: row => row.value }, + ] + ); + expect(output).toBe('LABEL VALUE\nab x '); + }); + test('truncates cells when maxWidth is set', () => { const output = renderFixedTable( [{ label: 'abcdefghijklmnopqrstuvwxyz' }], diff --git a/cli/src/ui/terminal/table.ts b/cli/src/ui/terminal/table.ts index cd99201..b415157 100644 --- a/cli/src/ui/terminal/table.ts +++ b/cli/src/ui/terminal/table.ts @@ -37,12 +37,15 @@ function computeNaturalColumnWidths( renderedHeaders: string[], renderedCells: string[][] ): number[] { - return columns.map((_column, columnIndex) => { + return columns.map((column, columnIndex) => { const values = [ renderedHeaders[columnIndex] ?? '', ...renderedCells.map(cells => cells[columnIndex] ?? ''), ]; - return Math.max(...values.map(value => getVisibleTextWidth(value)), 1); + return Math.max( + ...values.map(value => getVisibleTextWidth(value)), + column.minWidth ?? 1 + ); }); } diff --git a/tests/lakehouse.test.ts b/tests/lakehouse.test.ts index 4751aac..6388e0c 100644 --- a/tests/lakehouse.test.ts +++ b/tests/lakehouse.test.ts @@ -47,6 +47,23 @@ describe("lakehouse command routing", () => { expect(JSON.parse(result.stdout)).toEqual(queries); }); + test("query top fetches details for each running query", async () => { + const queryId = "11111111-2222-3333-4444-555555555555"; + const details = { uuid: queryId, query: "SELECT 1", percentage: 12.5 }; + await workspace.setupHttpLog(); + await workspace.setupMockHttp([ + jsonMock("GET", "/queries", { queries: [{ id: queryId, started_at: "2026-11-05T17:49:18Z" }] }), + jsonMock("GET", `/query/${queryId}`, details), + ]); + + const result = await workspace.runCommand("altertable --json query top"); + + expect(result.exitCode).toBe(0); + expect(JSON.parse(result.stdout)).toEqual({ + queries: [{ id: queryId, started_at: "2026-11-05T17:49:18Z", details }], + }); + }); + test("append status fetches status without append-run flags", async () => { await workspace.setupHttpLog(); await workspace.setupMockHttp([jsonMock("GET", `/tasks/${appendId}`, { task_id: appendId, status: "completed" })]); From a04541a5537e376678707b01561faefa8591ea16 Mon Sep 17 00:00:00 2001 From: Sylvain Utard Date: Sun, 8 Nov 2026 10:13:16 +0100 Subject: [PATCH 2/3] ci: run user-directories job on macos-15 GitHub no longer supports the macos-14 runner image, so the job was cancelled before starting and failed the Required check on every run since Nov 5, main included. The release matrix already uses macos-15. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/verify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 75ad0a2..51aa5c7 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -109,7 +109,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-24.04, macos-14, windows-latest] + os: [ubuntu-24.04, macos-15, windows-latest] steps: - name: Check out revision From c7d42e2c780d04aeb975397270e99ffe72100214 Mon Sep 17 00:00:00 2001 From: Sylvain Utard Date: Sun, 8 Nov 2026 10:14:13 +0100 Subject: [PATCH 3/3] ci: run user-directories job on macos-latest Track GitHub's current macOS image, like windows-latest, so retiring an image no longer cancels the job. Release builds stay pinned. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/verify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 51aa5c7..1518988 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -109,7 +109,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-24.04, macos-15, windows-latest] + os: [ubuntu-24.04, macos-latest, windows-latest] steps: - name: Check out revision