diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57ba37f2..0e1f1911 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,73 @@ jobs: steps: - uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 + # The request tests also write the MCP tools' and REST API's answers as JSON snapshots, for the visual job. - run: cargo test --locked --workspace + env: + VISUALCI_JSON_SNAPSHOTS: ${{ github.workspace }}/tmp/json-snapshots + - uses: actions/upload-artifact@v4 + with: + name: json-snapshots + path: tmp/json-snapshots + if-no-files-found: error + retention-days: 7 + + # VisualCI tests itself: screenshots of the landing page, docs and app (against seeded data), Vitest component + # snapshots and the JSON snapshots from `test`, sent as one build to the docspring/visualci project. A changed + # snapshot doesn't fail this job: the GitHub check waits for review. Pull requests from forks have no token and skip + # the upload. + visual: + needs: [test] + runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }} + timeout-minutes: 30 + services: + postgres: + image: postgres:17 + env: + POSTGRES_USER: loco + POSTGRES_PASSWORD: loco + POSTGRES_DB: visualci_screenshots + ports: ["55433:5432"] + options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 10 + env: + VISUALCI_TOKEN: ${{ secrets.VISUALCI_TOKEN }} + VISUAL_JSON_DIR: ${{ github.workspace }}/tmp/json-snapshots + steps: + - uses: actions/checkout@v4 + with: + # The CLI sends parent commits, so the build finds its baseline. + fetch-depth: 101 + # S3 storage for the seeded blobs: RustFS (Apache-2.0), since MinIO's images are no longer public. A step rather + # than a service, so the job doesn't wait on a health check the image doesn't define. + - run: | + docker run -d --name s3 -p 59000:9000 \ + -e RUSTFS_ACCESS_KEY=visualci -e RUSTFS_SECRET_KEY=visualci-dev-secret rustfs/rustfs:1.0.6 + for _ in $(seq 1 30); do curl -s -o /dev/null http://127.0.0.1:59000/ && break; sleep 1; done + - uses: Swatinem/rust-cache@v2 + - run: cargo build --locked -p visualci_server -p visualci-cli + - uses: pnpm/action-setup@v4 + with: + package_json_file: server/frontend/package.json + - uses: actions/setup-node@v4 + with: + node-version: "24" + - run: pnpm install --frozen-lockfile && pnpm build + working-directory: server/frontend + - run: pnpm install --frozen-lockfile && pnpm exec playwright install --with-deps chromium + working-directory: scripts/screenshots + - run: scripts/ci/visual.sh capture + - uses: actions/download-artifact@v4 + with: + name: json-snapshots + path: tmp/json-snapshots + - if: env.VISUALCI_TOKEN != '' + run: scripts/ci/visual.sh upload + - if: failure() + uses: actions/upload-artifact@v4 + with: + name: visual + path: tmp/visual + retention-days: 7 clients: runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }} diff --git a/scripts/ci/visual.sh b/scripts/ci/visual.sh new file mode 100755 index 00000000..b2c9021e --- /dev/null +++ b/scripts/ci/visual.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +# VisualCI tests itself: seed a database, start the server against it, take screenshots of the landing page, docs and +# app, and send them to VisualCI in one build with the Vitest component snapshots, the request tests' JSON snapshots +# and a few files the site serves to agents. CI runs it in the `visual` job (.github/workflows/ci.yml); it also runs on +# a dev machine with Postgres and S3 storage (MinIO or RustFS) up. +# +# scripts/ci/visual.sh capture seed, serve, take screenshots and component snapshots into tmp/visual +# scripts/ci/visual.sh upload send tmp/visual (and $VISUAL_JSON_DIR) to VisualCI as one build, and finalize it +# +# Needs: target/debug/visualci-server and visualci (cargo build), server/frontend/dist (pnpm build), and +# scripts/screenshots/node_modules with Playwright's Chromium. Settings: PORT (5151), DATABASE_URL (a database this +# script drops and recreates), S3_BUCKET, VISUAL_JSON_DIR (the request tests' JSON snapshots), VISUALCI_TOKEN. +set -euo pipefail +root=$(cd "$(dirname "$0")/../.." && pwd) +out=$root/tmp/visual +port=${PORT:-5151} +export DATABASE_URL=${DATABASE_URL:-postgres://loco:loco@127.0.0.1:55433/visualci_screenshots} +export S3_BUCKET=${S3_BUCKET:-visualci-screenshots} +export LOCO_ENV=development +# The month the seeded credit usage falls in (server/src/tasks/screenshots_seed.rs NOW). +export VISUALCI_NOW=2026-11-20T15:00:00Z +server=$root/target/debug/visualci-server +cli=$root/target/debug/visualci + +capture() { + rm -rf "$out" + mkdir -p "$out" + cd "$root/server" + # A fresh database every time, so the seeded ids are the same. + local db=${DATABASE_URL##*/} + psql "${DATABASE_URL%/*}/postgres" -tAc "SELECT 1 FROM pg_database WHERE datname = '$db'" | grep -q 1 || + psql "${DATABASE_URL%/*}/postgres" -qc "CREATE DATABASE $db" + "$server" db reset >"$out/seed.log" 2>&1 || { cat "$out/seed.log"; exit 1; } + "$server" task screenshots:seed >>"$out/seed.log" 2>&1 || { cat "$out/seed.log"; exit 1; } + PORT=$port "$server" start --binding 127.0.0.1 --no-banner >"$out/server.log" 2>&1 & + server_pid=$! + trap 'kill $server_pid 2>/dev/null || true' EXIT + for _ in $(seq 1 60); do + curl -fsS "http://127.0.0.1:$port/_ping" >/dev/null 2>&1 && break + sleep 1 + done + curl -fsS "http://127.0.0.1:$port/_ping" >/dev/null || { tail -50 "$out/server.log"; exit 1; } + + (cd "$root/scripts/screenshots" && node capture.mjs --base-url "http://127.0.0.1:$port" --out "$out/screenshots") + + # Files the site serves to agents. + mkdir -p "$out/site/docs" + curl -fsS "http://127.0.0.1:$port/llms.txt" -o "$out/site/llms.txt" + curl -fsS "http://127.0.0.1:$port/docs/quick-start.md" -o "$out/site/docs/quick-start.md" + if curl -fsS "http://127.0.0.1:$port/visualci.schema.json" -o "$out/site/visualci.schema.json" 2>/dev/null; then :; else + rm -f "$out/site/visualci.schema.json" + fi + + # Component snapshots, written fresh: the baselines are on VisualCI. + cd "$root/server/frontend" + find src -name __snapshots__ -type d -prune -exec rm -rf {} + + npx vitest run -u +} + +upload() { + : "${VISUALCI_TOKEN:?VISUALCI_TOKEN is needed to upload}" + local id + id=$("$cli" build create) + export VISUALCI_BUILD_ID=$id + "$cli" upload "$out/screenshots" --prefix screenshots/ --platform chrome-linux + "$cli" upload "$out/site" --prefix site/ + # `upload` skips .md files in a directory, so the docs page goes up by name. + "$cli" snapshot site/docs/quick-start "$out/site/docs/quick-start.md" --format text + "$cli" upload "$root/server/frontend/src" --from vitest --prefix components/ + if [ -n "${VISUAL_JSON_DIR:-}" ] && [ -d "$VISUAL_JSON_DIR" ]; then + "$cli" upload "$VISUAL_JSON_DIR" --prefix json/ --format json + fi + "$cli" build finalize +} + +case ${1:-} in + capture) capture ;; + upload) upload ;; + *) sed -n '2,13p' "$0" | sed 's/^# \{0,1\}//' >&2; exit 2 ;; +esac diff --git a/scripts/screenshots/.gitignore b/scripts/screenshots/.gitignore new file mode 100644 index 00000000..72aae85f --- /dev/null +++ b/scripts/screenshots/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +out/ diff --git a/scripts/screenshots/capture.mjs b/scripts/screenshots/capture.mjs new file mode 100644 index 00000000..c2cd0080 --- /dev/null +++ b/scripts/screenshots/capture.mjs @@ -0,0 +1,196 @@ +// VisualCI's own screenshots: the landing page, the docs and the app, against a server seeded with +// `visualci-server task screenshots:seed` (server/src/tasks/screenshots_seed.rs). Each page is taken at 1440 and 390 px +// wide, light and dark, as `/-.png` under the output folder, for `visualci upload`. +// +// node capture.mjs [--base-url http://127.0.0.1:5151] [--out out/shots] [--only ] +// +// Pages must come out the same on every run of unchanged code (`node stable.mjs` checks): the browser's clock is frozen +// at the seed's NOW, animations and transitions are off, and each shot waits for the network, fonts and images. +import { mkdir } from 'node:fs/promises' +import { dirname, join } from 'node:path' +import { chromium } from 'playwright' + +// Matches NOW and EMAIL in server/src/tasks/screenshots_seed.rs. +const NOW = '2026-11-20T15:00:00Z' +const EMAIL = 'ada@example.com' + +const DOCS = [ + 'index', 'quick-start', 'agents', 'pdfs', 'screenshots', 'support', + 'ci/github-actions', 'ci/circleci', 'ci/buildkite', 'ci/gitlab', 'ci/other', + 'snapshots/jest', 'snapshots/vitest', 'snapshots/insta', 'snapshots/syrupy', 'snapshots/rspec-snapshot', + 'reference/cli', 'reference/api', 'reference/credits', +] + +// Every page at both widths and both themes, except the docs: they share one layout, so each docs page is taken at +// 1440 light and 390 dark, which still covers both widths and both themes. +const ALL = ['1440-light', '1440-dark', '390-light', '390-dark'] +const DOCS_VARIANTS = ['1440-light', '390-dark'] + +/** The pages: [name, path or async (api) => path, signed in?, variants]. */ +function pages() { + const snapshot = (project, number, name) => async (api) => { + const data = await api(`/api/ui/orgs/acme/projects/${project}/builds/${number}`) + const row = data.snapshots.find((s) => s.name === name) + if (!row) throw new Error(`no snapshot ${name} in ${project} build ${number}`) + return `/acme/${project}/builds/${number}/snapshots/${row.id}` + } + return [ + ['landing', '/', false, ALL], + ...DOCS.map((slug) => [`docs/${slug}`, slug === 'index' ? '/docs/' : `/docs/${slug}/`, false, DOCS_VARIANTS]), + ['app/orgs', '/', true, ALL], + ['app/org', '/acme', true, ALL], + ['app/project/builds', '/acme/web', true, ALL], + ['app/project/settings', '/acme/web?tab=settings', true, ALL], + ['app/project/tokens', '/acme/web?tab=tokens', true, ALL], + ['app/build/changes', '/acme/web/builds/3', true, ALL], + ['app/build/approved', '/acme/web/builds/4', true, ALL], + ['app/build/failed', '/acme/invoices/builds/2', true, ALL], + ['app/snapshot/image', snapshot('web', 3, 'dashboard/1440-light'), true, ALL], + ['app/snapshot/pdf', snapshot('web', 3, 'receipt.pdf'), true, ALL], + ['app/snapshot/json', snapshot('web', 3, 'api/orders.json'), true, ALL], + ['app/snapshot/html', snapshot('web', 3, 'emails/welcome.html'), true, ALL], + ['app/snapshot/text', snapshot('web', 3, 'cli/help.txt'), true, ALL], + ['app/billing/team', '/acme/billing', true, ALL], + ['app/billing/free', '/side-project/billing', true, ALL], + ['app/account', '/account', true, ALL], + ] +} + +const NO_MOTION = `*, *::before, *::after { + animation: none !important; transition: none !important; caret-color: transparent !important; + scroll-behavior: auto !important; +}` + +function args() { + const out = { baseUrl: 'http://127.0.0.1:5151', out: 'out/shots', only: null } + const argv = process.argv.slice(2) + for (let i = 0; i < argv.length; i++) { + const key = argv[i].replace(/^--/, '').replace(/-(\w)/g, (_, c) => c.toUpperCase()) + if (!(key in out)) throw new Error(`unknown option ${argv[i]}`) + out[key] = argv[++i] + } + return out +} + +async function settle(page) { + await page.waitForLoadState('networkidle') + // Lazy images below the fold (or hidden by the other theme) never load on their own: load them all now, so a full-page + // shot doesn't catch them half-loaded. + const pending = await page.evaluate(async () => { + await document.fonts.ready + const waits = [...document.images].map((img) => { + img.loading = 'eager' + if (img.complete) return null + return new Promise((resolve) => { + img.addEventListener('load', resolve, { once: true }) + img.addEventListener('error', resolve, { once: true }) + }) + }) + const timeout = new Promise((resolve) => setTimeout(() => resolve('timeout'), 10_000)) + const result = await Promise.race([Promise.all(waits), timeout]) + return result === 'timeout' ? [...document.images].filter((i) => !i.complete).map((i) => i.src) : [] + }) + if (pending.length) throw new Error(`images still loading after 10s: ${pending.join(', ')}`) + await page.waitForLoadState('networkidle') + // Loading states that outlast network idle (a query retrying) would make a flaky shot: wait them out. + await page.waitForFunction(() => !document.querySelector('.spinner, .skeleton, [aria-busy="true"]'), null, { timeout: 15_000 }) + // Two frames, so layout after the last image or font has painted. + await page.evaluate( + () => + new Promise((r) => { + requestAnimationFrame(() => requestAnimationFrame(r)) + setTimeout(r, 1000) + }), + ) +} + +async function main() { + const opts = args() + // Software rasterising on one thread, one colour profile and greyscale text: with the GPU and partial raster, small SVG + // icons came out a few pixels different from run to run. + const browser = await chromium.launch({ + ...(process.env.CHROME_PATH ? { executablePath: process.env.CHROME_PATH } : {}), + args: [ + '--disable-gpu', + '--force-color-profile=srgb', + '--disable-partial-raster', + '--disable-skia-runtime-opts', + '--disable-lcd-text', + '--font-render-hinting=none', + '--num-raster-threads=1', + ], + }) + const contexts = new Map() + async function context(variant, signedIn) { + const key = `${variant}/${signedIn}` + if (contexts.has(key)) return contexts.get(key) + const [width, theme] = variant.split('-') + const ctx = await browser.newContext({ + baseURL: opts.baseUrl, + viewport: { width: Number(width), height: 900 }, + deviceScaleFactor: 1, + colorScheme: theme, + reducedMotion: 'reduce', + locale: 'en-US', + timezoneId: 'UTC', + }) + await ctx.addInitScript((css) => { + document.addEventListener('DOMContentLoaded', () => { + const style = document.createElement('style') + style.textContent = css + document.head.appendChild(style) + }) + }, NO_MOTION) + // The clock reads NOW, without Playwright's fake timers: those also take over requestAnimationFrame and + // setTimeout, which the app and the waits below need running. + await ctx.addInitScript((now) => { + const fixed = new Date(now).getTime() + const RealDate = Date + class FixedDate extends RealDate { + constructor(...args) { + super(...(args.length ? args : [fixed])) + } + static now() { + return fixed + } + } + globalThis.Date = FixedDate + }, NOW) + if (signedIn) { + const res = await ctx.request.post('/auth/dev-login', { data: { email: EMAIL } }) + if (!res.ok()) throw new Error(`dev-login: HTTP ${res.status()}`) + } + contexts.set(key, ctx) + return ctx + } + + let count = 0 + for (const [name, target, signedIn, variants] of pages()) { + if (opts.only && !name.includes(opts.only)) continue + for (const variant of variants) { + const ctx = await context(variant, signedIn) + const page = await ctx.newPage() + const api = async (path) => { + const res = await ctx.request.get(path) + if (!res.ok()) throw new Error(`${path}: HTTP ${res.status()}`) + return res.json() + } + const path = typeof target === 'function' ? await target(api) : target + const response = await page.goto(path, { waitUntil: 'load' }) + if (!response || response.status() >= 400) throw new Error(`${name}: ${path} gave HTTP ${response?.status()}`) + await settle(page) + const file = join(opts.out, `${name}/${variant}.png`) + await mkdir(dirname(file), { recursive: true }) + await page.screenshot({ path: file, fullPage: true, animations: 'disabled', caret: 'hide' }) + await page.close() + count++ + } + } + await browser.close() + console.log(`${count} screenshots in ${opts.out}`) +} + +main().catch((e) => { + console.error(e) + process.exit(1) +}) diff --git a/scripts/screenshots/package.json b/scripts/screenshots/package.json new file mode 100644 index 00000000..12e68f53 --- /dev/null +++ b/scripts/screenshots/package.json @@ -0,0 +1,13 @@ +{ + "name": "visualci-screenshots", + "private": true, + "type": "module", + "packageManager": "pnpm@10.12.4", + "scripts": { + "capture": "node capture.mjs", + "stable": "node stable.mjs" + }, + "dependencies": { + "playwright": "1.65.1" + } +} diff --git a/scripts/screenshots/pnpm-lock.yaml b/scripts/screenshots/pnpm-lock.yaml new file mode 100644 index 00000000..5c3333a2 --- /dev/null +++ b/scripts/screenshots/pnpm-lock.yaml @@ -0,0 +1,33 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + playwright: + specifier: 1.65.1 + version: 1.65.1 + +packages: + + playwright-core@1.65.1: + resolution: {integrity: sha512-hqPpz7blSMPxWVdoeE1yiBSzXsKiVOd2k+kjCvmUywD2GPO2Dd9HfcWnq9NN0GHbNZDFgZ9JfBFr+X5/BLo0qw==} + engines: {node: '>=20'} + hasBin: true + + playwright@1.65.1: + resolution: {integrity: sha512-vJ1FuoOrNwOKHUIVEvSt3jT1L+wjjDpwhwIstKtfvTh8XIG4FG4bIFuvNdMxi81LGfAhUgUZleVFaOLY4RIUUw==} + engines: {node: '>=20'} + hasBin: true + +snapshots: + + playwright-core@1.65.1: {} + + playwright@1.65.1: + dependencies: + playwright-core: 1.65.1 diff --git a/scripts/screenshots/stable.mjs b/scripts/screenshots/stable.mjs new file mode 100644 index 00000000..ad09a355 --- /dev/null +++ b/scripts/screenshots/stable.mjs @@ -0,0 +1,44 @@ +// Runs capture.mjs N times (default 5) on the same server and checks every screenshot is byte-for-byte the same each +// time. Any difference is a flaky page to fix before VisualCI relies on it. +// +// node stable.mjs [--runs 5] [--base-url http://127.0.0.1:5151] [--only ] +import { execFileSync } from 'node:child_process' +import { createHash } from 'node:crypto' +import { readFileSync, readdirSync, rmSync, statSync } from 'node:fs' +import { join, relative } from 'node:path' + +const argv = process.argv.slice(2) +let runs = 5 +const pass = [] +for (let i = 0; i < argv.length; i++) { + if (argv[i] === '--runs') runs = Number(argv[++i]) + else pass.push(argv[i]) +} + +function files(dir) { + return readdirSync(dir).flatMap((f) => { + const p = join(dir, f) + return statSync(p).isDirectory() ? files(p) : [p] + }) +} + +const hashes = [] +for (let run = 1; run <= runs; run++) { + const out = `out/stable/${run}` + rmSync(out, { recursive: true, force: true }) + execFileSync('node', ['capture.mjs', '--out', out, ...pass], { stdio: 'inherit' }) + const map = new Map() + for (const f of files(out)) map.set(relative(out, f), createHash('sha256').update(readFileSync(f)).digest('hex')) + hashes.push(map) +} +const flaky = [] +for (const [name, hash] of hashes[0]) { + const runsWith = hashes.map((m) => m.get(name)) + if (runsWith.some((h) => h !== hash)) flaky.push(name) +} +if (flaky.length) { + console.error(`${flaky.length} of ${hashes[0].size} screenshots differ between runs:\n ${flaky.join('\n ')}`) + console.error('Compare them under out/stable//.') + process.exit(1) +} +console.log(`all ${hashes[0].size} screenshots identical across ${runs} runs`) diff --git a/server/frontend/.gitignore b/server/frontend/.gitignore index a1dccae5..738eb584 100644 --- a/server/frontend/.gitignore +++ b/server/frontend/.gitignore @@ -29,3 +29,6 @@ dist/ .env.development.local .env.production.local .env.test.local + +# Component snapshots: the baselines live on VisualCI (vitest.config.ts). +__snapshots__/ diff --git a/server/frontend/package.json b/server/frontend/package.json index f43c4a3d..38f6e4a9 100644 --- a/server/frontend/package.json +++ b/server/frontend/package.json @@ -7,7 +7,8 @@ "scripts": { "dev": "vite", "build": "tsc -b && vite build && vite build --ssr --outDir dist-ssr && node scripts/prerender.mjs", - "preview": "vite preview" + "preview": "vite preview", + "test": "vitest run" }, "dependencies": { "@fontsource-variable/geist": "^5.3.0", @@ -21,11 +22,14 @@ "simple-icons": "^16.39.0" }, "devDependencies": { + "@testing-library/react": "^16.3.3", "@types/react": "^19", "@types/react-dom": "^19", "@vitejs/plugin-react": "^6.0.5", + "jsdom": "^27.4.0", "typescript": "^5", - "vite": "^8.2.1" + "vite": "^8.2.1", + "vitest": "^4.1.12" }, "pnpm": { "overrides": { diff --git a/server/frontend/pnpm-lock.yaml b/server/frontend/pnpm-lock.yaml index 6ebb1bf9..8d5846d3 100644 --- a/server/frontend/pnpm-lock.yaml +++ b/server/frontend/pnpm-lock.yaml @@ -40,6 +40,9 @@ importers: specifier: ^16.39.0 version: 16.39.0 devDependencies: + '@testing-library/react': + specifier: ^16.3.3 + version: 16.3.3(@testing-library/dom@10.4.2)(@types/react-dom@19.3.0(@types/react@19.3.3))(@types/react@19.3.3)(react-dom@19.3.1(react@19.3.1))(react@19.3.1) '@types/react': specifier: ^19 version: 19.3.3 @@ -49,15 +52,81 @@ importers: '@vitejs/plugin-react': specifier: ^6.0.5 version: 6.3.0(vite@8.3.8) + jsdom: + specifier: ^27.4.0 + version: 27.4.0 typescript: specifier: ^5 version: 5.9.3 vite: specifier: ^8.2.1 version: 8.3.8 + vitest: + specifier: ^4.1.12 + version: 4.1.12(jsdom@27.4.0)(vite@8.3.8) packages: + '@acemir/cssom@0.9.33': + resolution: {integrity: sha512-52IMmrBsIsDZLp/KFM+KmaMLJ8GTj113K+iFGFCoOjstZSZbsAxMJE8KYtwao7bz1LsEG810ts1m5wvkVEqPlg==} + + '@asamuzakjp/css-color@4.1.2': + resolution: {integrity: sha512-NfBUvBaYgKIuq6E/RBLY1m0IohzNHAYyaJGuTK79Z23uNwmz2jl1mPsC5ZxCCxylinKhT1Amn5oNTlx1wN8cQg==} + + '@asamuzakjp/dom-selector@6.8.1': + resolution: {integrity: sha512-MvRz1nCqW0fsy8Qz4dnLIvhOlMzqDVBabZx6lH+YywFDdjXhMY37SmpV1XFX3JzG5GWHn63j6HX6QPr3lZXHvQ==} + + '@asamuzakjp/nwsapi@2.3.9': + resolution: {integrity: sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q==} + + '@babel/code-frame@7.29.7': + resolution: {integrity: sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==} + engines: {node: '>=6.9.0'} + + '@babel/helper-validator-identifier@7.29.7': + resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==} + engines: {node: '>=6.9.0'} + + '@babel/runtime@7.29.16': + resolution: {integrity: sha512-LKBjGopxrQE0aFucNL69OyyyF143MOWUULEOftU3oCgyD35Sy84UUpVnt/sNvTb7ZmCyALSt7om+fojlW35zYQ==} + engines: {node: '>=6.9.0'} + + '@csstools/color-helpers@6.1.3': + resolution: {integrity: sha512-c6CpX5G1pvuOKTXiRFJ54Lzc8zQrZ3qUjp44QC5DJNt1OmA1vmfUxOMCcKdDqsvffVDG0/MHnY63J+Mn0nmdUg==} + engines: {node: '>=20.19.0'} + + '@csstools/css-calc@3.4.4': + resolution: {integrity: sha512-Jwo1Z8DUsZ8xVOLBdLMfhjJFvWD6pqaUTlBNQZ+qIB2i9g7yG8kd/UBJj2c9J9Twr+u87cjy9BjkmfvMbyOk3Q==} + engines: {node: '>=20.19.0'} + peerDependencies: + '@csstools/css-parser-algorithms': ^4.0.3 + '@csstools/css-tokenizer': ^4.0.3 + + '@csstools/css-color-parser@4.2.8': + resolution: {integrity: sha512-JLsKBee9dmnA3L+H+vYK4lQ6n5CoY3yEnh33zdlMutRfrTxtqt+hFeoZ1maHRt5vLw67huDLpOkDb3rl9A51MQ==} + engines: {node: '>=20.19.0'} + peerDependencies: + '@csstools/css-parser-algorithms': ^4.0.3 + '@csstools/css-tokenizer': ^4.0.3 + + '@csstools/css-parser-algorithms@4.0.3': + resolution: {integrity: sha512-EpCfUDaJtwohPHC7egoXxPGT/R1/WyyAhw87MKB/7BPPZvZU+IcEqo4er5FpLnby2Gvwt9Lpxy+WNEDyFjoXtA==} + engines: {node: '>=20.19.0'} + peerDependencies: + '@csstools/css-tokenizer': ^4.0.3 + + '@csstools/css-syntax-patches-for-csstree@1.1.17': + resolution: {integrity: sha512-IPx9W33+t0Yt5TVb+Y7oICrThOIry0TY6GuXfSHOatxA0uiHqbzi98Gai905lpBAX1m/LH7iI96e9jcI7Dkvxw==} + peerDependencies: + css-tree: ^3.2.1 + peerDependenciesMeta: + css-tree: + optional: true + + '@csstools/css-tokenizer@4.0.3': + resolution: {integrity: sha512-gdkFe/Z4KU1q8Y5S3GYScXGcOnO56dgWwIs5+97Ij1VIKISItOIUlCXUq4VLbdnRclF+SSQ49sLsn3KeV111AA==} + engines: {node: '>=20.19.0'} + '@emnapi/core@2.0.0-beta.2': resolution: {integrity: sha512-MzCVoWtcg4Pm2B3je5mMvYMvj3MmBKw+fU7vbsJc9/iT8ip6/eYIHo/Dsm/mr+wsHB6SEyJDuxB09Yy6r/8+4A==} @@ -67,12 +136,24 @@ packages: '@emnapi/wasi-threads@2.2.0': resolution: {integrity: sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==} + '@exodus/bytes@1.16.0': + resolution: {integrity: sha512-IcpW84uEn3N7ETtNZMlxKhfl6Pec8rUNGOTBtWbK1FKhJxIFAptZyVrvVRVBimAJxJCgc3PxepxkdWWG4DVzfA==} + engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0} + peerDependencies: + '@noble/hashes': ^1.8.0 || ^2.0.0 + peerDependenciesMeta: + '@noble/hashes': + optional: true + '@fontsource-variable/geist-mono@5.3.0': resolution: {integrity: sha512-vBbuwDEo9AkrqADMXOrlAR3DFcJi4/JxeuU43FoiQERnNwsfXNnvxvReZG02cQKmyk4DZkZdBZX3oTDvy2zBAw==} '@fontsource-variable/geist@5.3.0': resolution: {integrity: sha512-j0m+vLQuG5XAYoHtGCVu0spvlGreR3EzpECUVzkFmI1mTVnAO38l/NEPDCFgZ177JxzYJCLSmTQibIiYPilGrA==} + '@jridgewell/sourcemap-codec@1.6.0': + resolution: {integrity: sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==} + '@napi-rs/wasm-runtime@1.2.6': resolution: {integrity: sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==} engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0} @@ -188,6 +269,9 @@ packages: '@rolldown/pluginutils@1.1.1': resolution: {integrity: sha512-glFIJDvLNDtJhT9qrMFWLPbvS+skxgt4L0K8Ei2YtnhPysAJnsI7nyxSJxKj4ADeKX0OLjC4ntRkwpLOoS3rwA==} + '@standard-schema/spec@1.1.0': + resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} + '@tanstack/history@1.162.5': resolution: {integrity: sha512-w1+YvwmTkwt5n8yUqEH3IWZ9DsmorCZW/EQ3KYHnqEgIkOZpH54NvW6/Epq3Dzb8H0ifIeYX8PExvrNLIH5FIA==} engines: {node: '>=20.19'} @@ -228,9 +312,40 @@ packages: '@tanstack/store@0.11.3': resolution: {integrity: sha512-/Mt3h2Qe67HmRMc5SJ+8jM2Fp7O4fBbwOlS0ujUvx34KgAvkvdLSHrJatv0PJG5fbvlDsACTawMMY4ptCpVI8w==} + '@testing-library/dom@10.4.2': + resolution: {integrity: sha512-yzr2S9HyAIdhz2/6qHgbs665Q7PKVcDF05vsOlHPxG1mo36gKVesdYVeDLnXgfjJ03CrKRk08knc6+E/9m8v2Q==} + engines: {node: '>=18'} + + '@testing-library/react@16.3.3': + resolution: {integrity: sha512-Uo193NgQbPMz6lrrhtRQQFcMC6Re/ELLFbbuVL30WDlZxlpZf9/lMHTAVxPRLw1q1iu9OJmR1c2BLiENRstdBg==} + engines: {node: '>=18'} + peerDependencies: + '@testing-library/dom': ^10.0.0 + '@types/react': ^18.0.0 || ^19.0.0 + '@types/react-dom': ^18.0.0 || ^19.0.0 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true + '@tybys/wasm-util@0.10.5': resolution: {integrity: sha512-dOGOPxlaNV+G046mZzN+9C0dAcQZeSKcXiVaM0TYy/LM4ttTmgSBDxYfovcYI8Em3+eAbiAYpvWLOv8+ZVRJKA==} + '@types/aria-query@5.0.4': + resolution: {integrity: sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==} + + '@types/chai@5.2.3': + resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} + + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + + '@types/estree@1.0.11': + resolution: {integrity: sha512-YBdNe5JcjYR0sPhJW1QIeRCmI11YhYvaRuGCs9+WCeTTb+Yhb2BE2XMe5/wAqF10FK5g3+q1PDhQABfT7aX0gg==} + '@types/react-dom@19.3.0': resolution: {integrity: sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==} peerDependencies: @@ -255,16 +370,119 @@ packages: oxc-transform-react: optional: true + '@vitest/expect@4.1.12': + resolution: {integrity: sha512-vFlTt+YEu9WBpNjdGayNmlMVzrWPi1+sv853/7t2FU7hpO5gAFBKHzQmkCq5Xjpr+evegF2994LQT3hF3mRlqQ==} + + '@vitest/mocker@4.1.12': + resolution: {integrity: sha512-fKShNpKZzupWZuY0z7egydvL0sqW4INEZBEExMBMAa6izlENEVHwoXgdaTCaBZ5fwlr4xf2o1wXC83n9RpO+NA==} + peerDependencies: + msw: ^2.4.9 + vite: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + + '@vitest/pretty-format@4.1.12': + resolution: {integrity: sha512-XW9O8+Mxx4VpCtkYdMJLZQQwsVryP9wk7cPKDxtXFfwSak6yRh5+2fep/Y0XF/ElBvJHq8bcYdi6aeuai0opZA==} + + '@vitest/runner@4.1.12': + resolution: {integrity: sha512-NKlVKCr5QnCe8jijdMnmkpHHU+WTqiLFR6G0pHji9uRjXK9xJl1k1nTw6F3pOOj2PDcsDt2GKQMI7wIsaT491w==} + + '@vitest/snapshot@4.1.12': + resolution: {integrity: sha512-ko1y1Qgb/slzQ9mr+b89Cuqud8WG1TKtsPD8r7ZUBdvVOGt85Af2HwCqHujrhwJq95hs/9RM7fcAPg57o1vlzw==} + + '@vitest/spy@4.1.12': + resolution: {integrity: sha512-RGq9x4JNGNTZHEJxvN0oSiJjeSCExm0n2gZKKJZHY9cX5AVA6M7VJILBT3ZJ/tJ/0J9uWT7fETV9/btoi//vSg==} + + '@vitest/utils@4.1.12': + resolution: {integrity: sha512-Q3awXrwOfEV+qc3WmO5ONyE0yO7Q1gQ9/oyHxGLZ/pl7N3NO/ZztqQwKLuwMkV+CA1JYSIeO3gkHnRDIo4AVaA==} + + agent-base@7.1.4: + resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} + engines: {node: '>= 14'} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-styles@5.2.0: + resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} + engines: {node: '>=10'} + + aria-query@5.3.0: + resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==} + + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + + bidi-js@1.1.0: + resolution: {integrity: sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg==} + + chai@6.3.0: + resolution: {integrity: sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==} + engines: {node: '>=18'} + + convert-source-map@2.0.0: + resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + cookie-es@3.1.1: resolution: {integrity: sha512-UaXxwISYJPTr9hwQxMFYZ7kNhSXboMXP+Z3TRX6f1/NyaGPfuNUZOWP1pUEb75B2HjfklIYLVRfWiFZJyC6Npg==} + css-tree@3.2.1: + resolution: {integrity: sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==} + engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0} + + cssstyle@5.3.7: + resolution: {integrity: sha512-7D2EPVltRrsTkhpQmksIu+LxeWAIEk6wRDMJ1qljlv+CKHJM+cJLlfhWIzNA44eAsHXSNe3+vO6DW1yCYx8SuQ==} + engines: {node: '>=20'} + csstype@3.2.4: resolution: {integrity: sha512-PoKaoPzQapnEoqUSnHx1u6W6ku8CVEgKsnpmmzU3m1nwkidpPBQ8V/Zq2+bWNrsOKoKLwTGdbx6xF7BXP1zLVQ==} + data-urls@6.0.1: + resolution: {integrity: sha512-euIQENZg6x8mj3fO6o9+fOW8MimUI4PpD/fZBhJfeioZVy9TUpM4UY7KjQNVZFlqwJ0UdzRDzkycB997HEq1BQ==} + engines: {node: '>=20'} + + debug@4.4.3: + resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + decimal.js@10.6.0: + resolution: {integrity: sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==} + + dequal@2.0.3: + resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} + engines: {node: '>=6'} + detect-libc@2.1.2: resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} engines: {node: '>=8'} + dom-accessibility-api@0.5.16: + resolution: {integrity: sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==} + + entities@9.0.0: + resolution: {integrity: sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg==} + engines: {node: '>=20.19.0'} + + es-module-lexer@2.3.2: + resolution: {integrity: sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==} + + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + + expect-type@1.4.0: + resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} + engines: {node: '>=12.0.0'} + fdir@6.5.0: resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} engines: {node: '>=12.0.0'} @@ -279,10 +497,37 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] + html-encoding-sniffer@6.0.0: + resolution: {integrity: sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==} + engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0} + + http-proxy-agent@7.0.2: + resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} + engines: {node: '>= 14'} + + https-proxy-agent@7.0.6: + resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} + engines: {node: '>= 14'} + + is-potential-custom-element-name@1.0.1: + resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} + isbot@5.2.4: resolution: {integrity: sha512-qFPSy82nnxEUrHdKpIQPVpYwsGJqL/+VGWYVYP5c8XMOyRRPDVb1C5ZMwmKs3nB4Evsw/ux0WqHBkf2UUawC1A==} engines: {node: '>=18'} + js-tokens@4.0.0: + resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + + jsdom@27.4.0: + resolution: {integrity: sha512-mjzqwWRD9Y1J1KUi7W97Gja1bwOOM5Ug0EZ6UDK3xS7j7mndrkwozHtSblfomlzyB4NepioNt+B2sOSzczVgtQ==} + engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0} + peerDependencies: + canvas: ^3.0.0 + peerDependenciesMeta: + canvas: + optional: true + lightningcss-android-arm64@1.33.0: resolution: {integrity: sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==} engines: {node: '>= 12.0.0'} @@ -353,16 +598,43 @@ packages: resolution: {integrity: sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==} engines: {node: '>= 12.0.0'} + lru-cache@11.5.4: + resolution: {integrity: sha512-B8nJCTi8JuSaDBg0tBdnImV6j5O2CXaqKfdj24ZTCFbyivN8KZ2Z+RL3aHjwJAfLutD9cNnObG4SIgW4gMufiw==} + engines: {node: 20 || >=22} + + lz-string@1.5.0: + resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} + hasBin: true + + magic-string@0.30.21: + resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} + marked@18.4.0: resolution: {integrity: sha512-evbvoaiBPFO2lk2kSkIbrwjPMuX/HjKyefPdZbtwccsJWY91xlLF/SzB5hRsAOwStztmKC09i+IGsUcTYMt//A==} engines: {node: '>= 20'} hasBin: true + mdn-data@2.27.1: + resolution: {integrity: sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + nanoid@3.3.20: resolution: {integrity: sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + obug@2.2.1: + resolution: {integrity: sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==} + engines: {node: '>=12.20.0'} + + parse5@8.1.1: + resolution: {integrity: sha512-EcR/6WDcU7b2N3vQSxKALCk9lXGtUMQxXio008OEMBE0kavu/7JLfBEeFPzi43nMqVDSbEn3QCK+BMCc9zO//w==} + + pathe@2.0.3: + resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} @@ -374,20 +646,39 @@ packages: resolution: {integrity: sha512-RVHEU9/Pp1Fnjr/MpAJsZoADukCKhfIi15OunEYiGktIkYLkPVvC1sioWolGDS7XByMTx9m/IGbro0Js13zhnQ==} engines: {node: ^10 || ^12 || >=14} + pretty-format@27.5.1: + resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==} + engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + + punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + react-dom@19.3.1: resolution: {integrity: sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==} peerDependencies: react: ^19.3.1 + react-is@17.0.2: + resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} + react@19.3.1: resolution: {integrity: sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==} engines: {node: '>=0.10.0'} + require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + rolldown@1.2.19: resolution: {integrity: sha512-QIiV1J9d0pzN4jeeTH4sjPy0AZ6cAy2cG0ExeoE1+U8Rvj+hR3gYkokx0YbeUNGlZqiQJJ2utcETe0oKXwzsuA==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true + saxes@6.0.0: + resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} + engines: {node: '>=v12.22.7'} + scheduler@0.28.0: resolution: {integrity: sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==} @@ -401,6 +692,9 @@ packages: resolution: {integrity: sha512-zmMxi/9MdLK1MKazLmIP6Rk39RuK0Xydd+QHeOYntS37olJeTjB3+nwVj4ce/ZWiZJeRhcO5htfxt0mUzQBscQ==} engines: {node: '>=20'} + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + simple-icons@16.39.0: resolution: {integrity: sha512-LHSABBcOUtTnBTclT0cNigYQkcYrJQONMD3E3FTIfkg3i2BOH7y8U8dYJapwxODMLgK5QRNlmKGzLZF1gLE6mQ==} engines: {node: '>=0.12.18'} @@ -409,10 +703,45 @@ packages: resolution: {integrity: sha512-J7ZjMvHd9O1fcT/5V09QWaaSl2BbWx3F6O08spde82Namf9UB0GxRVIPiNbVsdKkoizHiSpTodo3vp2bAy91MA==} engines: {node: '>=6.0.0'} + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + + std-env@4.3.0: + resolution: {integrity: sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==} + + symbol-tree@3.2.4: + resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} + + tinybench@2.9.0: + resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + + tinyexec@1.4.0: + resolution: {integrity: sha512-PV6lIcJQh57aFeJDwx16JNHmgFRh5xguzallrDW1qe8nAghYgr5MKz2K5k7wEyV/ygZhdnIAP8+HZSarHPBCsg==} + engines: {node: '>=18'} + tinyglobby@0.2.17: resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} engines: {node: '>=12.0.0'} + tinyrainbow@3.2.0: + resolution: {integrity: sha512-LgO3D9yZJjApUiuUfl9iFAwrtaX4+lok3wJIqttGoKCHlWUqHqbQpnxCf82L8FjgKsh4iGo78hqJwgL8F6To2A==} + engines: {node: '>=14.0.0'} + + tldts-core@7.6.4: + resolution: {integrity: sha512-QywQ9lgQyZMuc3NVlqmuxHOhlwirSdvgD/vDLvX8dZYcYgy1cdri5rY/TXDHcF4J3VBSdJLcJNIJI6zGJ7jE+w==} + + tldts@7.6.4: + resolution: {integrity: sha512-wp+ZdvQyov404xynNcjbXoJyeGM28W/aCwMmry/rJ+Y0SsObukJYkWwuxWGbNpIjeqMaEbNUtXPNtPPfI5cTFA==} + hasBin: true + + tough-cookie@6.1.0: + resolution: {integrity: sha512-FTxc8u8Kl2tz0Lat1u8ksvcy8bwHRyEMawwTWybo51JqaC6O7SvfuhAKg+Ld6VqyIe2QRJBzY9HA7y2WyFRT2w==} + engines: {node: '>=16'} + + tr46@6.0.0: + resolution: {integrity: sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==} + engines: {node: '>=20'} + tslib@2.9.1: resolution: {integrity: sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==} @@ -469,8 +798,147 @@ packages: yaml: optional: true + vitest@4.1.12: + resolution: {integrity: sha512-5eWdz2yb3ajxWF3C8C4TjkXl7FGm3n2E/VlazALrQHzK7nYMSGFnCZto0bbPNl77AwkOZVLk0YnBAejUu0NiWA==} + engines: {node: ^20.0.0 || ^22.0.0 || >=24.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@opentelemetry/api': ^1.9.0 + '@types/node': ^20.0.0 || ^22.0.0 || >=24.0.0 + '@vitest/browser-playwright': 4.1.12 + '@vitest/browser-preview': 4.1.12 + '@vitest/browser-webdriverio': ^4.1.11 + '@vitest/coverage-istanbul': 4.1.12 + '@vitest/coverage-v8': 4.1.12 + '@vitest/ui': 4.1.12 + happy-dom: '*' + jsdom: '*' + vite: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@opentelemetry/api': + optional: true + '@types/node': + optional: true + '@vitest/browser-playwright': + optional: true + '@vitest/browser-preview': + optional: true + '@vitest/browser-webdriverio': + optional: true + '@vitest/coverage-istanbul': + optional: true + '@vitest/coverage-v8': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + + w3c-xmlserializer@5.0.0: + resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==} + engines: {node: '>=18'} + + webidl-conversions@8.0.1: + resolution: {integrity: sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==} + engines: {node: '>=20'} + + whatwg-mimetype@4.0.0: + resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==} + engines: {node: '>=18'} + + whatwg-mimetype@5.0.0: + resolution: {integrity: sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==} + engines: {node: '>=20'} + + whatwg-url@15.1.0: + resolution: {integrity: sha512-2ytDk0kiEj/yu90JOAp44PVPUkO9+jVhyf+SybKlRHSDlvOOZhdPIrr7xTH64l4WixO2cP+wQIcgujkGBPPz6g==} + engines: {node: '>=20'} + + why-is-node-running@2.3.0: + resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} + engines: {node: '>=8'} + hasBin: true + + ws@8.23.1: + resolution: {integrity: sha512-1rzWDSN0NOi3tpwgHsQExjWRoKUGtjCkJ2gZRaaRtzhYLboMytOI9pj9PU7yCgY37auqdd4OyLofZDbkeuZmPA==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + xml-name-validator@5.0.0: + resolution: {integrity: sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==} + engines: {node: '>=18'} + + xmlchars@2.2.0: + resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} + snapshots: + '@acemir/cssom@0.9.33': {} + + '@asamuzakjp/css-color@4.1.2': + dependencies: + '@csstools/css-calc': 3.4.4(@csstools/css-parser-algorithms@4.0.3(@csstools/css-tokenizer@4.0.3))(@csstools/css-tokenizer@4.0.3) + '@csstools/css-color-parser': 4.2.8(@csstools/css-parser-algorithms@4.0.3(@csstools/css-tokenizer@4.0.3))(@csstools/css-tokenizer@4.0.3) + '@csstools/css-parser-algorithms': 4.0.3(@csstools/css-tokenizer@4.0.3) + '@csstools/css-tokenizer': 4.0.3 + lru-cache: 11.5.4 + + '@asamuzakjp/dom-selector@6.8.1': + dependencies: + '@asamuzakjp/nwsapi': 2.3.9 + bidi-js: 1.1.0 + css-tree: 3.2.1 + is-potential-custom-element-name: 1.0.1 + lru-cache: 11.5.4 + + '@asamuzakjp/nwsapi@2.3.9': {} + + '@babel/code-frame@7.29.7': + dependencies: + '@babel/helper-validator-identifier': 7.29.7 + js-tokens: 4.0.0 + picocolors: 1.1.1 + + '@babel/helper-validator-identifier@7.29.7': {} + + '@babel/runtime@7.29.16': {} + + '@csstools/color-helpers@6.1.3': {} + + '@csstools/css-calc@3.4.4(@csstools/css-parser-algorithms@4.0.3(@csstools/css-tokenizer@4.0.3))(@csstools/css-tokenizer@4.0.3)': + dependencies: + '@csstools/css-parser-algorithms': 4.0.3(@csstools/css-tokenizer@4.0.3) + '@csstools/css-tokenizer': 4.0.3 + + '@csstools/css-color-parser@4.2.8(@csstools/css-parser-algorithms@4.0.3(@csstools/css-tokenizer@4.0.3))(@csstools/css-tokenizer@4.0.3)': + dependencies: + '@csstools/color-helpers': 6.1.3 + '@csstools/css-calc': 3.4.4(@csstools/css-parser-algorithms@4.0.3(@csstools/css-tokenizer@4.0.3))(@csstools/css-tokenizer@4.0.3) + '@csstools/css-parser-algorithms': 4.0.3(@csstools/css-tokenizer@4.0.3) + '@csstools/css-tokenizer': 4.0.3 + + '@csstools/css-parser-algorithms@4.0.3(@csstools/css-tokenizer@4.0.3)': + dependencies: + '@csstools/css-tokenizer': 4.0.3 + + '@csstools/css-syntax-patches-for-csstree@1.1.17(css-tree@3.2.1)': + optionalDependencies: + css-tree: 3.2.1 + + '@csstools/css-tokenizer@4.0.3': {} + '@emnapi/core@2.0.0-beta.2': dependencies: '@emnapi/wasi-threads': 2.2.0 @@ -487,10 +955,14 @@ snapshots: tslib: 2.9.1 optional: true + '@exodus/bytes@1.16.0': {} + '@fontsource-variable/geist-mono@5.3.0': {} '@fontsource-variable/geist@5.3.0': {} + '@jridgewell/sourcemap-codec@1.6.0': {} + '@napi-rs/wasm-runtime@1.2.6(@emnapi/core@2.0.0-beta.2)(@emnapi/runtime@2.0.0-beta.2)': dependencies: '@emnapi/core': 2.0.0-beta.2 @@ -559,6 +1031,8 @@ snapshots: '@rolldown/pluginutils@1.1.1': {} + '@standard-schema/spec@1.1.0': {} + '@tanstack/history@1.162.5': {} '@tanstack/query-core@5.108.4': {} @@ -599,11 +1073,43 @@ snapshots: '@tanstack/store@0.11.3': {} + '@testing-library/dom@10.4.2': + dependencies: + '@babel/code-frame': 7.29.7 + '@babel/runtime': 7.29.16 + '@types/aria-query': 5.0.4 + aria-query: 5.3.0 + dom-accessibility-api: 0.5.16 + lz-string: 1.5.0 + picocolors: 1.1.1 + pretty-format: 27.5.1 + + '@testing-library/react@16.3.3(@testing-library/dom@10.4.2)(@types/react-dom@19.3.0(@types/react@19.3.3))(@types/react@19.3.3)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)': + dependencies: + '@babel/runtime': 7.29.16 + '@testing-library/dom': 10.4.2 + react: 19.3.1 + react-dom: 19.3.1(react@19.3.1) + optionalDependencies: + '@types/react': 19.3.3 + '@types/react-dom': 19.3.0(@types/react@19.3.3) + '@tybys/wasm-util@0.10.5': dependencies: tslib: 2.9.1 optional: true + '@types/aria-query@5.0.4': {} + + '@types/chai@5.2.3': + dependencies: + '@types/deep-eql': 4.0.2 + assertion-error: 2.0.1 + + '@types/deep-eql@4.0.2': {} + + '@types/estree@1.0.11': {} + '@types/react-dom@19.3.0(@types/react@19.3.3)': dependencies: '@types/react': 19.3.3 @@ -617,12 +1123,110 @@ snapshots: '@rolldown/pluginutils': 1.1.1 vite: 8.3.8 + '@vitest/expect@4.1.12': + dependencies: + '@standard-schema/spec': 1.1.0 + '@types/chai': 5.2.3 + '@vitest/spy': 4.1.12 + '@vitest/utils': 4.1.12 + chai: 6.3.0 + tinyrainbow: 3.2.0 + + '@vitest/mocker@4.1.12(vite@8.3.8)': + dependencies: + '@vitest/spy': 4.1.12 + estree-walker: 3.0.3 + magic-string: 0.30.21 + optionalDependencies: + vite: 8.3.8 + + '@vitest/pretty-format@4.1.12': + dependencies: + tinyrainbow: 3.2.0 + + '@vitest/runner@4.1.12': + dependencies: + '@vitest/utils': 4.1.12 + pathe: 2.0.3 + + '@vitest/snapshot@4.1.12': + dependencies: + '@vitest/pretty-format': 4.1.12 + '@vitest/utils': 4.1.12 + magic-string: 0.30.21 + pathe: 2.0.3 + + '@vitest/spy@4.1.12': {} + + '@vitest/utils@4.1.12': + dependencies: + '@vitest/pretty-format': 4.1.12 + convert-source-map: 2.0.0 + tinyrainbow: 3.2.0 + + agent-base@7.1.4: {} + + ansi-regex@5.0.1: {} + + ansi-styles@5.2.0: {} + + aria-query@5.3.0: + dependencies: + dequal: 2.0.3 + + assertion-error@2.0.1: {} + + bidi-js@1.1.0: + dependencies: + require-from-string: 2.0.2 + + chai@6.3.0: {} + + convert-source-map@2.0.0: {} + cookie-es@3.1.1: {} + css-tree@3.2.1: + dependencies: + mdn-data: 2.27.1 + source-map-js: 1.2.4 + + cssstyle@5.3.7: + dependencies: + '@asamuzakjp/css-color': 4.1.2 + '@csstools/css-syntax-patches-for-csstree': 1.1.17(css-tree@3.2.1) + css-tree: 3.2.1 + lru-cache: 11.5.4 + csstype@3.2.4: {} + data-urls@6.0.1: + dependencies: + whatwg-mimetype: 5.0.0 + whatwg-url: 15.1.0 + + debug@4.4.3: + dependencies: + ms: 2.1.3 + + decimal.js@10.6.0: {} + + dequal@2.0.3: {} + detect-libc@2.1.2: {} + dom-accessibility-api@0.5.16: {} + + entities@9.0.0: {} + + es-module-lexer@2.3.2: {} + + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.11 + + expect-type@1.4.0: {} + fdir@6.5.0(picomatch@4.0.7): optionalDependencies: picomatch: 4.0.7 @@ -630,8 +1234,60 @@ snapshots: fsevents@2.3.3: optional: true + html-encoding-sniffer@6.0.0: + dependencies: + '@exodus/bytes': 1.16.0 + transitivePeerDependencies: + - '@noble/hashes' + + http-proxy-agent@7.0.2: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + https-proxy-agent@7.0.6: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + is-potential-custom-element-name@1.0.1: {} + isbot@5.2.4: {} + js-tokens@4.0.0: {} + + jsdom@27.4.0: + dependencies: + '@acemir/cssom': 0.9.33 + '@asamuzakjp/dom-selector': 6.8.1 + '@exodus/bytes': 1.16.0 + cssstyle: 5.3.7 + data-urls: 6.0.1 + decimal.js: 10.6.0 + html-encoding-sniffer: 6.0.0 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 + is-potential-custom-element-name: 1.0.1 + parse5: 8.1.1 + saxes: 6.0.0 + symbol-tree: 3.2.4 + tough-cookie: 6.1.0 + w3c-xmlserializer: 5.0.0 + webidl-conversions: 8.0.1 + whatwg-mimetype: 4.0.0 + whatwg-url: 15.1.0 + ws: 8.23.1 + xml-name-validator: 5.0.0 + transitivePeerDependencies: + - '@noble/hashes' + - bufferutil + - supports-color + - utf-8-validate + lightningcss-android-arm64@1.33.0: optional: true @@ -681,10 +1337,30 @@ snapshots: lightningcss-win32-arm64-msvc: 1.33.0 lightningcss-win32-x64-msvc: 1.33.0 + lru-cache@11.5.4: {} + + lz-string@1.5.0: {} + + magic-string@0.30.21: + dependencies: + '@jridgewell/sourcemap-codec': 1.6.0 + marked@18.4.0: {} + mdn-data@2.27.1: {} + + ms@2.1.3: {} + nanoid@3.3.20: {} + obug@2.2.1: {} + + parse5@8.1.1: + dependencies: + entities: 9.0.0 + + pathe@2.0.3: {} + picocolors@1.1.1: {} picomatch@4.0.7: {} @@ -695,13 +1371,25 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.4 + pretty-format@27.5.1: + dependencies: + ansi-regex: 5.0.1 + ansi-styles: 5.2.0 + react-is: 17.0.2 + + punycode@2.3.1: {} + react-dom@19.3.1(react@19.3.1): dependencies: react: 19.3.1 scheduler: 0.28.0 + react-is@17.0.2: {} + react@19.3.1: {} + require-from-string@2.0.2: {} + rolldown@1.2.19: dependencies: '@oxc-project/types': 0.156.0 @@ -724,6 +1412,10 @@ snapshots: '@rolldown/binding-win32-arm64-msvc': 1.2.19 '@rolldown/binding-win32-x64-msvc': 1.2.19 + saxes@6.0.0: + dependencies: + xmlchars: 2.2.0 + scheduler@0.28.0: {} seroval-plugins@1.8.0(seroval@1.8.2): @@ -732,15 +1424,43 @@ snapshots: seroval@1.8.2: {} + siginfo@2.0.0: {} + simple-icons@16.39.0: {} source-map-js@1.2.4: {} + stackback@0.0.2: {} + + std-env@4.3.0: {} + + symbol-tree@3.2.4: {} + + tinybench@2.9.0: {} + + tinyexec@1.4.0: {} + tinyglobby@0.2.17: dependencies: fdir: 6.5.0(picomatch@4.0.7) picomatch: 4.0.7 + tinyrainbow@3.2.0: {} + + tldts-core@7.6.4: {} + + tldts@7.6.4: + dependencies: + tldts-core: 7.6.4 + + tough-cookie@6.1.0: + dependencies: + tldts: 7.6.4 + + tr46@6.0.0: + dependencies: + punycode: 2.3.1 + tslib@2.9.1: optional: true @@ -759,3 +1479,56 @@ snapshots: tinyglobby: 0.2.17 optionalDependencies: fsevents: 2.3.3 + + vitest@4.1.12(jsdom@27.4.0)(vite@8.3.8): + dependencies: + '@vitest/expect': 4.1.12 + '@vitest/mocker': 4.1.12(vite@8.3.8) + '@vitest/pretty-format': 4.1.12 + '@vitest/runner': 4.1.12 + '@vitest/snapshot': 4.1.12 + '@vitest/spy': 4.1.12 + '@vitest/utils': 4.1.12 + es-module-lexer: 2.3.2 + expect-type: 1.4.0 + magic-string: 0.30.21 + obug: 2.2.1 + pathe: 2.0.3 + picomatch: 4.0.7 + std-env: 4.3.0 + tinybench: 2.9.0 + tinyexec: 1.4.0 + tinyglobby: 0.2.17 + tinyrainbow: 3.2.0 + vite: 8.3.8 + why-is-node-running: 2.3.0 + optionalDependencies: + jsdom: 27.4.0 + transitivePeerDependencies: + - msw + + w3c-xmlserializer@5.0.0: + dependencies: + xml-name-validator: 5.0.0 + + webidl-conversions@8.0.1: {} + + whatwg-mimetype@4.0.0: {} + + whatwg-mimetype@5.0.0: {} + + whatwg-url@15.1.0: + dependencies: + tr46: 6.0.0 + webidl-conversions: 8.0.1 + + why-is-node-running@2.3.0: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + + ws@8.23.1: {} + + xml-name-validator@5.0.0: {} + + xmlchars@2.2.0: {} diff --git a/server/frontend/src/__tests__/pills.test.tsx b/server/frontend/src/__tests__/pills.test.tsx new file mode 100644 index 00000000..7cb3b8fa --- /dev/null +++ b/server/frontend/src/__tests__/pills.test.tsx @@ -0,0 +1,76 @@ +import { describe, expect, it } from 'vitest' +import { BuildResult, Pill, ReviewPill, StatCounts, StatePill } from '../components/ui' +import type { BuildSummary, ReviewState, SnapshotState, Stats } from '../api/types' +import { renderStatic } from './render' + +const stats = (s: Partial): Stats => ({ + total: 0, unchanged: 0, changed: 0, added: 0, removed: 0, ignored: 0, failed: 0, pending: 0, ...s, +}) + +const build = (b: Partial): BuildSummary => ({ + number: 3, + name: 'default', + branch: 'main', + commit_sha: 'a1b2c3d4e5f60718293a4b5c6d7e8f9012345678', + pr_number: null, + mode: 'ci', + state: 'completed', + review_state: 'none', + conclusion: 'unchanged', + stats: stats({ total: 4, unchanged: 4 }), + summary: null, + created_at: '2026-11-20T09:00:00Z', + ...b, +}) + +describe('pills', () => { + it('tones', () => { + expect( + renderStatic( + <> + {(['neutral', 'changed', 'added', 'removed', 'info', 'accent'] as const).map((tone) => ( + + {tone} + + ))} + , + ), + ).toMatchSnapshot() + }) + + it('snapshot states', () => { + const states: SnapshotState[] = ['pending', 'unchanged', 'changed', 'added', 'removed', 'ignored', 'failed'] + expect(renderStatic(<>{states.map((s) => )})).toMatchSnapshot() + }) + + it('review states', () => { + const states: ReviewState[] = ['none', 'pending', 'approved', 'rejected', 'auto_approved'] + expect(renderStatic(<>{states.map((s) => )})).toMatchSnapshot() + }) +}) + +describe('BuildResult', () => { + it.each([ + ['processing', build({ state: 'processing', conclusion: null })], + ['failed', build({ state: 'failed', conclusion: null })], + ['unchanged', build({ review_state: 'auto_approved' })], + ['changes waiting', build({ conclusion: 'changes', review_state: 'pending' })], + ['changes approved', build({ conclusion: 'changes', review_state: 'approved' })], + ['snapshot failures', build({ conclusion: 'failed' })], + ])('%s', (_, b) => { + expect(renderStatic()).toMatchSnapshot() + }) +}) + +describe('StatCounts', () => { + it('every count, in review order', () => { + const all = stats({ total: 28, unchanged: 12, changed: 5, added: 3, removed: 2, ignored: 1, failed: 4, pending: 1 }) + expect(renderStatic()).toMatchSnapshot() + }) + it('limited', () => { + expect(renderStatic()).toMatchSnapshot() + }) + it('empty', () => { + expect(renderStatic()).toMatchSnapshot() + }) +}) diff --git a/server/frontend/src/__tests__/render.tsx b/server/frontend/src/__tests__/render.tsx new file mode 100644 index 00000000..7082c3a8 --- /dev/null +++ b/server/frontend/src/__tests__/render.tsx @@ -0,0 +1,9 @@ +import type { ReactNode } from 'react' +import { render } from '@testing-library/react' +import { QueryClient, QueryClientProvider } from '@tanstack/react-query' + +/** Render inside a query client that never fetches, and return the DOM for a snapshot. */ +export function renderStatic(ui: ReactNode) { + const client = new QueryClient({ defaultOptions: { queries: { enabled: false, retry: false } } }) + return render({ui}).asFragment() +} diff --git a/server/frontend/src/__tests__/site.test.tsx b/server/frontend/src/__tests__/site.test.tsx new file mode 100644 index 00000000..550eb9ac --- /dev/null +++ b/server/frontend/src/__tests__/site.test.tsx @@ -0,0 +1,35 @@ +import { describe, expect, it } from 'vitest' +import { CiStrip } from '../components/CiStrip' +import { Logo, Mark } from '../components/Logo' +import { DocsPage, type DocsPageData } from '../pages/DocsPage' +import { renderStatic } from './render' + +const page: DocsPageData = { + slug: 'quick-start', + title: 'Quick start', + description: 'Send your first build.', + html: '

