@steve31415/baselib 3.64.0 → 3.64.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,6 @@
1
1
  import type { Runner } from './types.js';
2
+ /** A gate's output shows its test browser process crashed (e.g. a segfault). */
3
+ export declare function testBrowserCrashed(output: string): boolean;
2
4
  export interface DeployOptions {
3
5
  repoRoot: string;
4
6
  runner: Runner;
@@ -16,6 +16,12 @@ import { consistentBaseSha, readServingState, SHA40 } from './plan.js';
16
16
  import { writeDeployMarker } from './deploy-marker.js';
17
17
  const RELEASE_DEADLINE_MS = 25 * 60_000;
18
18
  const IMAGE_DIGEST = /@sha256:[0-9a-f]{64}$/;
19
+ /** Chromium's crash-handler line as Playwright relays a browser's stderr. */
20
+ const BROWSER_CRASH = /^\s*\[pid=\d+\]\[err\] Received signal \d+ /m;
21
+ /** A gate's output shows its test browser process crashed (e.g. a segfault). */
22
+ export function testBrowserCrashed(output) {
23
+ return BROWSER_CRASH.test(output);
24
+ }
19
25
  const MAX_DIRTY_PATHS = 20;
20
26
  /** The clean-worktree refusal, naming what made the tree dirty (`git status
21
27
  * --porcelain` lines) so the reader need not go and look (2026-10-11: games'
@@ -216,11 +222,24 @@ export async function runDeploy(options) {
216
222
  if (!skipGates) {
217
223
  for (const [index, gate] of config.gates.entries()) {
218
224
  const gateStart = Date.now();
219
- const result = await runner('bash', ['-c', gate], {
225
+ const runGate = () => runner('bash', ['-c', gate], {
220
226
  cwd: options.repoRoot,
221
227
  timeoutMs: 15 * 60_000,
222
228
  });
229
+ let result = await runGate();
223
230
  await evidence.save(`gate-${index}.log`, result.stdout + result.stderr);
231
+ if (result.code !== 0 && testBrowserCrashed(result.stdout + result.stderr)) {
232
+ // The test browser itself segfaulted (Chromium's crash handler line,
233
+ // relayed by Playwright), which no app code under test causes or a
234
+ // code fix repairs: rerun the gate once. Any other failure still
235
+ // fails at once (TESTING.md "no retries, flakes must surface"), and
236
+ // the rerun must pass in full. Notes lost three deploys to one
237
+ // headless-shell crash in browser.newContext (2026-10-31, and twice
238
+ // on 2026-11-16, Coder tasks 7632cdaa and a0f43dda).
239
+ log(`gate failed because the test browser crashed (evidence gate-${index}.log); rerunning once: ${gate}`);
240
+ result = await runGate();
241
+ await evidence.save(`gate-${index}-rerun.log`, result.stdout + result.stderr);
242
+ }
224
243
  timer.record(`gate:${gate}`, Date.now() - gateStart);
225
244
  if (result.code !== 0) {
226
245
  // Quote the tail of BOTH streams: test runners put the failing spec on
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steve31415/baselib",
3
- "version": "3.64.0",
3
+ "version": "3.64.1",
4
4
  "description": "Plasticine new-world shared platform library: logging, auth, service-to-service auth, db, HTTP, sync, app updates",
5
5
  "type": "module",
6
6
  "license": "MIT",