The editor reported nothing when a session died. Evidence lived only in-tab —
an 800-line React array behind a "Show console" button — so diagnosis meant
asking a user to paste a screenshot.
Better Stack's Error Tracking ingests the Sentry wire protocol, so this runs
the stock @sentry/browser against a Better Stack DSN. Sentry.init installs its
own window error/unhandledrejection handlers, so uncaught main-thread errors
and the wasm traps that escape emscripten's DOM event handlers are captured
with no instrumentation at the throw sites. Not their JS tag: it has no
beforeSend or fingerprint hooks, its runtime spawns workers from cross-origin
CDN hosts (this page is COEP: require-corp), and it ships session replay on by
default — which on a CAD canvas records customers' board geometry.
@sentry/browser is imported in exactly one file so the vendor stays swappable,
mirroring how lib/analytics.ts isolates Plausible.
Also replaces the terminal-signature regex with a shared, unit-tested predicate
(wasm/terminal-error.ts) used by BOTH the fatal overlay and the reporter, so
they cannot disagree. The regex was a type check written as a string match and
had three live holes: `RuntimeError` was listed but never appears IN
`.message`; Chrome's bare "unreachable" and "null function" matched nothing
(the v0.1.20 prod log is exactly those); and narrowing "table index is out of
bounds" to `\bindex out of bounds` for Firefox in 197f317 silently stopped
matching Chrome's spelling. Checking the TYPE — every trap in this family is a
WebAssembly.RuntimeError — covers all engines and ends the spelling chase; the
message patterns remain as a fallback for paths that lose the Error object,
such as a worker ErrorEvent crossing the realm boundary with error: null.
197f317's pthread-worker tap, promote() and Firefox findings are kept as-is.
Notes:
- Off unless VITE_ERRORS_DSN is set AND VITE_ALLOW_USER_OVERRIDE !== "1" (dev
servers and every Playwright harness set the latter, and production builds
never do), so a production DSN in a local .env still cannot report. With no
DSN the whole SDK is const-folded out: 1,193,080 vs 1,282,463 bytes of JS.
- browserApiErrors integration removed. It wraps setTimeout/rAF/addEventListener
in try/catch, which is exactly how KiCad-on-Emscripten drives its main loop.
- Console breadcrumbs off (collab/debug.ts's clog fires per Yjs update and would
evict the ring before any crash); dom/fetch/navigation breadcrumbs kept.
- beforeSend redacts token/apiKey/Bearer — collab/provider.ts puts the collab
token in the y-partyserver URL, so a connection-failure string carries a live
credential — and guards the cascade: one wedge produced 8 errors in prod, and
after the first terminal event the rest are dropped into cascade_count.
Verified end to end against the real EU host from a cross-origin-isolated page:
POST /api/<id>/envelope/ -> 200, and 4 terminal throws produce 1 event
(control: 1 throw, same count).
Privacy policy 9, cookie policy 6 and the licenses page are updated: Better
Stack is disclosed as an EU processor, and the licenses page now describes the
browser app's own JS dependencies, which it never did.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
207 lines
8.4 KiB
YAML
207 lines
8.4 KiB
YAML
name: release
|
|
|
|
# Release pipeline on a vX.Y.Z tag, in order:
|
|
# 1) build — the SAME wasm-build.yml recipe as CI, at the SAME -O1 asyncify tail
|
|
# + run the e2e gate. Because the opt level now matches main, this
|
|
# FINAL-cache-hits main's build and skips the asyncify tail rebuild.
|
|
# Uploads output/.
|
|
# 2) publish-wasm — push the build to the CDN (content-addressed, idempotent)
|
|
# and write manifest-<tag>.json. The registry now reflects THIS tag.
|
|
# 3) deploy-demo — build the standalone pinned to that manifest + deploy to
|
|
# demo.pcbjam.com. So the demo can never point at stale wasm.
|
|
#
|
|
# Libraries are NOT published here (they change only on a KiCad lib-version bump):
|
|
# run publish-libs.yml once per LIB_TAG; this deploy just points the demo at
|
|
# libs/kicad/$LIB_TAG. WASM publishing is folded in here (no separate manual
|
|
# workflow), so the build that ships is exactly the build that was tested.
|
|
|
|
on:
|
|
push:
|
|
tags: ["v*"]
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "Release tag to build + deploy, e.g. v1.2.3"
|
|
required: true
|
|
|
|
concurrency:
|
|
group: release
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
CDN: https://cdn.pcbjam.com
|
|
BUCKET: pcbjam-cdn
|
|
# KiCad library snapshot the demo points at (published by publish-libs.yml).
|
|
LIB_TAG: "10.0.3"
|
|
# kicad-packages3D snapshot the demo's lazy 3D models point at (published once
|
|
# to libs/kicad-models/<MODELS_TAG>/ — see scripts/deploy/publish-models.ts +
|
|
# upload-models-r2.sh; docs/features/3d-models). Empty ⇒ 3D models off.
|
|
# Keep in sync with deploy-demo.yml.
|
|
MODELS_TAG: "10.0.3"
|
|
PAGES_PROJECT: pcbjam-demo
|
|
PAGES_PROD_BRANCH: production
|
|
# Backed editor deployment (remote mode against the closed API). The closed
|
|
# stack (api./app.pcbjam.com) deploys from the pcbjam-private repo; release
|
|
# order when both change: pcbjam-private first, then this repo.
|
|
EDITOR_PAGES_PROJECT: pcbjam-editor
|
|
EDITOR_API_BASE: https://api.pcbjam.com
|
|
# Mgmt app origin: non-editor routes on the editor host redirect here
|
|
# (standalone-hardening 0006). The demo build never sets this.
|
|
EDITOR_APP_BASE: https://app.pcbjam.com
|
|
# Better Stack error-tracking DSN (Sentry wire format). Unset ⇒ builds report
|
|
# nothing, so this is safe to leave empty. Held as a secret rather than a
|
|
# literal: this repo is public, and although the token becomes visible in the
|
|
# shipped bundle anyway, keeping it out of git makes it rotatable without a
|
|
# commit. Keep in sync with deploy-demo.yml.
|
|
ERRORS_DSN: ${{ secrets.ERRORS_DSN }}
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
WRANGLER_CMD: npx --yes wrangler@4
|
|
|
|
jobs:
|
|
meta:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
tag: ${{ steps.tag.outputs.tag }}
|
|
steps:
|
|
# On workflow_dispatch GITHUB_REF_NAME is the branch, so prefer the input;
|
|
# on a tag push the input is empty and ref_name is the tag.
|
|
- id: tag
|
|
run: echo "tag=${{ github.event.inputs.tag || github.ref_name }}" >> "$GITHUB_OUTPUT"
|
|
|
|
# 1) Build (-O1, identical to main) + e2e gate. Reuses main's FINAL cache (same
|
|
# opt level) so the asyncify tail isn't rebuilt. Uploads the publishable
|
|
# output/ as the 'wasm-output' artifact for the publish job.
|
|
build:
|
|
uses: ./.github/workflows/wasm-build.yml
|
|
with:
|
|
opt_level: "-O1"
|
|
build_3d_viewer: "ON"
|
|
run_tests: true
|
|
upload_output: true
|
|
|
|
# 2) Publish the build to the CDN (content-addressed; unchanged tools reuse)
|
|
# and write manifest-<tag>.json. The slow step is brotli-q11 over ~300MB of
|
|
# wasm; the script compresses all files in parallel (one core per file), so
|
|
# give it enough cores that wall time ≈ the largest single file.
|
|
publish-wasm:
|
|
needs: [meta, build]
|
|
runs-on: ubicloud-standard-8
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: false
|
|
- name: Init pcbjam-shared submodule
|
|
run: git submodule update --init --depth 1 web/pcbjam-shared
|
|
- uses: actions/setup-node@v4
|
|
with: { node-version: 20 }
|
|
- name: Download WASM output
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: wasm-output
|
|
path: output
|
|
- name: Publish WASM to CDN
|
|
run: >
|
|
node scripts/deploy/publish-wasm.mjs --tag "${{ needs.meta.outputs.tag }}"
|
|
--src output --driver r2 --bucket "$BUCKET" --remote --compress br --quality 11
|
|
|
|
# 3) Build the standalone pinned to this tag's manifest + libs, deploy to Pages.
|
|
deploy-demo:
|
|
needs: [meta, publish-wasm]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: false
|
|
- name: Init pcbjam-shared submodule
|
|
run: git submodule update --init --depth 1 web/pcbjam-shared
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10.33.0
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: pnpm
|
|
cache-dependency-path: web/pnpm-lock.yaml
|
|
- name: Install standalone workspace
|
|
run: pnpm --dir web install --frozen-lockfile
|
|
|
|
# Read-only example gallery (tiny; content/<tag>/).
|
|
- name: Publish content gallery
|
|
run: >
|
|
node scripts/deploy/publish-content.mjs --tag "${{ needs.meta.outputs.tag }}"
|
|
--gallery deploy/demo/gallery.json --driver r2 --bucket "$BUCKET" --remote
|
|
|
|
# Standalone pinned to the CDN + this tag's manifest-<tag>.json (written by
|
|
# publish-wasm above) + the full library set at libs/kicad/$LIB_TAG.
|
|
- name: Build demo
|
|
# Plausible: the shared pa- script covering all pcbjam properties
|
|
# (one dashboard, segment by hostname).
|
|
run: >
|
|
node scripts/deploy/build-demo.mjs --tag "${{ needs.meta.outputs.tag }}"
|
|
--cdn "$CDN" --lib-tag "$LIB_TAG"
|
|
${MODELS_TAG:+--models-tag "$MODELS_TAG"}
|
|
--plausible "https://plausible.io/js/pa-KjNS9YmidydULZTstsjRg.js"
|
|
${ERRORS_DSN:+--errors-dsn "$ERRORS_DSN" --errors-env demo}
|
|
|
|
- name: Ensure Pages project exists
|
|
run: >
|
|
npx --yes wrangler@4 pages project create "$PAGES_PROJECT"
|
|
--production-branch "$PAGES_PROD_BRANCH"
|
|
|| echo "pages project create skipped (already exists)"
|
|
|
|
- name: Deploy to Cloudflare Pages
|
|
run: >
|
|
npx --yes wrangler@4 pages deploy web/standalone/dist
|
|
--project-name "$PAGES_PROJECT"
|
|
--branch "$PAGES_PROD_BRANCH"
|
|
--commit-dirty=true
|
|
|
|
# 4) Backed editor (editor.pcbjam.com): the SAME standalone, built in remote
|
|
# mode against the closed API (pcbjam-private's api.pcbjam.com) instead of
|
|
# the static gallery. Reuses this tag's CDN WASM manifest — no extra WASM
|
|
# work. Runs in parallel with deploy-demo (separate runner, own dist/).
|
|
deploy-editor:
|
|
needs: [meta, publish-wasm]
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
RELEASE_TAG: ${{ needs.meta.outputs.tag }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: false
|
|
- name: Init pcbjam-shared submodule
|
|
run: git submodule update --init --depth 1 web/pcbjam-shared
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10.33.0
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: pnpm
|
|
cache-dependency-path: web/pnpm-lock.yaml
|
|
- name: Install standalone workspace
|
|
run: pnpm --dir web install --frozen-lockfile
|
|
|
|
# --plausible: the shared pa- script covering all pcbjam properties
|
|
# (one dashboard, segment by hostname).
|
|
- name: Build editor (remote mode)
|
|
run: >
|
|
node scripts/deploy/build-editor.mjs --tag "$RELEASE_TAG"
|
|
--cdn "$CDN" --api-base "$EDITOR_API_BASE" --app-base "$EDITOR_APP_BASE"
|
|
--plausible "https://plausible.io/js/pa-KjNS9YmidydULZTstsjRg.js"
|
|
${ERRORS_DSN:+--errors-dsn "$ERRORS_DSN" --errors-env production}
|
|
${MODELS_TAG:+--models-tag "$MODELS_TAG"}
|
|
|
|
- name: Ensure Pages project exists
|
|
run: >
|
|
npx --yes wrangler@4 pages project create "$EDITOR_PAGES_PROJECT"
|
|
--production-branch "$PAGES_PROD_BRANCH"
|
|
|| echo "pages project create skipped (already exists)"
|
|
|
|
- name: Deploy to Cloudflare Pages
|
|
run: >
|
|
npx --yes wrangler@4 pages deploy web/standalone/dist
|
|
--project-name "$EDITOR_PAGES_PROJECT"
|
|
--branch "$PAGES_PROD_BRANCH"
|
|
--commit-dirty=true
|