Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
fix(ci): share required browser regressions with releases
tt-a1i39d66d9bd2ad
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 368c2888..5fbc1e40 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -45,41 +45,11 @@ jobs:working-directory: archifyenv:ARCHIFY_CHROME: ${{ steps.setup-chrome.outputs.chrome-path }}- - name: Verify packaged examples and Reader Layout boundaries in a real browser- run: node --test test/desktop-reader-browser.test.mjs test/reader-layout-browser.test.mjs- working-directory: archify- env:- ARCHIFY_CHROME: ${{ steps.setup-chrome.outputs.chrome-path }}- ARCHIFY_CHROME_NO_SANDBOX: '1'- - name: Verify SVG export cleanup and live state isolation- run: node --test test/export-cleanup-browser.test.mjs- working-directory: archify- env:- ARCHIFY_CHROME: ${{ steps.setup-chrome.outputs.chrome-path }}- ARCHIFY_CHROME_NO_SANDBOX: '1'- - name: Install offline font test parser+ - name: Install browser test dependenciesrun: npm ci --ignore-scripts --no-audit --no-fundworking-directory: archify- - name: Verify offline fonts and independent SVG/raster exports- run: node --test test/offline-font-browser.test.mjs- working-directory: archify- env:- ARCHIFY_CHROME: ${{ steps.setup-chrome.outputs.chrome-path }}- ARCHIFY_CHROME_NO_SANDBOX: '1'- - name: Verify all five diagram modes localize Viewer interactions- run: node --test test/i18n.test.mjs- working-directory: archify- env:- ARCHIFY_CHROME: ${{ steps.setup-chrome.outputs.chrome-path }}- ARCHIFY_CHROME_NO_SANDBOX: '1'- - name: Verify Semantic Radar collision and drag behavior- run: node --test test/semantic-radar.test.mjs- working-directory: archify- env:- ARCHIFY_CHROME: ${{ steps.setup-chrome.outputs.chrome-path }}- ARCHIFY_CHROME_NO_SANDBOX: '1'- - name: Verify Viewer chrome, camera, motion and input interactions- run: node --test --test-concurrency=2 test/viewer-chrome-layout.test.mjs test/viewer-camera-browser.test.mjs test/motion-governor-browser.test.mjs test/finder-browser.test.mjs test/intent-trace-browser.test.mjs test/semantic-lens-browser.test.mjs test/route-probe-browser.test.mjs test/guided-views-browser.test.mjs test/focus-browser.test.mjs test/export-browser.test.mjs test/viewer-identifiers-browser.test.mjs+ - name: Run shared browser regression gate+ run: npm run test:browserworking-directory: archifyenv:ARCHIFY_CHROME: ${{ steps.setup-chrome.outputs.chrome-path }}diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 4733a40d..f1adbcde 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -39,6 +39,12 @@ jobs:working-directory: archifyenv:ARCHIFY_CHROME: ${{ steps.setup-chrome.outputs.chrome-path }}+ - name: Run shared browser regression gate+ run: npm run test:browser+ working-directory: archify+ env:+ ARCHIFY_CHROME: ${{ steps.setup-chrome.outputs.chrome-path }}+ ARCHIFY_CHROME_NO_SANDBOX: '1'- name: Tag must match package.json versionrun: |pkg_version="$(node -p "require('./archify/package.json').version")"diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 84585f71..c8225470 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -73,6 +73,19 @@ ARCHIFY_CHROME="/path/to/chrome" node --test test/desktop-reader-browser.test.mjA browser test skipped because Chrome was unavailable is **skipped**, not passed. Follow [the delivery contract](archify/references/delivery-contract.md) for visual evidence, receipts, and failure stages. Successful validation, atomic delivery, browser checks, and perceptual review establish different claims.+PR CI and tag releases run the same browser regression gate:++```sh+cd archify+ARCHIFY_CHROME="/path/to/chrome" npm run test:browser+```++This command requires a usable Chrome/Chromium and fails when none is available.+Its maintained file list is in `scripts/run-browser-tests.mjs`; add new browser+suites there so both workflows keep the same coverage. Ordinary `npm test`+retains optional browser skips. Real WebM decoding and site-language integration+remain in the separate `npm run test:webm` gate used by both workflows.+## Packages and generated artifactsViewer maintenance starts in [`viewer/`](viewer/README.md). Edit its sourcediff --git a/archify/package.json b/archify/package.jsonindex f88fef4b..992121cc 100644--- a/archify/package.json+++ b/archify/package.json@@ -24,6 +24,7 @@"build:start": "node ../scripts/build-start.mjs ../docs/start.html","build:readme-showcase": "node ../scripts/build-readme-showcase.mjs","test:webm": "node test/webm-artifact.smoke.mjs && node --test test/site-language-integration.mjs",+ "test:browser": "node ../scripts/run-browser-tests.mjs","test": "npm run check:viewer && npm run check:brand-marks && npm run check:validators && npm run check:release-identity && node test/golden.mjs && node ../scripts/run-tests.mjs","render:examples": "node scripts/render-examples.mjs ../examples"},diff --git a/archify/test/browser-gate.test.mjs b/archify/test/browser-gate.test.mjsnew file mode 100644index 00000000..1d121306--- /dev/null+++ b/archify/test/browser-gate.test.mjs@@ -0,0 +1,86 @@+import test from 'node:test';+import assert from 'node:assert/strict';+import { spawnSync } from 'node:child_process';+import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { fileURLToPath } from 'node:url';++const skillRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');+const repoRoot = path.dirname(skillRoot);+const runner = path.join(repoRoot, 'scripts/run-browser-tests.mjs');++test('browser gate rejects an unavailable explicit browser instead of skipping', (t) => {+ const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-browser-gate-'));+ t.after(() => fs.rmSync(directory, { recursive: true, force: true }));+ for (const chrome of ['', path.join(directory, 'missing-chrome')]) {+ const result = spawnSync(process.execPath, [runner], {+ encoding: 'utf8', env: { ...process.env, ARCHIFY_CHROME: chrome },+ });+ assert.equal(result.status, 1, result.stdout || result.stderr);+ assert.match(result.stderr, /require an executable Chrome\/Chromium/);+ assert.doesNotMatch(result.stdout, /# SKIP/);+ }+});++// Observe the public runner's child invocation without starting real browsers+// in the ordinary Node matrix. The explicit browser gate supplies real coverage.+function interceptedRun(t, outcome) {+ const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-browser-gate-'));+ t.after(() => fs.rmSync(directory, { recursive: true, force: true }));+ const preload = path.join(directory, 'capture-runner.cjs');+ fs.writeFileSync(preload, `+const childProcess = require('node:child_process');+childProcess.spawnSync = (command, args, options) => {+ console.log(JSON.stringify({ command, args, cwd: options.cwd, chrome: options.env.ARCHIFY_CHROME }));+ return ${JSON.stringify(outcome)};+};+require('node:module').syncBuiltinESMExports();+`);+ return spawnSync(process.execPath, ['--require', preload, runner], {+ cwd: directory,+ encoding: 'utf8',+ env: { ...process.env, ARCHIFY_CHROME: process.execPath },+ });+}++test('browser gate includes dedicated and mixed browser suites and enables them', (t) => {+ const result = interceptedRun(t, { status: 0, signal: null });+ assert.equal(result.status, 0, result.stderr);+ const call = JSON.parse(result.stdout);+ assert.equal(call.command, process.execPath);+ assert.equal(fs.realpathSync(call.cwd), fs.realpathSync(skillRoot));+ assert.equal(call.chrome, process.execPath);+ assert.ok(call.args.includes('--test'));+ const files = call.args.filter((arg) => !arg.startsWith('--'));+ assert.equal(new Set(files).size, files.length);+ for (const file of files) assert.ok(fs.existsSync(path.join(skillRoot, file)), file);+ const required = [+ ...fs.readdirSync(path.join(skillRoot, 'test')).filter((file) => file.endsWith('-browser.test.mjs')),+ 'repository-evidence.test.mjs', 'i18n.test.mjs', 'semantic-radar.test.mjs', 'viewer-chrome-layout.test.mjs',+ ];+ for (const file of required) assert.ok(files.includes(path.join('test', file)), `${file} must run in the browser gate`);+});++for (const outcome of [{ status: 7, signal: null }, { status: null, signal: 'SIGTERM' }]) {+ test(`browser gate propagates child failure (${outcome.signal || outcome.status})`, (t) => {+ const result = interceptedRun(t, outcome);+ assert.equal(result.status, outcome.status ?? 1);+ if (outcome.signal) assert.match(result.stderr, /terminated by SIGTERM/);+ });+}++test('CI and release use the same browser command and retain WebM decoding', () => {+ const manifest = JSON.parse(fs.readFileSync(path.join(skillRoot, 'package.json'), 'utf8'));+ assert.equal(manifest.scripts['test:browser'], 'node ../scripts/run-browser-tests.mjs');+ for (const workflow of ['ci.yml', 'release.yml']) {+ const source = fs.readFileSync(path.join(repoRoot, '.github/workflows', workflow), 'utf8');+ const gate = source.match(/ {6}- name: Run shared browser regression gate\n([\s\S]*?)(?=\n {6}- name:|\n {2}[\w-]+:|$)/)?.[1];+ assert.ok(gate, `${workflow} must invoke the shared gate`);+ assert.match(gate, /run: npm run test:browser\n/);+ assert.match(gate, /working-directory: archify/);+ assert.match(gate, /ARCHIFY_CHROME: \$\{\{ steps\.setup-chrome\.outputs\.chrome-path \}\}/);+ assert.match(source, /run: npm run test:webm/);+ assert.doesNotMatch(source, /run: node --test[^\n]*test\/.*browser/);+ }+});diff --git a/scripts/run-browser-tests.mjs b/scripts/run-browser-tests.mjsnew file mode 100644index 00000000..ef31623f--- /dev/null+++ b/scripts/run-browser-tests.mjs@@ -0,0 +1,48 @@+#!/usr/bin/env node++import { spawnSync } from 'node:child_process';+import path from 'node:path';+import { fileURLToPath } from 'node:url';+import { findChrome } from '../archify/bin/visual-check.mjs';++const skillRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'archify');+// Shared by PR CI and tag releases. WebM decoding stays in test:webm.+const testFiles = [+ 'desktop-reader-browser.test.mjs',+ 'reader-layout-browser.test.mjs',+ 'export-cleanup-browser.test.mjs',+ 'offline-font-browser.test.mjs',+ 'i18n.test.mjs',+ 'semantic-radar.test.mjs',+ 'viewer-chrome-layout.test.mjs',+ 'viewer-camera-browser.test.mjs',+ 'motion-governor-browser.test.mjs',+ 'finder-browser.test.mjs',+ 'intent-trace-browser.test.mjs',+ 'semantic-lens-browser.test.mjs',+ 'route-probe-browser.test.mjs',+ 'guided-views-browser.test.mjs',+ 'focus-browser.test.mjs',+ 'export-browser.test.mjs',+ 'viewer-identifiers-browser.test.mjs',+ 'repository-evidence.test.mjs',+];++const chrome = findChrome();+if (!chrome) {+ console.error('Browser tests require an executable Chrome/Chromium. Set ARCHIFY_CHROME to its path; this gate cannot skip browser coverage.');+ process.exit(1);+}++const args = ['--test'];+const [major, minor] = process.versions.node.split('.').map(Number);+if (major > 18 || (major === 18 && minor >= 19)) args.push('--test-concurrency=2');+args.push(...testFiles.map((file) => path.join('test', file)));+const result = spawnSync(process.execPath, args, {+ cwd: skillRoot,+ env: { ...process.env, ARCHIFY_CHROME: chrome },+ stdio: 'inherit',+});+if (result.error) throw result.error;+if (result.signal) console.error(`browser test runner terminated by ${result.signal}`);+process.exitCode = result.status ?? 1;