Install the CLI, then create a build.

visualci build create
', + nav: [ + { + title: 'Start', + pages: [ + { slug: 'index', title: 'Overview' }, + { slug: 'quick-start', title: 'Quick start' }, + ], + }, + { title: 'Snapshots', pages: [{ slug: 'snapshots/vitest', title: 'Vitest' }] }, + ], +} + +describe('site', () => { + it('CI strip', () => { + expect(renderStatic()).toMatchSnapshot() + }) + it('logo', () => { + // The linked logo needs the router; the plain one is what the landing page and docs show. + expect(renderStatic(<>)).toMatchSnapshot() + }) + it('docs page', () => { + expect(renderStatic()).toMatchSnapshot() + }) +}) diff --git a/server/frontend/src/__tests__/text-snapshot.test.tsx b/server/frontend/src/__tests__/text-snapshot.test.tsx new file mode 100644 index 00000000..7b01aeb0 --- /dev/null +++ b/server/frontend/src/__tests__/text-snapshot.test.tsx @@ -0,0 +1,103 @@ +import { describe, expect, it } from 'vitest' +import { TextSnapshot, textHunks } from '../components/TextSnapshot' +import type { SnapshotData, TextLine } from '../api/types' +import { renderStatic } from './render' + +function data(over: { state?: SnapshotData['snapshot']['state']; lines: TextLine[]; text?: Partial> }): SnapshotData { + return { + snapshot: { + id: '00000000-0000-4000-8000-000000000001', + name: 'api/orders.json', + platform: '', + kind: 'text', + format: 'json', + state: over.state ?? 'changed', + review: null, + summary: null, + error: null, + meta: {}, + }, + pages: [ + { + position: 0, op: 'changed', state: 'changed', head_index: 0, base_index: 0, + head_url: null, base_url: null, overlay_url: null, diff: null, text_diff: over.lines, + }, + ], + moved_lines: [], + text: { + format: 'json', base_lines: 9, head_lines: 9, json_changes: [], json_changes_truncated: false, note: null, + ...over.text, + }, + } +} + +function view(d: SnapshotData, full = false) { + const lines = d.pages[0].text_diff + const { hunks, trailing } = textHunks(lines, d.text!.head_lines) + return renderStatic( + {}} + active={0} + hunkRef={() => {}} + />, + ) +} + +const changedLines: TextLine[] = [ + { tag: ' ', text: ' "orders": [', base_line: 2, head_line: 2 }, + { tag: '-', text: ' { "id": "ord_1001", "status": "paid", "total": 6500 },', base_line: 3 }, + { tag: '+', text: ' { "currency": "USD", "id": "ord_1001", "status": "paid", "total": 6500 },', head_line: 3 }, + { tag: ' ', text: ' ],', base_line: 4, head_line: 4 }, + { tag: '-', text: ' "status": "pending"', base_line: 7 }, + { tag: '+', text: ' "status": "refunded"', head_line: 7 }, +] + +describe('TextSnapshot', () => { + it('JSON changes by path, with folded hunks', () => { + expect( + view( + data({ + lines: changedLines, + text: { + json_changes: [ + { path: 'orders[0].currency', op: 'added', after: '"USD"' }, + { path: 'orders[1].status', op: 'changed', before: '"pending"', after: '"refunded"' }, + { path: 'has_more', op: 'removed', before: 'false' }, + ], + }, + }), + ), + ).toMatchSnapshot() + }) + + it('every line shown', () => { + expect(view(data({ lines: changedLines }), true)).toMatchSnapshot() + }) + + it('a new snapshot', () => { + const lines: TextLine[] = [ + { tag: '+', text: 'Usage: acme ', head_line: 1 }, + { tag: '+', text: ' login Sign in', head_line: 2 }, + ] + expect(view(data({ state: 'added', lines, text: { format: 'text', base_lines: 0, head_lines: 2 } }))).toMatchSnapshot() + }) + + it('no differences after normalizing', () => { + expect(view(data({ state: 'unchanged', lines: [], text: { note: 'Compared with keys sorted.' } }))).toMatchSnapshot() + }) + + it('removed', () => { + expect(view(data({ state: 'removed', lines: changedLines }))).toMatchSnapshot() + }) +}) + +describe('textHunks', () => { + it('splits where line numbers jump and counts the unchanged tail', () => { + expect(textHunks(changedLines, 9)).toMatchSnapshot() + }) +}) diff --git a/server/frontend/vitest.config.ts b/server/frontend/vitest.config.ts new file mode 100644 index 00000000..625a131d --- /dev/null +++ b/server/frontend/vitest.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from 'vitest/config' +import react from '@vitejs/plugin-react' + +// Component snapshots for VisualCI's own CI. The snapshot files are gitignored: CI runs `vitest run -u` and sends them +// with `visualci upload --from vitest`, so VisualCI holds the baselines and a changed snapshot waits for review. +export default defineConfig({ + plugins: [react()], + test: { + environment: 'jsdom', + include: ['src/**/*.test.{ts,tsx}'], + }, +}) diff --git a/server/src/app.rs b/server/src/app.rs index b7a22dda..1f6d4af2 100644 --- a/server/src/app.rs +++ b/server/src/app.rs @@ -98,6 +98,7 @@ impl Hooks for App { tasks.register(tasks::org_add_member::OrgAddMember); tasks.register(tasks::org_set_plan::OrgSetPlan); tasks.register(tasks::project_create::ProjectCreate); + tasks.register(tasks::screenshots_seed::ScreenshotsSeed); tasks.register(tasks::user_create::UserCreate); tasks.register(tasks::user_delete::UserDelete); } diff --git a/server/src/models/organizations.rs b/server/src/models/organizations.rs index 5997ca12..e4147351 100644 --- a/server/src/models/organizations.rs +++ b/server/src/models/organizations.rs @@ -193,11 +193,15 @@ pub fn credit_rates() -> serde_json::Value { }) } -/// The start of the current calendar month, UTC: when allowances renew. +/// The start of the current calendar month, UTC: when allowances renew. `VISUALCI_NOW` (RFC 3339) stands in for the +/// clock, for VisualCI's own screenshots of seeded data (`screenshots:seed`); it's never set in production. #[must_use] pub fn month_start() -> chrono::DateTime { use chrono::{Datelike, TimeZone}; - let now = chrono::Utc::now(); + let now = std::env::var("VISUALCI_NOW") + .ok() + .and_then(|v| chrono::DateTime::parse_from_rfc3339(&v).ok()) + .map_or_else(chrono::Utc::now, |t| t.with_timezone(&chrono::Utc)); chrono::Utc.with_ymd_and_hms(now.year(), now.month(), 1, 0, 0, 0).single().unwrap_or(now) } diff --git a/server/src/tasks/mod.rs b/server/src/tasks/mod.rs index b1556634..dcc42172 100644 --- a/server/src/tasks/mod.rs +++ b/server/src/tasks/mod.rs @@ -1,5 +1,6 @@ pub mod org_add_member; pub mod org_set_plan; pub mod project_create; +pub mod screenshots_seed; pub mod user_create; pub mod user_delete; diff --git a/server/src/tasks/screenshots_seed.rs b/server/src/tasks/screenshots_seed.rs new file mode 100644 index 00000000..d656ee69 --- /dev/null +++ b/server/src/tasks/screenshots_seed.rs @@ -0,0 +1,545 @@ +//! `cargo loco task screenshots:seed`: fill an empty database with the fixed dataset VisualCI's own screenshots are +//! taken against (`scripts/screenshots/`). Two organizations (one on each plan), projects with builds that cover every +//! kind of change (image, PDF, JSON, HTML and text; added, removed and failed snapshots), reviews and credit usage. +//! +//! The builds go through the real pipeline (`register_snapshots`, `finalize_shard`, `process`), so what the pages +//! show is what the app produces. PDFs are the exception: their renders are recorded as done, with page images drawn +//! here, since rendering needs the render node. Afterwards every id the pages show (UUIDs, token prefixes) and every +//! timestamp is set to a fixed value, so the same code gives the same pixels on every run. The screenshot browser +//! freezes its clock at `NOW` and the server reads `VISUALCI_NOW` for the month's credit usage. + +use std::io::Cursor; + +use image::{ImageFormat, Rgba, RgbaImage}; +use loco_rs::prelude::*; +use sea_orm::{DbBackend, Statement}; + +use crate::{ + blobstore::BlobStore, + models::{ + _entities::users, + blobs, builds, + builds::CreateParams, + organizations, project_tokens, projects, + renders::{self, RenderPage}, + snapshots::SnapshotParams, + user_tokens, + }, + settings::Settings, +}; + +/// The moment the screenshots show: the browser's frozen clock and `VISUALCI_NOW`. +pub const NOW: &str = "2026-11-20T15:00:00Z"; +/// The signed-in user in the screenshots. +pub const EMAIL: &str = "ada@example.com"; + +pub struct ScreenshotsSeed; + +#[async_trait] +impl Task for ScreenshotsSeed { + fn task(&self) -> TaskInfo { + TaskInfo { + name: "screenshots:seed".to_string(), + detail: "Fill an empty database with the fixed dataset for VisualCI's own screenshots.\nUsage:\ncargo loco task screenshots:seed".to_string(), + } + } + + async fn run(&self, ctx: &AppContext, _vars: &task::Vars) -> Result<()> { + let db = &ctx.db; + let existing = organizations::Entity::find().count(db).await?; + if existing > 0 { + return Err(Error::string("screenshots:seed needs an empty database (run `db reset` first)")); + } + let settings = Settings::from_context(ctx)?; + let store = BlobStore::from_context(ctx)?; + let seed = Seeder { db, store: &store, renderer_version: &settings.renderer_version }; + seed.run().await?; + println!("seeded; sign in as {EMAIL}"); + Ok(()) + } +} + +struct Seeder<'a> { + db: &'a DatabaseConnection, + store: &'a BlobStore, + renderer_version: &'a str, +} + +/// One snapshot to send in a build. +enum Item { + Image { + name: &'static str, + png: Vec, + }, + Text { + name: &'static str, + content_type: &'static str, + text: String, + }, + Pdf { + name: &'static str, + pages: Vec, + }, + /// A PDF that was never uploaded: the snapshot fails. + MissingPdf { + name: &'static str, + }, +} + +#[derive(Clone)] +struct PdfPage { + /// Lines of text, drawn as bars and recorded as the page's text. + lines: Vec<&'static str>, + accent: [u8; 3], +} + +impl Seeder<'_> { + async fn run(&self) -> Result<()> { + let ada = self.user("Ada Lovelace", EMAIL, "ada").await?; + let grace = self.user("Grace Hopper", "grace@example.com", "grace").await?; + + // Acme: the Team plan, two projects, a teammate. + let acme = organizations::Model::create_with_owner(self.db, "acme", "Acme", ada.id).await?; + self.sql(&format!( + "INSERT INTO memberships (organization_id, user_id, role) VALUES ({}, {}, 'member')", + acme.id, grace.id + )) + .await?; + self.sql(&format!( + "UPDATE organizations SET plan = 'team', stripe_customer_id = 'cus_seed', \ + stripe_subscription_id = 'sub_seed', credits_balance = 50000 WHERE id = {}", + acme.id + )) + .await?; + let web = projects::Model::create(self.db, acme.id, "web", "Web app").await?; + self.sql(&format!("UPDATE projects SET github_repo = 'acme/web' WHERE id = {}", web.id)).await?; + let invoices = projects::Model::create(self.db, acme.id, "invoices", "Invoices").await?; + project_tokens::Model::generate(self.db, web.id, "GitHub Actions").await?; + project_tokens::Model::generate(self.db, invoices.id, "CircleCI").await?; + user_tokens::Model::generate(self.db, ada.id, "Claude Code").await?; + + // Side project: the Free plan, one project. + let side = organizations::Model::create_with_owner(self.db, "side-project", "Side project", ada.id).await?; + let blog = projects::Model::create(self.db, side.id, "blog", "Blog").await?; + + self.web_builds(&web, ada.id).await?; + self.invoice_builds(&invoices).await?; + self.build( + &blog, + "1111111111111111111111111111111111111111", + "main", + None, + &[], + vec![ + Item::Image { name: "home", png: screen(640, 400, Screen::default()) }, + Item::Text { name: "feed.xml", content_type: "text/plain", text: feed(3) }, + ], + ) + .await?; + + self.fix_ids_and_times().await + } + + /// The web app: a baseline, an unchanged build, a PR with every kind of change, and a reviewed branch. + async fn web_builds(&self, web: &projects::Model, reviewer: i64) -> Result<()> { + let base = || { + vec![ + Item::Image { name: "dashboard/1440-light", png: screen(720, 450, Screen::default()) }, + Item::Image { name: "dashboard/390-light", png: screen(195, 420, Screen::default()) }, + Item::Image { + name: "settings/1440-light", + png: screen(720, 450, Screen { cards: 2, ..Screen::default() }), + }, + Item::Image { + name: "signup/1440-light", + png: screen(720, 450, Screen { cards: 1, ..Screen::default() }), + }, + Item::Pdf { name: "receipt.pdf", pages: receipt(false) }, + Item::Text { name: "api/orders.json", content_type: "application/json", text: orders_json(false) }, + Item::Text { name: "emails/welcome.html", content_type: "text/html", text: welcome_html(false) }, + Item::Text { name: "cli/help.txt", content_type: "text/plain", text: help_text(false) }, + ] + }; + let c1 = "a1b2c3d4e5f60718293a4b5c6d7e8f9012345678"; + let c2 = "b2c3d4e5f60718293a4b5c6d7e8f901234567890"; + self.build(web, c1, "main", None, &[], base()).await?; + self.build(web, c2, "main", None, &[c1], base()).await?; + + // PR #42: every kind of change. + let changed = vec![ + Item::Image { + name: "dashboard/1440-light", + png: screen(720, 450, Screen { button: [22, 163, 74], ..Screen::default() }), + }, + Item::Image { name: "dashboard/390-light", png: screen(195, 420, Screen::default()) }, + Item::Image { + name: "settings/1440-light", + png: screen(720, 450, Screen { cards: 2, ..Screen::default() }), + }, + Item::Image { + name: "checkout/1440-light", + png: screen(720, 450, Screen { cards: 4, ..Screen::default() }), + }, + Item::Pdf { name: "receipt.pdf", pages: receipt(true) }, + Item::Text { name: "api/orders.json", content_type: "application/json", text: orders_json(true) }, + Item::Text { name: "emails/welcome.html", content_type: "text/html", text: welcome_html(true) }, + Item::Text { name: "cli/help.txt", content_type: "text/plain", text: help_text(true) }, + ]; + let c3 = "c3d4e5f60718293a4b5c6d7e8f9012345678901a"; + let pr = self.build(web, c3, "checkout-redesign", Some(42), &[c2], changed).await?; + self.sql(&format!( + "UPDATE builds SET summary = 'The checkout button is green instead of blue, the receipt has a new tax page, \ + and orders.json adds a currency field. The signup screen was removed and a checkout screen added.' \ + WHERE id = {}", + pr.id + )) + .await?; + + // A branch whose changes are approved. + let mut footer = base(); + footer[2] = Item::Image { + name: "settings/1440-light", + png: screen(720, 450, Screen { cards: 2, footer: true, ..Screen::default() }), + }; + let c4 = "d4e5f60718293a4b5c6d7e8f9012345678901a2b"; + let reviewed = self.build(web, c4, "fix-footer", Some(41), &[c2], footer).await?; + reviewed.review(self.db, Some(reviewer), "approve", None).await?; + Ok(()) + } + + /// Invoices: a baseline and a build whose PDF never arrived. + async fn invoice_builds(&self, invoices: &projects::Model) -> Result<()> { + let c1 = "e5f60718293a4b5c6d7e8f9012345678901a2b3c"; + self.build( + invoices, + c1, + "main", + None, + &[], + vec![Item::Pdf { name: "invoice_typical.pdf", pages: receipt(false) }], + ) + .await?; + let c2 = "f60718293a4b5c6d7e8f9012345678901a2b3c4d"; + self.build( + invoices, + c2, + "main", + None, + &[c1], + vec![ + Item::Pdf { name: "invoice_typical.pdf", pages: receipt(false) }, + Item::MissingPdf { name: "invoice_long.pdf" }, + ], + ) + .await?; + Ok(()) + } + + async fn user(&self, name: &str, email: &str, login: &str) -> Result { + Ok(users::ActiveModel { + pid: Set(Uuid::new_v4()), + email: Set(email.to_string()), + password: Set(String::new()), + api_key: Set(format!("lo-{}", Uuid::new_v4())), + name: Set(name.to_string()), + github_login: Set(Some(login.to_string())), + ..Default::default() + } + .insert(self.db) + .await?) + } + + /// Send a build through the pipeline and return it, completed. + async fn build( + &self, + project: &projects::Model, + commit: &str, + branch: &str, + pr_number: Option, + parents: &[&str], + items: Vec, + ) -> Result { + let params = CreateParams { + commit: commit.to_string(), + branch: branch.to_string(), + pr_number, + parent_commits: parents.iter().map(ToString::to_string).collect(), + mode: "ci".to_string(), + name: "default".to_string(), + shard_total: 1, + subset: false, + nonce: None, + }; + let build = builds::Model::create(self.db, project, ¶ms).await?; + let mut snapshots = Vec::new(); + for item in items { + snapshots.push(self.snapshot(project, item).await?); + } + build.register_snapshots(self.db, project, self.renderer_version, &snapshots).await?; + let build = build.finalize_shard(self.db, None).await?; + let id = build.id; + if !build.process(self.db, self.store, self.renderer_version).await? { + return Err(Error::string(&format!("build {id} didn't conclude"))); + } + Ok(builds::Model::find_by_id(self.db, id).await?) + } + + /// Store an item's bytes and describe it the way the CLI would. + async fn snapshot(&self, project: &projects::Model, item: Item) -> Result { + let params = |name: &str, kind: &str, fingerprint: String, sha256: String, size: i64, content_type: &str| { + SnapshotParams { + name: name.to_string(), + platform: if kind == "image" { "chrome-linux".to_string() } else { String::new() }, + kind: kind.to_string(), + fingerprint, + sha256, + size, + content_type: content_type.to_string(), + threshold: None, + ignore_anti_aliasing: None, + engine: None, + format: None, + meta: serde_json::json!({}), + } + }; + Ok(match item { + Item::Image { name, png } => { + let fingerprint = + visualci_core::image_hash::fingerprint_bytes(&png).map_err(|e| Error::string(&e.to_string()))?; + let size = png.len() as i64; + let blob = blobs::Model::store(self.db, self.store, png, "image/png").await?; + params(name, "image", fingerprint, blob.sha256, size, "image/png") + } + Item::Text { name, content_type, text } => { + let fingerprint = visualci_core::sha256_hex(text.as_bytes()); + let size = text.len() as i64; + let blob = blobs::Model::store(self.db, self.store, text.into_bytes(), content_type).await?; + params(name, "text", fingerprint, blob.sha256, size, content_type) + } + Item::Pdf { name, pages } => { + // The "PDF" is the pages' description; its render is recorded as done with the drawn pages. + let mut rendered = Vec::new(); + for page in &pages { + let png = page_png(page); + let image_fingerprint = visualci_core::image_hash::fingerprint_bytes(&png) + .map_err(|e| Error::string(&e.to_string()))?; + let text = page.lines.join("\n"); + let blob = blobs::Model::store(self.db, self.store, png, "image/png").await?; + rendered.push(RenderPage { + image: blob.sha256, + image_fingerprint, + fingerprint: visualci_core::sha256_hex(text.as_bytes()), + width: PAGE_W, + height: PAGE_H, + text, + }); + } + let source: String = rendered.iter().map(|p| p.fingerprint.as_str()).collect(); + let fingerprint = visualci_core::sha256_hex(source.as_bytes()); + let blob = blobs::Model::store(self.db, self.store, source.into_bytes(), "application/pdf").await?; + let renderer_key = project.renderer_key(None, self.renderer_version); + let render = renders::Model::find_or_queue(self.db, &fingerprint, &renderer_key, &blob.sha256).await?; + if render.state != "done" { + render.into_active_model().complete(self.db, &rendered).await?; + } + params(name, "document", fingerprint, blob.sha256, blob.size, "application/pdf") + } + Item::MissingPdf { name } => { + let sha = visualci_core::sha256_hex(name.as_bytes()); + params(name, "document", sha.clone(), sha, 2048, "application/pdf") + } + }) + } + + async fn sql(&self, sql: &str) -> Result<()> { + self.db.execute_raw(Statement::from_string(DbBackend::Postgres, sql.to_string())).await?; + Ok(()) + } + + /// Every UUID, token prefix and timestamp the pages show, set from the row's id (ids are fixed in a fresh + /// database) so every run gives the same values. + async fn fix_ids_and_times(&self) -> Result<()> { + let t0 = "timestamptz '2026-11-20 09:00:00+00'"; + for table in ["users", "organizations", "projects", "builds", "snapshots"] { + self.sql(&format!("UPDATE {table} SET pid = md5('{table}:' || id)::uuid")).await?; + } + for table in ["users", "organizations", "projects", "memberships", "blobs", "renders", "diffs"] { + self.sql(&format!( + "UPDATE {table} SET created_at = {t0} - interval '30 days', updated_at = {t0} - interval '30 days'" + )) + .await?; + } + self.sql("UPDATE blobs SET uploaded_at = created_at").await?; + // Builds an hour apart, each taking three minutes. + self.sql(&format!( + "UPDATE builds SET created_at = {t0} + (id - 1) * interval '1 hour', \ + finalized_at = {t0} + (id - 1) * interval '1 hour' + interval '2 minutes', \ + completed_at = {t0} + (id - 1) * interval '1 hour' + interval '3 minutes', \ + updated_at = {t0} + (id - 1) * interval '1 hour' + interval '3 minutes'" + )) + .await?; + self.sql( + "UPDATE snapshots s SET created_at = b.created_at, updated_at = b.completed_at FROM builds b \ + WHERE b.id = s.build_id", + ) + .await?; + self.sql("UPDATE snapshot_pages p SET created_at = s.created_at, updated_at = s.updated_at FROM snapshots s WHERE s.id = p.snapshot_id").await?; + self.sql( + "UPDATE reviews r SET created_at = b.completed_at + interval '20 minutes', \ + updated_at = b.completed_at + interval '20 minutes' FROM builds b WHERE b.id = r.build_id", + ) + .await?; + // A build's charge is recorded when it completes; other entries (grants, purchases) a few days earlier. + self.sql(&format!( + "UPDATE credit_transactions SET created_at = {t0} - interval '5 days' + id * interval '1 minute', \ + updated_at = {t0} - interval '5 days' + id * interval '1 minute'" + )) + .await?; + self.sql( + "UPDATE credit_transactions c SET created_at = b.completed_at, updated_at = b.completed_at \ + FROM builds b JOIN projects p ON p.id = b.project_id \ + WHERE c.kind = 'build' AND c.organization_id = p.organization_id \ + AND c.reference LIKE 'build ' || p.slug || '/' || b.number || ':%'", + ) + .await?; + for table in ["project_tokens", "user_tokens"] { + let prefix = if table == "project_tokens" { "vci_" } else { "vcu_" }; + self.sql(&format!( + "UPDATE {table} SET token_prefix = '{prefix}' || substr(md5('{table}:' || id), 1, 6), \ + created_at = {t0} - interval '20 days', updated_at = {t0} - interval '20 days', \ + last_used_at = {t0} + interval '4 hours'" + )) + .await?; + } + Ok(()) + } +} + +// Drawing. Simple flat shapes, so the images are small and the same on every machine. + +const PAGE_W: u32 = 420; +const PAGE_H: u32 = 594; + +fn png(image: &RgbaImage) -> Vec { + let mut out = Cursor::new(Vec::new()); + image.write_to(&mut out, ImageFormat::Png).expect("encoding a PNG in memory"); + out.into_inner() +} + +fn rect(image: &mut RgbaImage, x: u32, y: u32, w: u32, h: u32, rgb: [u8; 3]) { + let (iw, ih) = image.dimensions(); + for py in y.min(ih)..(y + h).min(ih) { + for px in x.min(iw)..(x + w).min(iw) { + image.put_pixel(px, py, Rgba([rgb[0], rgb[1], rgb[2], 255])); + } + } +} + +#[derive(Clone, Copy)] +struct Screen { + cards: u32, + button: [u8; 3], + footer: bool, +} + +impl Default for Screen { + fn default() -> Self { + Self { cards: 3, button: [37, 99, 235], footer: false } + } +} + +/// A made-up app screen: a top bar, a heading, a button and a row of cards. +fn screen(w: u32, h: u32, s: Screen) -> Vec { + let mut image = RgbaImage::from_pixel(w, h, Rgba([248, 250, 252, 255])); + rect(&mut image, 0, 0, w, 36, [15, 23, 42]); + rect(&mut image, 16, 12, 60, 12, [226, 232, 240]); + rect(&mut image, 24, 60, w / 3, 18, [30, 41, 59]); + rect(&mut image, 24, 88, w / 2, 8, [148, 163, 184]); + rect(&mut image, 24, 110, 96.min(w - 48), 28, s.button); + let gap = 16; + let card_w = (w - 48 - gap * (s.cards - 1)) / s.cards; + for i in 0..s.cards { + let x = 24 + i * (card_w + gap); + rect(&mut image, x, 160, card_w, 140.min(h.saturating_sub(200)), [255, 255, 255]); + rect(&mut image, x + 12, 176, card_w.saturating_sub(24), 10, [100, 116, 139]); + rect(&mut image, x + 12, 196, card_w / 2, 8, [203, 213, 225]); + } + if s.footer { + rect(&mut image, 0, h - 40, w, 40, [226, 232, 240]); + rect(&mut image, 24, h - 26, 120, 10, [100, 116, 139]); + } + png(&image) +} + +/// A PDF page: a coloured header band and a grey bar per line of text, as wide as the line. +fn page_png(page: &PdfPage) -> Vec { + let mut image = RgbaImage::from_pixel(PAGE_W, PAGE_H, Rgba([255, 255, 255, 255])); + rect(&mut image, 32, 32, PAGE_W - 64, 40, page.accent); + for (i, line) in page.lines.iter().enumerate() { + let width = (line.len() as u32 * 6).min(PAGE_W - 64); + rect(&mut image, 32, 96 + i as u32 * 22, width, 9, [71, 85, 105]); + } + png(&image) +} + +fn receipt(changed: bool) -> Vec { + let blue = [37, 99, 235]; + let mut pages = vec![ + PdfPage { + lines: vec!["Receipt #10422", "Acme Inc.", "20 November 2026", "Billed to: Example Customer"], + accent: blue, + }, + PdfPage { + lines: if changed { + vec!["Widget x 2 $40.00", "Gadget x 1 $25.00", "Subtotal $65.00", "Total $71.50"] + } else { + vec!["Widget x 2 $40.00", "Gadget x 1 $25.00", "Total $65.00"] + }, + accent: blue, + }, + ]; + if changed { + pages.push(PdfPage { + lines: vec!["Tax summary", "GST 10% $6.50", "Registered for GST"], + accent: [22, 163, 74], + }); + } + pages +} + +fn orders_json(changed: bool) -> String { + let currency = if changed { r#", "currency": "USD""# } else { "" }; + format!( + "{{\n \"orders\": [\n {{ \"id\": \"ord_1001\", \"status\": \"paid\", \"total\": 6500{currency} }},\n \ + {{ \"id\": \"ord_1002\", \"status\": \"{}\", \"total\": 1200{currency} }}\n ],\n \"has_more\": false\n}}\n", + if changed { "refunded" } else { "pending" } + ) +} + +fn welcome_html(changed: bool) -> String { + format!( + "\n\n

