From f7928893526619a4774f7707e01c989c1e7b02ba Mon Sep 17 00:00:00 2001 From: Nico Hinderling Date: Tue, 26 May 2026 15:06:09 -0700 Subject: [PATCH] feat(snapshots): Add Docker-based snapshot generation for CI parity Snapshot generation on macOS produces ~314/400 false positives when diffed against CI output due to CoreText vs FreeType font rendering differences. This script runs `pnpm run snapshots` inside the same Playwright Docker image (Ubuntu 24.04) that CI uses, eliminating cross-platform rendering discrepancies. Uses a Docker named volume to cache node_modules between runs. Co-Authored-By: Claude --- .gitignore | 4 ++++ bin/run-snapshots-docker | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 bin/run-snapshots-docker diff --git a/.gitignore b/.gitignore index 9c1be6480cf3d8..c29507b9472747 100644 --- a/.gitignore +++ b/.gitignore @@ -95,3 +95,7 @@ agents.lock .agents/skills/warden/ .agents/skills/warden-sweep/ # end +diff-output/ +.pnpm-store/ +snapshots-head/ +snapshots-base/ diff --git a/bin/run-snapshots-docker b/bin/run-snapshots-docker new file mode 100755 index 00000000000000..50ca0763bb4e36 --- /dev/null +++ b/bin/run-snapshots-docker @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" +IMAGE="mcr.microsoft.com/playwright:v1.58.2-noble" +VOLUME_NAME="sentry-snapshots-node-modules" +OUTPUT_DIR=".artifacts/snapshots" + +mkdir -p "$REPO_ROOT/$OUTPUT_DIR" + +echo "Running snapshots in Docker (Ubuntu 24.04, matching CI)..." +echo "Output: $REPO_ROOT/$OUTPUT_DIR" + +if ! docker volume inspect "$VOLUME_NAME" &>/dev/null; then + echo "First run — installing node_modules (cached for subsequent runs)." +fi + +docker run --rm \ + --ipc=host \ + -v "$REPO_ROOT:/work" \ + -v "$VOLUME_NAME:/work/node_modules" \ + -w /work \ + -e NODE_OPTIONS='--max-old-space-size=4096' \ + -e SNAPSHOT_OUTPUT_DIR="$OUTPUT_DIR" \ + "$IMAGE" \ + bash -c ' + corepack enable && corepack prepare pnpm@10.30.2 --activate + pnpm install --frozen-lockfile --store-dir /work/node_modules/.pnpm-store + pnpm run snapshots + '