From 74dc1fd8c6d0ea889711490efe46b856f1330e46 Mon Sep 17 00:00:00 2001 From: yannickmonney Date: Sun, 27 Sep 2026 21:32:37 +0200 Subject: [PATCH] fix(platform): log pg-boss's failed polls once per database outage pg-boss emits every failed poll of every queue's worker as an error event, and createBoss dumped each one in full: 677 events, some 11,800 log lines, in one 20 s database restart. An unavailable database (isDatabaseUnavailable) is now one warn line per outage, re-armed once a pg-boss worker's poll succeeds; any other pg-boss error is still logged in full. A worker's failure arrives as a plain copy of the error with its queue appended to the message, so the classifier reads through that suffix and describeDatabaseError reads a plain copy. --- .../configuration/observability-config.md | 2 +- .../configuration/observability-config.md | 2 +- .../configuration/observability-config.md | 2 +- .../platform/backend/db/unavailable.test.ts | 12 + services/platform/backend/db/unavailable.ts | 15 +- services/platform/backend/jobs/boss.test.ts | 277 ++++++++++++++++++ services/platform/backend/jobs/boss.ts | 75 ++++- .../tests/manual/reference/automation.md | 1 + .../platform/tests/manual/reference/pins.md | 1 + .../tests/manual/suites/performance.md | 9 +- 10 files changed, 383 insertions(+), 13 deletions(-) create mode 100644 services/platform/backend/jobs/boss.test.ts diff --git a/docs/de/self-hosted/configuration/observability-config.md b/docs/de/self-hosted/configuration/observability-config.md index d31e09b4ff..cdf0407e3a 100644 --- a/docs/de/self-hosted/configuration/observability-config.md +++ b/docs/de/self-hosted/configuration/observability-config.md @@ -64,7 +64,7 @@ SENTRY_TRACES_SAMPLE_RATE=0.1 Die Abtastrate gilt für Leistungstraces im Browser. Das Backend sendet Fehlerberichte, keine Leistungstraces. In der Entwicklung beträgt die Standardrate für Browsertraces 1.0. Wähle für den Produktivbetrieb einen Wert passend zu deinem Überwachungsbudget. Backend-Ereignisse enthalten nie Cookies oder Inhalte der Anfrage. Autorisierungs-, Cookie-, API-Schlüssel-, Token-, Secret- und Sitzungs-Header, Webhook- und Freigabe-Tokens in URLs sowie Zugangswerte in Abfrageparametern wie OAuth-Codes werden vor dem Senden durch `[Filtered]` ersetzt. Stackframes und Fehlermeldungen werden unverändert übertragen; berücksichtige bei der Zielwahl deine Vorgaben zur Datenverarbeitung. -Ein Neustart der Datenbank gilt nicht als Fehler; ein verwaltetes Upgrade erstellt die Datenbank bei jedem Release neu. Solange sie nicht erreichbar ist, antworten Anfragen mit `503 DATABASE_UNAVAILABLE` und `Retry-After`, Hintergrundjobs schlagen fehl und werden nach der Richtlinie ihrer Warteschlange wiederholt, und offene Live-Update-Streams warten ab und laufen danach weiter. Stattdessen landet jeweils eine Warnung im Protokoll. Bleibt die Datenbank länger als etwa eine Minute unerreichbar, sendet ein API-Prozess mit offenen Live-Update-Streams für diesen Ausfall ein einziges Ereignis der Stufe „warning“. +Ein Neustart der Datenbank gilt nicht als Fehler; ein verwaltetes Upgrade erstellt die Datenbank bei jedem Release neu. Solange sie nicht erreichbar ist, antworten Anfragen mit `503 DATABASE_UNAVAILABLE` und `Retry-After`, Hintergrundjobs schlagen fehl und werden nach der Richtlinie ihrer Warteschlange wiederholt, und offene Live-Update-Streams warten ab und laufen danach weiter. Stattdessen landet jeweils eine Warnung im Protokoll. Die Job-Warteschlange schreibt für den ganzen Ausfall nur eine, nicht eine für jede fehlgeschlagene Abfrage. Bleibt die Datenbank länger als etwa eine Minute unerreichbar, sendet ein API-Prozess mit offenen Live-Update-Streams für diesen Ausfall ein einziges Ereignis der Stufe „warning“. Fehler, die auf keinen Defekt in Tale hinweisen, meldet der Browser nicht: diff --git a/docs/en/self-hosted/configuration/observability-config.md b/docs/en/self-hosted/configuration/observability-config.md index 4dabd50cbe..1efb692f33 100644 --- a/docs/en/self-hosted/configuration/observability-config.md +++ b/docs/en/self-hosted/configuration/observability-config.md @@ -64,7 +64,7 @@ SENTRY_TRACES_SAMPLE_RATE=0.1 The trace sample rate applies to browser performance traces. The backend sends errors, not performance traces. Browser traces default to 1.0 in development; choose a production sample rate that fits your monitoring budget. Backend events never include request cookies or bodies. Authorization, cookie, API-key, token, secret and session headers, webhook and share tokens in URLs, and credential query values such as OAuth codes are replaced with `[Filtered]` before sending. Stack frames and error messages are sent as they are, so choose the destination according to your data-handling requirements. -A database restart is not reported as an error; a managed upgrade recreates the database on every release. While it is unreachable, requests answer `503 DATABASE_UNAVAILABLE` with `Retry-After`, background jobs fail and retry under their queue's policy, and open live-update streams back off and resume. Each logs a warning line instead. When the database stays unreachable for more than about a minute, an API process with live-update streams open sends one warning-level event for that outage. +A database restart is not reported as an error; a managed upgrade recreates the database on every release. While it is unreachable, requests answer `503 DATABASE_UNAVAILABLE` with `Retry-After`, background jobs fail and retry under their queue's policy, and open live-update streams back off and resume. Each logs a warning line instead. The job queue logs one for the whole outage, not one for every failed poll. When the database stays unreachable for more than about a minute, an API process with live-update streams open sends one warning-level event for that outage. The browser leaves out errors that do not indicate a defect in Tale: diff --git a/docs/fr/self-hosted/configuration/observability-config.md b/docs/fr/self-hosted/configuration/observability-config.md index 2d9bb49ebe..119ccd3c8b 100644 --- a/docs/fr/self-hosted/configuration/observability-config.md +++ b/docs/fr/self-hosted/configuration/observability-config.md @@ -64,7 +64,7 @@ SENTRY_TRACES_SAMPLE_RATE=0.1 Le taux d’échantillonnage concerne les traces de performance du navigateur. Le backend envoie des erreurs, pas de traces de performance. Le taux par défaut des traces du navigateur est de 1.0 en développement. Choisis un taux adapté à ton budget de supervision en production. Les événements du backend n’incluent jamais les cookies ni le corps des requêtes. Les en-têtes d’autorisation, de cookie, de clé d’API, de jeton, de secret et de session, les jetons de webhook et de partage dans les URL ainsi que les valeurs d’identification des paramètres de requête, comme les codes OAuth, sont remplacés par `[Filtered]` avant l’envoi. Les cadres de pile et les messages d’erreur sont envoyés tels quels ; choisis la destination selon tes exigences de traitement des données. -Un redémarrage de la base de données n’est pas signalé comme une erreur : une mise à niveau gérée recrée la base à chaque version. Tant qu’elle est injoignable, les requêtes répondent `503 DATABASE_UNAVAILABLE` avec `Retry-After`, les tâches d’arrière-plan échouent puis sont relancées selon la politique de leur file, et les flux de mise à jour en direct ouverts patientent puis reprennent. Chacun écrit un avertissement dans le journal à la place. Si la base reste injoignable plus d’une minute environ, un processus API ayant des flux ouverts envoie un seul événement de niveau « warning » pour cette panne. +Un redémarrage de la base de données n’est pas signalé comme une erreur : une mise à niveau gérée recrée la base à chaque version. Tant qu’elle est injoignable, les requêtes répondent `503 DATABASE_UNAVAILABLE` avec `Retry-After`, les tâches d’arrière-plan échouent puis sont relancées selon la politique de leur file, et les flux de mise à jour en direct ouverts patientent puis reprennent. Chacun écrit un avertissement dans le journal à la place. La file des tâches n’en écrit qu’un pour toute la panne, et non un à chaque interrogation échouée. Si la base reste injoignable plus d’une minute environ, un processus API ayant des flux ouverts envoie un seul événement de niveau « warning » pour cette panne. Le navigateur ne signale pas les erreurs qui ne révèlent aucun défaut de Tale : diff --git a/services/platform/backend/db/unavailable.test.ts b/services/platform/backend/db/unavailable.test.ts index 5991a37ff9..8e0005d842 100644 --- a/services/platform/backend/db/unavailable.test.ts +++ b/services/platform/backend/db/unavailable.test.ts @@ -195,6 +195,18 @@ describe('describeDatabaseError', () => { ).toBe('connect ECONNREFUSED 10.0.0.5:5432'); expect(describeDatabaseError('plain')).toBe('plain'); }); + + it('reads a plain copy of an error’s fields, as pg-boss re-emits one', () => { + expect( + describeDatabaseError({ + code: '57P01', + message: 'terminating connection due to administrator command', + queue: 'rag.index_file', + }), + ).toBe('57P01 terminating connection due to administrator command'); + expect(describeDatabaseError({ code: '57P01' })).toBe('57P01'); + expect(describeDatabaseError({})).toBe(''); + }); }); describe('a database error a library swallowed', () => { diff --git a/services/platform/backend/db/unavailable.ts b/services/platform/backend/db/unavailable.ts index 3dfde87028..671f45b549 100644 --- a/services/platform/backend/db/unavailable.ts +++ b/services/platform/backend/db/unavailable.ts @@ -9,7 +9,8 @@ import { AsyncLocalStorage } from 'node:async_hooks'; * restart, so this is an operational event, not a defect: a request answers * a retryable 503 (`error-reporting.ts`), the `/events` stream backs off * (`realtime/sse.ts`), a job fails for pg-boss to retry (`jobs/runner.ts`), - * and none of them reports an error. + * pg-boss's failing polls log one line per outage (`jobs/boss.ts`), and none + * of them reports an error. * * Deliberately narrower than its two neighbours. `isTransientDbError` * (`@tale/shared/db/retry`) decides whether to rerun an operation in place @@ -111,13 +112,15 @@ function stampedByPostgresJs(error: object): boolean { } /** One line for a log: the code, when the message does not already name - * it, then the message. */ + * it, then the message. Reads any object that carries a message — pg-boss + * re-emits an error as a plain copy of its fields (`jobs/boss.ts`). */ export function describeDatabaseError(error: unknown): string { - if (!(error instanceof Error)) return String(error); + if (error === null || typeof error !== 'object') return String(error); + const rawMessage: unknown = Reflect.get(error, 'message'); + const message = typeof rawMessage === 'string' ? rawMessage : ''; const code: unknown = Reflect.get(error, 'code'); - return typeof code === 'string' && !error.message.includes(code) - ? `${code} ${error.message}` - : error.message; + if (typeof code !== 'string' || message.includes(code)) return message; + return message === '' ? code : `${code} ${message}`; } /** diff --git a/services/platform/backend/jobs/boss.test.ts b/services/platform/backend/jobs/boss.test.ts new file mode 100644 index 0000000000..9111abb444 --- /dev/null +++ b/services/platform/backend/jobs/boss.test.ts @@ -0,0 +1,277 @@ +// @vitest-environment node + +import { + createServer, + type AddressInfo, + type Server, + type Socket, +} from 'node:net'; + +import pg from 'pg'; +import type { PgBoss, WipData } from 'pg-boss'; +import { afterEach, beforeAll, describe, expect, it, vi } from 'vitest'; + +import { createBoss } from './boss.ts'; + +/** A local server; `answer` gets each connection. */ +async function listen( + answer: (socket: Socket) => void, +): Promise<{ server: Server; port: number }> { + const server = createServer(answer); + await new Promise((resolve) => { + server.listen(0, '127.0.0.1', resolve); + }); + const { port } = server.address() as AddressInfo; + return { server, port }; +} + +/** A FATAL ErrorResponse, as PostgreSQL sends one before it hangs up. */ +function fatal(code: string, message: string): Buffer { + const fields = Buffer.concat([ + ...[ + ['S', 'FATAL'], + ['V', 'FATAL'], + ['C', code], + ['M', message], + ].map(([key, value]) => Buffer.from(`${key}${value}\0`)), + Buffer.from([0]), + ]); + const header = Buffer.alloc(5); + header.write('E', 0); + header.writeInt32BE(fields.length + 4, 1); + return Buffer.concat([header, fields]); +} + +/** What node-postgres — pg-boss's driver — rejects a connection with. */ +async function connectError(port: number): Promise { + const client = new pg.Client({ + connectionString: `postgres://tale:pw@127.0.0.1:${port}/tale`, + }); + try { + await client.connect(); + } catch (error) { + if (error instanceof Error) return error; + throw error; + } + await client.end(); + throw new Error('the connection was expected to fail'); +} + +/** + * What a pg-boss 12 worker emits for a failed poll: it appends its queue and + * id to the error's message, then re-emits a plain copy of the error's own + * fields with `queue` and `worker` beside them (`pg-boss/dist/worker.js`, + * `manager.js`). + */ +function failedPoll(error: Error, queue: string): object { + const worker = `worker-${queue}`; + return { + ...copy(error), + message: `${error.message} (Queue: ${queue}, Worker: ${worker})`, + stack: error.stack, + queue, + worker, + }; +} + +/** An error's own enumerable fields — what pg-boss's `{ ...error }` keeps: + * `code` and the rest, never the prototype or `cause`. */ +function copy(error: Error): Record { + return Object.fromEntries(Object.entries(error)); +} + +/** Emit what pg-boss emits. Its event map types the `error` event as an + * `Error`, yet a worker's failed poll arrives as a plain copy of one. */ +function emitError(boss: PgBoss, failure: object): void { + // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- pg-boss's event map calls its plain copies Error + boss.emit('error', failure as Error); +} + +/** One pg-boss worker as `getWipData` reports it. */ +function wipWorker(lastFetchedOn: number | null): WipData { + return { + id: 'worker-1', + workId: 'worker-1', + name: '__pgboss__send-it', + options: {}, + state: 'active', + count: 0, + createdOn: 0, + lastFetchedOn, + lastJobStartedOn: null, + lastJobEndedOn: null, + lastJobDuration: null, + lastError: null, + lastErrorOn: null, + }; +} + +const OUTAGE_LINE = + '[backend] pg-boss: database unavailable, polls fail quietly until one succeeds:'; + +/** What a restart says, in turn: the server is going away, it is gone, a + * connection dropped mid-handshake, it is starting up. */ +interface Restart { + shutdown: Error; + refused: Error; + hungUp: Error; + startingUp: Error; +} + +describe('createBoss error log', () => { + let restart: Restart; + let closedPort: number; + + beforeAll(async () => { + const startingUp = await listen((socket) => { + socket.once('data', () => { + socket.end(fatal('57P03', 'the database system is starting up')); + }); + }); + const hangUp = await listen((socket) => { + socket.end(); + }); + const startingUpError = await connectError(startingUp.port); + const hungUpError = await connectError(hangUp.port); + startingUp.server.close(); + hangUp.server.close(); + closedPort = hangUp.port; + const shutdown = new pg.DatabaseError( + 'terminating connection due to administrator command', + 0, + 'error', + ); + shutdown.code = '57P01'; + restart = { + shutdown, + refused: await connectError(closedPort), + hungUp: hungUpError, + startingUp: startingUpError, + }; + }); + + afterEach(() => { + vi.restoreAllMocks(); + vi.useRealTimers(); + }); + + function bossWithSpies() { + // Constructing pg-boss opens nothing; `start` would. + const boss: PgBoss = createBoss( + `postgres://tale:pw@127.0.0.1:${closedPort}/tale`, + { supervise: false }, + ); + const wip = vi.spyOn(boss, 'getWipData').mockReturnValue([]); + const warn = vi.spyOn(console, 'warn').mockImplementation(() => {}); + const error = vi.spyOn(console, 'error').mockImplementation(() => {}); + return { boss, warn, error, wip }; + } + + it('logs a restart’s burst of failed polls as one warning, then any other error in full', () => { + const { boss, warn, error } = bossWithSpies(); + + // The pool's idle clients hear the shutdown first, and pass it on as is. + emitError(boss, restart.shutdown); + // Then ten rounds of sixty queues' workers polling a database that is + // going, gone and coming back: a 20 s restart. + const kinds = [ + restart.shutdown, + restart.refused, + restart.hungUp, + restart.startingUp, + ]; + for (let round = 0; round < 10; round++) { + for (let queue = 0; queue < 60; queue++) { + const kind = kinds[(round + queue) % kinds.length] ?? restart.refused; + emitError(boss, failedPoll(kind, `queue-${queue}`)); + } + } + // The queue cache's refresh re-emits a copy with no queue. + emitError(boss, { + ...copy(restart.refused), + message: restart.refused.message, + stack: restart.refused.stack, + }); + + expect(warn).toHaveBeenCalledTimes(1); + expect(warn).toHaveBeenCalledWith( + `${OUTAGE_LINE} 57P01 terminating connection due to administrator command`, + ); + expect(error).not.toHaveBeenCalled(); + + const missingTable = new pg.DatabaseError( + 'relation "pgboss.job" does not exist', + 0, + 'error', + ); + missingTable.code = '42P01'; + const failure = failedPoll(missingTable, 'queue-0'); + emitError(boss, failure); + + expect(error).toHaveBeenCalledTimes(1); + expect(error).toHaveBeenCalledWith('[backend] pg-boss error:', failure); + expect(warn).toHaveBeenCalledTimes(1); + }); + + it('reads node-postgres’s code-less hang-up through the worker’s suffix', () => { + const { boss, warn, error } = bossWithSpies(); + + emitError(boss, failedPoll(restart.hungUp, 'queue-0')); + + expect(error).not.toHaveBeenCalled(); + expect(warn).toHaveBeenCalledWith( + `${OUTAGE_LINE} Connection terminated unexpectedly`, + ); + }); + + it('keeps logging in full what is not an unavailable database', () => { + const { boss, warn, error } = bossWithSpies(); + // A pool with no free client is capacity, and rejected credentials are + // an operator's to fix — neither is a restart. + const exhausted = failedPoll( + new Error('timeout exceeded when trying to connect'), + 'queue-0', + ); + const rejected = failedPoll( + Object.assign(new Error('password authentication failed'), { + code: '28P01', + }), + 'queue-1', + ); + + emitError(boss, exhausted); + emitError(boss, rejected); + + expect(warn).not.toHaveBeenCalled(); + expect(error.mock.calls).toEqual([ + ['[backend] pg-boss error:', exhausted], + ['[backend] pg-boss error:', rejected], + ]); + }); + + it('is re-armed once a poll succeeds, so the next outage logs again', () => { + vi.useFakeTimers({ toFake: ['Date'], now: 1_000_000 }); + const { boss, warn, wip } = bossWithSpies(); + const fail = () => { + emitError(boss, failedPoll(restart.refused, 'queue-0')); + }; + + fail(); + expect(warn).toHaveBeenCalledTimes(1); + + // Polls that last succeeded before the outage do not end it. + wip.mockReturnValue([wipWorker(null), wipWorker(999_000)]); + vi.advanceTimersByTime(30_000); + fail(); + expect(warn).toHaveBeenCalledTimes(1); + // The api role runs no queue's worker; the cron clock's is internal. + expect(wip).toHaveBeenCalledWith({ includeInternal: true }); + + // The database is back: a poll succeeds. + wip.mockReturnValue([wipWorker(Date.now())]); + vi.advanceTimersByTime(60_000); + fail(); + fail(); + expect(warn).toHaveBeenCalledTimes(2); + }); +}); diff --git a/services/platform/backend/jobs/boss.ts b/services/platform/backend/jobs/boss.ts index 59481e20ff..5f89e2ad8d 100644 --- a/services/platform/backend/jobs/boss.ts +++ b/services/platform/backend/jobs/boss.ts @@ -3,6 +3,10 @@ import type { Sql } from 'postgres'; import { appPoolMax } from '../db/sql.ts'; import { resolvePostgresConnection } from '../db/ssl.ts'; +import { + describeDatabaseError, + isDatabaseUnavailable, +} from '../db/unavailable.ts'; import { TASK_QUEUE_OPTIONS } from './tasks.ts'; /** @@ -35,15 +39,80 @@ export function createBoss( useListenNotify: true, supervise: options.supervise, }); - boss.on('error', (error) => { - console.error('[backend] pg-boss error:', error); - }); + logErrors(boss); boss.on('warning', (warning) => { console.warn('[backend] pg-boss warning:', warning); }); return boss; } +/** + * Log pg-boss's `error` event. pg-boss emits every failure of its own + * database work — each queue's worker polls every two seconds, beside the + * queue cache, the cron clock and the LISTEN connection — so a database + * restart fails them all, again and again: hundreds of full error dumps in a + * 20 s restart, burying every other line. An unavailable database + * (`db/unavailable.ts`) is therefore one warn line per outage: the first + * failure logs it, the rest stay quiet until a poll succeeds again, and that + * re-arms the line for the next outage. Any other error is logged in full. + */ +function logErrors(boss: PgBoss): void { + /** When the running outage was logged; `null` before the first one. */ + let loggedAt: number | null = null; + boss.on('error', (error) => { + const failure = withoutWorkerSuffix(error); + // Everything pg-boss emits comes from its own node-postgres pool, so a + // bare socket error is the database's. + if (!isDatabaseUnavailable(failure, { fromDatabase: true })) { + console.error('[backend] pg-boss error:', error); + return; + } + if (loggedAt !== null && !polledSince(boss, loggedAt)) return; + loggedAt = Date.now(); + console.warn( + `[backend] pg-boss: database unavailable, polls fail quietly until one succeeds: ${describeDatabaseError(failure)}`, + ); + }); +} + +/** + * Whether a pg-boss worker has fetched from the database since `since`. + * Every role has one: the cron clock's own worker counts, and it runs + * wherever pg-boss starts. + */ +function polledSince(boss: PgBoss, since: number): boolean { + return boss + .getWipData({ includeInternal: true }) + .some( + (worker) => worker.lastFetchedOn !== null && worker.lastFetchedOn > since, + ); +} + +/** + * The failure behind a pg-boss worker's error. The worker appends + * ` (Queue: , Worker: )` to the message and re-emits a plain copy + * of the error's fields with `queue` and `worker` beside them — which hides + * node-postgres's code-less `Connection terminated unexpectedly`, known by + * its exact message, from the classifier. + */ +function withoutWorkerSuffix(error: unknown): unknown { + if (error === null || typeof error !== 'object') return error; + const message: unknown = Reflect.get(error, 'message'); + const queue: unknown = Reflect.get(error, 'queue'); + const worker: unknown = Reflect.get(error, 'worker'); + if ( + typeof message !== 'string' || + typeof queue !== 'string' || + typeof worker !== 'string' + ) { + return error; + } + const suffix = ` (Queue: ${queue}, Worker: ${worker})`; + return message.endsWith(suffix) + ? { ...error, message: message.slice(0, -suffix.length) } + : error; +} + /** * Ensure every task queue exists with its declared options. Runs on every * boot (api sends, workers consume — both need the queues); racing creators diff --git a/services/platform/tests/manual/reference/automation.md b/services/platform/tests/manual/reference/automation.md index 8f7751b966..87c8d5a6fa 100644 --- a/services/platform/tests/manual/reference/automation.md +++ b/services/platform/tests/manual/reference/automation.md @@ -308,6 +308,7 @@ Legend: ✅ fully automated · 🔶 partially automated · ⛔ manual-only (no s | [performance](../suites/performance.md) | `PERF-P1`–`PERF-P4`, `PERF-P6`, `PERF-P7` | ⛔ manual-only | — (no load-timing assertions in e2e; the chat specs that proved P2/P3 functionally retired in #2857) | | [performance](../suites/performance.md) | `PERF-B4` (provider error) | ⛔ manual-only | — (the `chat-scenarios` spec retired in #2857) | | [performance](../suites/performance.md) | `PERF-B1`–`PERF-B3`, `PERF-A1`, `PERF-A2` | ⛔ manual-only | — (load characteristics / DOM attributes, not asserted) | +| [performance](../suites/performance.md) | `PERF-B6` (job queue log through a database restart) | 🔶 partial | `backend/jobs/boss.test.ts` (a restart's burst of failed pg-boss polls, built from real node-postgres refusals, is one warning; any other pg-boss error is logged in full; the warning is re-armed once a poll succeeds); what pg-boss emits during a real restart remains the box | | [projects](../suites/projects.md) | `PROJ-F1`, `PROJ-F9`, `PROJ-F12`, `PROJ-F16`, `PROJ-F19` | ✅ automated | `projects.spec.ts` (create→task in both views→backlog column→delete) | | [projects](../suites/projects.md) | `PROJ-F2`, `PROJ-F6` | ✅ automated | `projects-depth.spec.ts` (rename + instructions persist) | | [projects](../suites/projects.md) | `PROJ-F7` | ✅ automated | `projects-depth.spec.ts` (secret create then delete) | diff --git a/services/platform/tests/manual/reference/pins.md b/services/platform/tests/manual/reference/pins.md index d83fc4c03d..b109dd1e9e 100644 --- a/services/platform/tests/manual/reference/pins.md +++ b/services/platform/tests/manual/reference/pins.md @@ -39,6 +39,7 @@ time you are tempted to shorten one. | `A11Y-A12` | `FilterPanel` renders through `Popover`, whose Radix content is `role="dialog"` with no name; the panel now labels it by its visible heading (`filter-panel.test.tsx`). | | `A11Y-A3` / `MET-F3` | `DataTable`'s `onRowClick` is a bare `onClick` on a `` — pointer-only. The metrics drill-down tables (Top models/agents/voice models, feedback, automations) carry a named "Filter by {name}" button in the lead cell (`usage-metrics-page.test.tsx`); the rule is the data-table guide's. | | `PERF-B5` | A database restart — a managed upgrade recreates `db` on every release — used to exit the api process (Better Auth's node-postgres pool had no `'error'` listener, so an idle client's 57P01 was an uncaught exception), report every failed poll of the hint stream, answer every request a reported 500 and a working API key 401 (the key lookup's failure read as an invalid key). `db/unavailable.test.ts` holds the classifier, `auth.database-unavailable.test.ts` the pool listeners and the cause Better Auth swallows, `error-reporting.test.ts` / `v1.test.ts` the unreported 503, `sse.test.ts` the stream's backoff and heartbeat, `runner.test.ts` the quiet job failure; only a real restart proves them together. | +| `PERF-B6` | pg-boss emits every failure of its own database work as an `error` event — each queue's worker polls every two seconds — and `createBoss` logged each one as a full error dump: 677 events, some 11,800 log lines, in one 20 s restart (2026-09-27). The event is now one warn line per outage, re-armed once a pg-boss worker's poll succeeds; the cron clock's internal worker counts, so the api role, which runs no queue's worker, re-arms too. A worker's failure arrives as a plain copy of the error's fields with ` (Queue: …, Worker: …)` appended to its message, which hid node-postgres's code-less `Connection terminated unexpectedly` from the classifier. `jobs/boss.test.ts` holds the burst, the full log of any other error and the re-arm; only a real restart proves pg-boss still emits that shape. | | `AUTO-A3` | Same mechanism: the automations list name is a real `` to the editor (`automations-list.test.tsx`); the row click stays a pointer convenience. | | `A11Y-A8` | Table header text sat `--muted-foreground` on the `--muted` fill: 4.40:1, under AA for 14px text. `TableHead` reads `--table-header-foreground` (zinc-600, 7.03:1) — `table.test.tsx`, and the design audit's "on `--muted`" row. | | `RESP-B3` / `RESP-A2` | The account menu name was a block `

` around an inline-block box with no truncation, so an unbreakable 87-character name ran past the `w-64` menu with `text-overflow: clip`. Both lines truncate (`user-button.test.tsx`). | diff --git a/services/platform/tests/manual/suites/performance.md b/services/platform/tests/manual/suites/performance.md index 4bd004186b..95a14c06ea 100644 --- a/services/platform/tests/manual/suites/performance.md +++ b/services/platform/tests/manual/suites/performance.md @@ -1,6 +1,6 @@ # Performance (cross-cutting) -> **Prefix** `PERF-` · **Reset** none · **Cost** 17 boxes +> **Prefix** `PERF-` · **Reset** none · **Cost** 18 boxes Spot-check the load and interaction budgets — cold load to first paint, chat time-to-first-token (TTFT), thread/route switching, warm-transition prefetch, @@ -180,6 +180,13 @@ single warm sample. warnings and `/events: database back after …` rather than error stacks; with `SENTRY_DSN` set no error-level event arrives (a restart longer than about a minute sends one warning-level event). +- [ ] `PERF-B6` · **Job queue log through a database restart** — Follow + `docker compose logs -f backend-worker backend-api`, run `docker compose + restart db`, and once `db` reports healthy again, restart it a second + time. → Each restart adds exactly one `pg-boss: database unavailable, polls + fail quietly until one succeeds: …` warning per container, and no + `pg-boss error:` dump at all; the second restart adds its own line. + Afterwards jobs run again: a new chat gets its generated title. ## Accessibility (WCAG 2.1 AA)