Welcome to Acme

\n

Thanks for signing up.

\n \ + {}\n\n\n", + if changed { "Start your trial" } else { "Get started" } + ) +} + +fn help_text(changed: bool) -> String { + let mut text = String::from( + "Usage: acme \n\nCommands:\n login Sign in\n deploy Deploy the current directory\n", + ); + if changed { + text.push_str(" rollback Go back to the previous deploy\n"); + } + text.push_str(" logs Show recent logs\n"); + text +} + +fn feed(items: usize) -> String { + let mut text = String::from("\n\n"); + for i in 1..=items { + text.push_str(&format!(" Post {i}\n")); + } + text.push_str("\n\n"); + text +} diff --git a/server/tests/requests/api.rs b/server/tests/requests/api.rs index 4f1ead36..78d0ff88 100644 --- a/server/tests/requests/api.rs +++ b/server/tests/requests/api.rs @@ -66,6 +66,7 @@ async fn shards_with_the_same_nonce_share_a_build() { .json(); let c: serde_json::Value = request.post("/api/v1/builds").add_header("authorization", auth).json(&build_params(None)).await.json(); + super::json_snapshots::record("api", "post-builds", &a); assert_eq!(a["id"], b["id"]); assert_eq!(a["number"], 1); assert_eq!(c["number"], 2); @@ -99,6 +100,7 @@ async fn registers_snapshots_and_asks_for_new_files() { .await; assert_eq!(response.status_code(), 200); let body: serde_json::Value = response.json(); + super::json_snapshots::record("api", "post-snapshots", &body); let upload = body["snapshots"][0]["upload_url"].as_str().expect("a new file needs an upload URL"); assert!(upload.contains(&format!("blobs/{sha}"))); @@ -111,6 +113,7 @@ async fn registers_snapshots_and_asks_for_new_files() { .json(&bad) .await; assert_eq!(response.status_code(), 400); + super::json_snapshots::record("api", "post-snapshots-invalid-kind", &response.json()); let bad_format = serde_json::json!({ "snapshots": [{ "name": "x", "kind": "text", "fingerprint": "b".repeat(64), "sha256": sha, "size": 1, @@ -156,6 +159,7 @@ async fn registers_snapshots_and_asks_for_new_files() { let listed: serde_json::Value = request.get(&format!("/api/v1/builds/{id}/snapshots")).add_header("authorization", auth).await.json(); + super::json_snapshots::record("api", "get-snapshots", &listed); assert_eq!(listed["snapshots"].as_array().unwrap().len(), 5); }) .await; diff --git a/server/tests/requests/json_snapshots.rs b/server/tests/requests/json_snapshots.rs new file mode 100644 index 00000000..e842bf33 --- /dev/null +++ b/server/tests/requests/json_snapshots.rs @@ -0,0 +1,124 @@ +//! JSON snapshots for VisualCI's own CI: with `VISUALCI_JSON_SNAPSHOTS=` set, the request tests write what the +//! MCP tools and the REST API answered to `///-.json`, and CI sends them to VisualCI as +//! JSON snapshots. Normal runs write nothing. +//! +//! Values that change every run are test noise, not product output, so they're replaced before writing with +//! placeholders numbered in order of first appearance in the file: UUIDs (``), the tests' random org slugs +//! (``), tokens (``), prefixed ids such as feedback's `fb_…` (``), timestamps (``) and +//! presigned URL signatures (``). Two fields holding the same id still show the same placeholder. + +use std::{ + collections::HashMap, + path::PathBuf, + sync::{LazyLock, Mutex}, +}; + +use regex::Regex; + +static COUNTERS: Mutex>> = Mutex::new(None); + +/// The running test's name (libtest names each test's thread after it), without the module path. +fn test_name() -> String { + let thread = std::thread::current(); + let full = thread.name().unwrap_or("unknown"); + full.rsplit("::").next().unwrap_or(full).to_string() +} + +/// Record a response as `//-.json`, when `VISUALCI_JSON_SNAPSHOTS` is set. +pub fn record(kind: &str, name: &str, value: &serde_json::Value) { + let Ok(dir) = std::env::var("VISUALCI_JSON_SNAPSHOTS") else { + return; + }; + let test = test_name(); + let n = { + let mut guard = COUNTERS.lock().unwrap_or_else(std::sync::PoisonError::into_inner); + let counters = guard.get_or_insert_with(HashMap::new); + let n = counters.entry(format!("{kind}/{test}")).or_insert(0); + *n += 1; + *n + }; + let safe: String = + name.chars().map(|c| if c.is_ascii_alphanumeric() || c == '-' || c == '_' { c } else { '-' }).collect(); + let path = PathBuf::from(dir).join(kind).join(&test).join(format!("{n:02}-{safe}.json")); + std::fs::create_dir_all(path.parent().expect("a file path has a parent")).expect("creating the snapshot folder"); + let mut json = serde_json::to_string_pretty(&normalize(value)).expect("JSON serializes"); + json.push('\n'); + std::fs::write(&path, json).expect("writing a JSON snapshot"); +} + +/// The run-to-run noise, in the order it's replaced (a presigned URL's date before the timestamps). +static NOISE: LazyLock> = LazyLock::new(|| { + [ + ("presigned", r"X-Amz-[A-Za-z-]+=[^&\s\x22\\]*(&X-Amz-[A-Za-z-]+=[^&\s\x22\\]*)*"), + ("token", r"\bvc[iu]_[A-Za-z0-9]+"), + ("id", r"\b[a-z]{2,8}_[0-9a-f]{32}\b"), + ("uuid", r"\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b"), + ("org", r"\borg-[0-9a-f]{8}\b"), + ("time", r"\b\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})?"), + ] + .into_iter() + .map(|(kind, re)| (kind, Regex::new(re).expect("a valid pattern"))) + .collect() +}); + +/// The value with run-to-run noise replaced by numbered placeholders (see the module docs). +fn normalize(value: &serde_json::Value) -> serde_json::Value { + let mut seen: HashMap<(&'static str, String), usize> = HashMap::new(); + let mut counts: HashMap<&'static str, usize> = HashMap::new(); + let mut fix = |s: &str| -> String { + let mut out = s.to_string(); + for &(kind, ref re) in NOISE.iter() { + out = re + .replace_all(&out, |caps: ®ex::Captures| { + if kind == "presigned" { + return "".to_string(); + } + let n = *seen.entry((kind, caps[0].to_string())).or_insert_with(|| { + let c = counts.entry(kind).or_insert(0); + *c += 1; + *c + }); + format!("<{kind}:{n}>") + }) + .into_owned(); + } + out + }; + fn walk(v: &serde_json::Value, fix: &mut dyn FnMut(&str) -> String) -> serde_json::Value { + match v { + serde_json::Value::String(s) => serde_json::Value::String(fix(s)), + serde_json::Value::Array(items) => items.iter().map(|i| walk(i, fix)).collect(), + serde_json::Value::Object(map) => map.iter().map(|(k, v)| (fix(k), walk(v, fix))).collect(), + other => other.clone(), + } + } + walk(value, &mut fix) +} + +#[test] +fn normalizes_run_to_run_noise() { + let id = "0b9f3c1e-6d2a-4f7b-9c1d-2e3f4a5b6c7d"; + let value = serde_json::json!({ + "id": id, + "again": format!("build {id}"), + "other": "11111111-2222-4333-8444-555555555555", + "org": "org-1a2b3c4d", + "token": "vci_AbC123xyz", + "feedback": "fb_153333602b0a4be3811ea91b92af7d93", + "at": "2026-12-01T00:07:44.123+00:00", + "url": "http://minio/blobs/x?X-Amz-Algorithm=AWS4&X-Amz-Date=20261201T000744Z&X-Amz-Signature=ab12", + }); + assert_eq!( + normalize(&value), + serde_json::json!({ + "id": "", + "again": "build ", + "other": "", + "org": "", + "token": "", + "feedback": "", + "at": "", + "url": "http://minio/blobs/x?", + }) + ); +} diff --git a/server/tests/requests/mcp.rs b/server/tests/requests/mcp.rs index c64356e1..91353bbb 100644 --- a/server/tests/requests/mcp.rs +++ b/server/tests/requests/mcp.rs @@ -59,6 +59,7 @@ async fn call( let body: serde_json::Value = response.json(); let result = &body["result"]; assert!(result.is_object(), "{tool}: {body}"); + super::json_snapshots::record("mcp", tool, &serde_json::json!({ "arguments": args, "result": result })); let is_error = result["isError"].as_bool().unwrap_or(false); let value = if result["structuredContent"].is_null() { serde_json::json!(result["content"][0]["text"]) @@ -83,6 +84,29 @@ async fn rejects_requests_without_a_valid_token() { .await; } +/// What an agent sees first: every tool, its description and input schema, for each kind of token. +#[tokio::test] +#[serial] +async fn lists_the_tools_each_kind_of_token_can_use() { + request::(|request, ctx| async move { + let f = fixture(&ctx).await; + for (kind, token) in [("user", &f.user_token), ("project", &f.project_token)] { + let response = request + .post("/mcp") + .add_header("authorization", format!("Bearer {token}")) + .add_header("accept", "application/json, text/event-stream") + .json(&serde_json::json!({ "jsonrpc": "2.0", "id": 1, "method": "tools/list" })) + .await; + assert_eq!(response.status_code(), 200, "{}", response.text()); + let body: serde_json::Value = response.json(); + let tools = body["result"]["tools"].as_array().expect("a tools list"); + assert!(!tools.is_empty()); + super::json_snapshots::record("mcp", &format!("tools-list-{kind}-token"), &body["result"]); + } + }) + .await; +} + #[tokio::test] #[serial] async fn a_personal_token_manages_organizations_projects_and_tokens() { diff --git a/server/tests/requests/mod.rs b/server/tests/requests/mod.rs index ed4e5525..098d0e56 100644 --- a/server/tests/requests/mod.rs +++ b/server/tests/requests/mod.rs @@ -2,5 +2,6 @@ mod api; mod auth; mod docs; mod hosts; +mod json_snapshots; mod mcp; mod prepare_data;