Skip to content

Fix #1584: never re-write a mailbox row whose write completed #2983

Fix #1584: never re-write a mailbox row whose write completed

Fix #1584: never re-write a mailbox row whose write completed #2983

Workflow file for this run

name: Tests
on:
pull_request:
push:
branches: [main]
jobs:
unit:
name: Unit Tests
runs-on: ubuntu-latest
# Healthy runs finish in ~2-3 min; bound well above that so a stall fails
# visibly instead of pending for GitHub's 6-hour default (see #1502).
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build sdk package
working-directory: packages/sdk
run: pnpm build
- name: Build core package
working-directory: packages/core
run: pnpm build
- name: Build types package
working-directory: packages/types
run: pnpm build
# The wire-contract guards under packages/types/type-tests/ live outside src/ so they
# are never published, which also means `pnpm build` above does not check them. They are
# compile-time-only tests (the package has no test runner), so this step is the only
# thing that makes them able to fail a build.
- name: Type-check types package contracts
working-directory: packages/types
run: pnpm check-types:tests
- name: Build artifact-canvas package (+ build-smoke)
working-directory: packages/artifact-canvas
run: pnpm build && pnpm build:smoke
- name: Run sdk unit tests
working-directory: packages/sdk
run: pnpm test
- name: Run core unit tests
working-directory: packages/core
run: pnpm test
- name: Run artifact-canvas unit tests
working-directory: packages/artifact-canvas
run: pnpm test
- name: Copy skeleton for unit tests
working-directory: packages/codev
run: pnpm copy-skeleton
- name: Run unit tests with coverage
working-directory: packages/codev
run: |
# Enable pipefail so a vitest failure is not masked by tee's exit code.
# (GitHub Actions' default Linux shell is `bash -e {0}` without pipefail,
# so without this line the pipeline exits with tee's status — always 0 —
# and failing tests silently pass CI.)
set -o pipefail
# Vitest forks pool has a known issue where the worker process crashes
# during cleanup after all tests pass (native module teardown).
# Capture the output and check if all test files passed.
pnpm exec vitest run --coverage 2>&1 | tee /tmp/vitest-output.txt; VITEST_EXIT=$?
if [ $VITEST_EXIT -ne 0 ]; then
# Check if all test files actually passed despite the exit code
if grep -q "Test Files.*passed" /tmp/vitest-output.txt && ! grep -q "failed" /tmp/vitest-output.txt; then
echo "::warning::Vitest worker crashed during cleanup but all tests passed"
else
exit $VITEST_EXIT
fi
fi
- name: Run web unit tests
working-directory: apps/web
run: pnpm test
- name: Type-check vscode extension
working-directory: apps/vscode
run: pnpm check-types
- name: Run vscode unit tests
working-directory: apps/vscode
run: pnpm test:unit
# Streamdeck check-types resolves the sdk's dist .d.ts — the "Build sdk
# package" step above must stay ahead of these.
- name: Type-check streamdeck plugin
working-directory: apps/streamdeck
run: pnpm check-types
- name: Run streamdeck unit tests
working-directory: apps/streamdeck
run: pnpm test
- name: Build + validate streamdeck plugin
working-directory: apps/streamdeck
run: pnpm build && pnpm validate
canvas-browser:
name: Artifact-Canvas Browser Tests
runs-on: ubuntu-latest
# Backstop for #1502. The stall's root cause is removed below (see the install
# step), but every job stays bounded regardless: an unbounded job conceals its
# own failure, which is #1502's real lesson. Healthy runs finish in ~4 min.
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
# Root cause of #1502: `--with-deps` runs `apt-get update` to install Chromium's
# system libraries, and that apt index fetch intermittently stalls indefinitely
# (the fast azure.archive.ubuntu.com mirror is Ign-ored, and apt has no network
# timeout on the fallback to archive.ubuntu.com). Those libraries are already
# present on the ubuntu-latest image: the sibling dashboard-e2e workflow installs
# Chromium the same way without `--with-deps` and launches it successfully on
# every scheduled run. Dropping the flag removes the stalling apt phase entirely.
- name: Install Playwright Chromium
working-directory: packages/artifact-canvas
run: pnpm exec playwright install chromium
# Real-browser fragmentation regression suite (spec 1380): jsdom cannot express CSS
# multi-column fragmentation, so the spike-derived invariants run against Chromium here.
- name: Run artifact-canvas browser tests
working-directory: packages/artifact-canvas
run: pnpm test:browser
integration:
name: Tower Integration Tests
runs-on: ubuntu-latest
# Healthy runs finish in ~2 min; bound above that so a stall fails visibly (#1502).
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build sdk package
working-directory: packages/sdk
run: pnpm build
- name: Build core package
working-directory: packages/core
run: pnpm build
- name: Build package
working-directory: packages/codev
run: pnpm build
- name: Run tower integration tests
working-directory: packages/codev
run: pnpm exec vitest run --config vitest.e2e.config.ts --exclude 'src/commands/porch/__tests__/e2e/**'
cli:
name: CLI Integration Tests
runs-on: ubuntu-latest
# Healthy runs finish in ~1 min; bound above that so a stall fails visibly (#1502).
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build sdk package
working-directory: packages/sdk
run: pnpm build
- name: Build core package
working-directory: packages/core
run: pnpm build
- name: Build package
working-directory: packages/codev
run: pnpm build
- name: Run CLI integration tests
working-directory: packages/codev
run: pnpm exec vitest run --config vitest.cli.config.ts
package:
name: Package Install Verification
runs-on: ubuntu-latest
# Healthy runs finish in ~2 min; bound above that so a stall fails visibly (#1502).
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build sdk package
working-directory: packages/sdk
run: pnpm build
- name: Build core package
working-directory: packages/core
run: pnpm build
# codev-types is a runtime dependency of codev (server-utils imports its
# wire constants at module load), so the install-verification install must
# include its tarball too — else `afx --help` crashes at boot with
# "Cannot find module '@cluesmith/codev-types'".
- name: Build types package
working-directory: packages/types
run: pnpm build
- name: Build package
working-directory: packages/codev
run: pnpm build
- name: Pack core tarball
working-directory: packages/core
run: pnpm pack
- name: Pack sdk tarball
working-directory: packages/sdk
run: pnpm pack
- name: Pack types tarball
working-directory: packages/types
run: pnpm pack
- name: Pack tarball
working-directory: packages/codev
run: pnpm pack
- name: Verify install from tarball
working-directory: packages/codev
run: node scripts/verify-install.mjs cluesmith-codev-*.tgz ../core/cluesmith-codev-core-*.tgz ../sdk/cluesmith-codev-sdk-*.tgz ../types/cluesmith-codev-types-*.tgz