diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index 8c4687753e..ca54015c06 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -170,7 +170,11 @@ runs: - name: Install Playwright's dependencies shell: bash if: inputs.playwright-install == 'true' - run: yarn playwright install --with-deps $(echo "${{ inputs.playwright-platform }}" | tr ',' ' ') + run: | + if [ "${{ runner.os }}" = "Linux" ]; then + sudo apt-get update + fi + yarn playwright install --with-deps $(echo "${{ inputs.playwright-platform }}" | tr ',' ' ') working-directory: ${{ steps.workspace-path.outputs.workspace_path }} env: PLAYWRIGHT_BROWSERS_PATH: ${{ steps.workspace-path.outputs.workspace_path }}/node_modules/.cache/ms-playwright diff --git a/.github/workflows/native-playground.yml b/.github/workflows/native-playground.yml index 7240879182..0b87b6b726 100644 --- a/.github/workflows/native-playground.yml +++ b/.github/workflows/native-playground.yml @@ -13,140 +13,489 @@ concurrency: env: CARGO_ENCODED_RUSTFLAGS: '' CARGO_INCREMENTAL: '0' + CARGO_NET_GIT_FETCH_WITH_CLI: 'true' CARGO_PROFILE_DEV_DEBUG: '0' CARGO_PROFILE_TEST_DEBUG: '0' CARGO_TERM_COLOR: always jobs: - server-harness-check: - name: L0 Tier A, Server Contracts & Test Harness + changes: + name: Changed Paths runs-on: ubuntu-24.04 - env: - # One installed toolchain for packages/backend/ and tools/parity-harness alike. - RUSTUP_TOOLCHAIN: '1.98.1' - AFFINE_COMMUNITY_DEFAULT_PUBLIC_KEY: ${{ secrets.AFFINE_COMMUNITY_DEFAULT_PUBLIC_KEY_V2 }} + outputs: + web: ${{ steps.base.outputs.force_all == 'true' && 'true' || steps.filter.outputs.web }} + web-build: ${{ steps.base.outputs.force_all == 'true' && 'true' || steps.filter.outputs.web-build }} + backend: ${{ steps.base.outputs.force_all == 'true' && 'true' || steps.filter.outputs.backend }} + native-ui: ${{ steps.base.outputs.force_all == 'true' && 'true' || steps.filter.outputs.native-ui }} + web-host-only: ${{ steps.classify.outputs.web_host_only }} + desktop-leaf-only: ${{ steps.classify.outputs.desktop_leaf_only }} + desktop-rs-only: ${{ steps.classify.outputs.desktop_rs_only }} + apple-specific: ${{ steps.base.outputs.force_all == 'true' && 'true' || steps.classify.outputs.apple_specific }} steps: - name: Checkout repository uses: actions/checkout@v4 - - - name: Setup Node.js - uses: ./.github/actions/setup-node with: - electron-install: false - playwright-install: false - full-cache: true + # Full history so the merge base and the previous push are present. + fetch-depth: 0 - name: L0 Tier A static gates run: node scripts/ci/check-l0-tier-a.mjs - - name: Frozen v0.27.5 server contracts + - name: Resolve the base commit + id: base + env: + BEFORE: ${{ github.event.before }} + # Topic branches compare with their merge base on the parent integration + # branch (`darksky/np/mobile` for `darksky/np/mobile-*`, otherwise + # `darksky/native-playground`); integration branches compare with the + # commit before this push, or conservatively force all lanes when that + # commit is unknown (branch creation or force-push). run: | - node scripts/oracle/extract-v0275-contracts.mjs --check - node scripts/oracle/test-extractor.mjs + set -euo pipefail + force_all=false + case "$GITHUB_REF_NAME" in + darksky/native-playground|darksky/np/mobile) + if [ -n "${BEFORE//0/}" ] && git cat-file -e "${BEFORE}^{commit}" 2>/dev/null; then + sha=$BEFORE + else + force_all=true + sha=$(git rev-parse HEAD~1 2>/dev/null || git rev-parse HEAD) + fi + ;; + darksky/np/mobile-*) + if ! git rev-parse --verify origin/darksky/np/mobile >/dev/null 2>&1; then + git fetch --no-tags --depth=50 origin darksky/np/mobile:refs/remotes/origin/darksky/np/mobile >/dev/null 2>&1 || true + fi + if git rev-parse --verify origin/darksky/np/mobile >/dev/null 2>&1; then + sha=$(git merge-base origin/darksky/np/mobile HEAD 2>/dev/null || true) + elif git rev-parse --verify origin/darksky/native-playground >/dev/null 2>&1; then + sha=$(git merge-base origin/darksky/native-playground HEAD 2>/dev/null || true) + else + sha=$(git merge-base origin/canary HEAD 2>/dev/null || true) + fi + ;; + *) + if git rev-parse --verify origin/darksky/native-playground >/dev/null 2>&1; then + sha=$(git merge-base origin/darksky/native-playground HEAD 2>/dev/null || true) + else + sha=$(git merge-base origin/canary HEAD 2>/dev/null || true) + fi + ;; + esac + if [ -z "$sha" ]; then + force_all=true + sha=$(git rev-parse HEAD~1 2>/dev/null || git rev-parse HEAD) + fi + echo "sha=$sha" >> "$GITHUB_OUTPUT" + echo "force_all=$force_all" >> "$GITHUB_OUTPUT" + + - name: Classify web host and Desktop leaf changes + id: classify + env: + BASE: ${{ steps.base.outputs.sha }} + FORCE_ALL: ${{ steps.base.outputs.force_all }} + run: | + node scripts/ci/classify-web-host-only.mjs \ + --base "$BASE" \ + --force-all "$FORCE_ALL" \ + --ref "$GITHUB_REF" \ + --event "${GITHUB_EVENT_NAME:-}" \ + --github-output "$GITHUB_OUTPUT" + + - name: Detect changed paths + id: filter + uses: dorny/paths-filter@v3 + with: + base: ${{ steps.base.outputs.sha }} + # JavaScript under scripts/oracle and tools/parity-harness also runs + # the web lane: its lint and format checks cover those files. + filters: | + web: + - '**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs,css}' + - '**/package.json' + - '**/tsconfig*.json' + - 'yarn.lock' + - '.yarnrc.yml' + - '.yarn/**' + - '.oxlintrc.json' + - '.oxfmtrc.json' + - '.prettierignore' + - '.github/actions/setup-node/**' + - '.github/workflows/np-web-fast.yml' + web-build: + - 'packages/frontend/admin/**' + - 'packages/frontend/apps/**' + - 'packages/frontend/component/**' + - 'packages/frontend/core/**' + - 'packages/frontend/electron-api/**' + - 'packages/frontend/i18n/**' + - 'packages/frontend/mobile-native/**' + - 'packages/frontend/native/**' + - 'packages/frontend/routes/**' + - 'packages/frontend/templates/**' + - 'packages/frontend/track/**' + - 'packages/common/auth/**' + - 'packages/common/debug/**' + - 'packages/common/env/**' + - 'packages/common/error/**' + - 'packages/common/graphql/**' + - 'packages/common/infra/**' + - 'packages/common/native/**' + - 'packages/common/nbstore/**' + - 'packages/common/reader/**' + - 'packages/common/realtime/**' + - 'packages/common/s3-compat/**' + - 'packages/common/theme/**' + - 'blocksuite/affine/**' + - 'blocksuite/framework/**' + - 'blocksuite/playground/**' + - 'blocksuite/integration-test/**' + - 'blocksuite/docs/**' + - 'blocksuite/docs-site/**' + - 'blocksuite/tsconfig.json' + - 'tools/cli/**' + - '**/package.json' + - '**/tsconfig*.json' + - 'yarn.lock' + - '.yarnrc.yml' + - '.yarn/**' + - '.github/actions/setup-node/**' + - '.github/workflows/np-web-build.yml' + backend: + - 'packages/backend/**' + - 'packages/common/graphql/**' + - 'packages/common/realtime/**' + - 'packages/frontend/component/**' + - 'scripts/oracle/**' + - 'scripts/ci/check-csf-frame-audit.mjs' + - 'tools/parity-harness/**' + - 'tools/frame-audit/**' + - 'tests/oracle-contracts/**' + - 'tests/affine-cloud/**' + - 'tests/kit/**' + - 'Cargo.toml' + - 'Cargo.lock' + - 'rust-toolchain.toml' + - '.cargo/**' + - 'package.json' + - 'yarn.lock' + - '.yarnrc.yml' + - '.yarn/**' + - '.github/actions/setup-node/**' + - '.github/workflows/np-backend.yml' + native-ui: + - 'blocksuite/**' + - 'packages/ui/**' + - 'packages/frontend/**' + - 'packages/common/store/**' + - 'tools/frame-audit/**' + - 'Cargo.toml' + - 'Cargo.lock' + - 'rust-toolchain.toml' + - '.cargo/**' + - 'package.json' + - 'yarn.lock' + - '.yarnrc.yml' + - '.yarn/**' + - '.oxlintrc.json' + - '.oxfmtrc.json' + - '**/tsconfig*.json' + - '.github/workflows/build-test.yml' + - '.github/workflows/native-playground.yml' + - 'scripts/ci/classify-web-host-only.mjs' + - 'scripts/ci/classify-web-host-only.test.mjs' + + web-fast: + name: Web Fast Checks + needs: changes + if: needs.changes.outputs.web == 'true' + uses: ./.github/workflows/np-web-fast.yml + + web-build: + name: Web Build + needs: changes + if: needs.changes.outputs.web-build == 'true' + uses: ./.github/workflows/np-web-build.yml + + backend-checks: + name: Backend Checks + needs: changes + if: needs.changes.outputs.backend == 'true' + uses: ./.github/workflows/np-backend.yml + secrets: inherit + + lint-and-wasm: + name: Lint, Invariants & Wasm Check + needs: changes + if: needs.changes.outputs.native-ui == 'true' + runs-on: ubuntu-24.04 + defaults: + run: + working-directory: packages/frontend + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Linux fontconfig headers + run: | + sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list + sudo apt-get update + sudo apt-get install -y libfontconfig1-dev libfreetype-dev - name: Install Rust toolchain uses: dtolnay/rust-toolchain@1.98.1 with: components: rustfmt, clippy + targets: wasm32-unknown-unknown - name: Cache Cargo artifacts uses: Swatinem/rust-cache@v2 with: - workspaces: | - packages/backend -> target - tools/parity-harness -> target - key: server-harness + workspaces: packages/frontend -> target + key: lint-wasm - - name: Pull pinned test images + - name: Format check run: | - docker pull -q docker.io/pgvector/pgvector:pg16@sha256:484e838076e04939d27d3e176e91c86eea96236126023be8d3059761122e579f & - docker pull -q docker.io/library/redis:7-alpine@sha256:7f7d30b7fdd09467bac58198a1f166dd69789d348d4fe859cccb20e0cf287fbe & - wait + t0=$(date +%s) + cargo fmt --all -- --check + echo "Format check $(( $(date +%s) - t0 ))" >> /tmp/np-lint-timings.tsv - - name: Format, clippy and test packages/backend/ (real PostgreSQL and Redis) and the parity harness - working-directory: packages/backend + - name: Clippy check run: | - mkdir -p ../../.artifacts/server-harness - status=passed - timings=() - step() { - local name=$1; shift - local start=$(date +%s%3N) - echo "::group::$name" - "$@" || status=failed - echo "::endgroup::" - timings+=(--timing "$name=$(( $(date +%s%3N) - start ))") - } - step fmt cargo fmt --all -- --check - step clippy cargo clippy --locked --workspace --all-targets -- -D warnings - step test cargo test --locked --workspace - parity=(--manifest-path ../../tools/parity-harness/Cargo.toml) - step parity-fmt cargo fmt "${parity[@]}" --all -- --check - step parity-clippy cargo clippy --locked "${parity[@]}" --workspace --all-targets -- -D warnings - step parity-test cargo test --locked "${parity[@]}" --workspace - cargo run --locked --quiet -p test-db-harness --bin affine-test-env -- \ - run-json --out ../../.artifacts/server-harness/run.json --lane server-harness --status "$status" \ - --sha "${{ github.sha }}" --run-id "${{ github.run_id }}-${{ github.run_attempt }}" \ - --select test-db-harness --select parity-harness \ - --select server-types --select server-db --select server-spi --select server-domain \ - --select server-mail --select server-blob --select server-sync \ - --select server-http --select server-worker --select affine-server "${timings[@]}" - cat ../../.artifacts/server-harness/run.json - test "$status" = passed + t0=$(date +%s) + cargo clippy --locked --workspace --all-targets --features harness -- -D warnings + echo "Clippy check $(( $(date +%s) - t0 ))" >> /tmp/np-lint-timings.tsv - - name: Upload run report + - name: Static invariants and link-flag check + run: | + t0=$(date +%s) + ./scripts/check-invariants.sh + echo "Static invariants $(( $(date +%s) - t0 ))" >> /tmp/np-lint-timings.tsv + + - name: Perf guardrail self-tests and generated token/icon unit tests + run: | + t0=$(date +%s) + node --test perf/compare-n3.test.mjs + rustc --edition 2024 --test -D warnings ../ui/tokens/tokens.rs -o /tmp/tokens_test && /tmp/tokens_test + rustc --edition 2024 --test -D warnings ../ui/tokens/icons.rs -o /tmp/icons_test && /tmp/icons_test + rm -f /tmp/tokens_test /tmp/icons_test + echo "Perf and token unit tests $(( $(date +%s) - t0 ))" >> /tmp/np-lint-timings.tsv + + - name: Verify generated tokens, icons, and fonts.lock have zero drift + run: | + t0=$(date +%s) + THEME_VER=$(awk '/^"@toeverything\/theme@/{f=1} f && /version:/{print $2; exit}' ../../yarn.lock) + ICONS_VER=$(awk '/^"@blocksuite\/icons@/{f=1} f && /version:/{print $2; exit}' ../../yarn.lock) + rm -rf /tmp/np-token-deps + mkdir -p /tmp/np-token-deps/node_modules/@toeverything/theme /tmp/np-token-deps/node_modules/@blocksuite/icons + curl -fsSL "https://registry.npmjs.org/@toeverything/theme/-/theme-${THEME_VER}.tgz" \ + | tar -xz --strip-components=1 -C /tmp/np-token-deps/node_modules/@toeverything/theme + curl -fsSL "https://registry.npmjs.org/@blocksuite/icons/-/icons-${ICONS_VER}.tgz" \ + | tar -xz --strip-components=1 -C /tmp/np-token-deps/node_modules/@blocksuite/icons + node ../ui/tokens/extract-tokens.mjs --check --node-modules /tmp/np-token-deps/node_modules + rm -rf /tmp/np-token-deps + echo "Token and font drift check $(( $(date +%s) - t0 ))" >> /tmp/np-lint-timings.tsv + + - name: Check WebAssembly target + if: needs.changes.outputs.desktop-rs-only != 'true' + run: | + t0=$(date +%s) + cargo check --locked -p ui-tokens -p ui -p ui-kit -p blocksuite-editor -p playground --target wasm32-unknown-unknown + cargo check --locked -p blocksuite-playground-doc --no-default-features --target wasm32-unknown-unknown + cargo check --locked -p affine-store --no-default-features --target wasm32-unknown-unknown + cargo check --locked -p blocksuite-preview --no-default-features --features mermaid,wasm-worker --target wasm32-unknown-unknown + cargo check --locked -p blocksuite-preview --no-default-features --features math,wasm-worker --target wasm32-unknown-unknown + cargo check --locked -p blocksuite-preview --no-default-features --features typst,wasm-worker --target wasm32-unknown-unknown + cargo check --locked -p blocksuite-preview --no-default-features --features pdf,wasm-worker --target wasm32-unknown-unknown + echo "Check WebAssembly target $(( $(date +%s) - t0 ))" >> /tmp/np-lint-timings.tsv + + - name: Check Desktop on Linux (default and harness) + if: needs.changes.outputs.desktop-rs-only == 'true' + run: | + t0=$(date +%s) + cargo check --locked -p affine-desktop --lib + cargo check --locked -p affine-desktop --all-targets --features harness + echo "Desktop checks (default + harness) $(( $(date +%s) - t0 ))" >> /tmp/np-lint-timings.tsv + + - name: Summarize step timings if: always() - uses: actions/upload-artifact@v4 - with: - name: server-harness-run - path: .artifacts/server-harness/run.json - if-no-files-found: ignore + run: | + if [ -s /tmp/np-lint-timings.tsv ]; then + { + echo "### Lint, Invariants & Wasm Check Step Timings" + echo "| Step | Duration (s) |" + echo "|---|---:|" + awk -F'\t' '{ printf "| %s | %s |\n", $1, $2 }' /tmp/np-lint-timings.tsv + } >> "$GITHUB_STEP_SUMMARY" + fi - cloud-e2e-rust-server: - name: Cloud E2E (Rust affine-server) + web-wasm-smoke: + name: WebAssembly Bundle & Chromium Smoke + needs: changes + if: needs.changes.outputs.native-ui == 'true' runs-on: ubuntu-24.04 - timeout-minutes: 25 - env: - RUSTUP_TOOLCHAIN: '1.98.1' - CARGO_ENCODED_RUSTFLAGS: '' - AFFINE_COMMUNITY_DEFAULT_PUBLIC_KEY: ${{ secrets.AFFINE_COMMUNITY_DEFAULT_PUBLIC_KEY_V2 }} - DATABASE_URL: postgresql://affine:affine@127.0.0.1:5432/affine - REDIS_URL: redis://127.0.0.1:6379/0 - AFFINE_E2E_RUST_SERVER: '1' - AFFINE_SERVER_EXTERNAL_URL: http://localhost:8080 - services: - postgres: - image: docker.io/pgvector/pgvector:pg16@sha256:484e838076e04939d27d3e176e91c86eea96236126023be8d3059761122e579f - env: - POSTGRES_USER: affine - POSTGRES_PASSWORD: affine - POSTGRES_DB: affine - ports: - - 5432:5432 - options: >- - --health-cmd pg_isready - --health-interval 5s - --health-timeout 5s - --health-retries 10 - redis: - image: docker.io/library/redis:7-alpine@sha256:7f7d30b7fdd09467bac58198a1f166dd69789d348d4fe859cccb20e0cf287fbe - ports: - - 6379:6379 - options: >- - --health-cmd "redis-cli ping" - --health-interval 5s - --health-timeout 5s - --health-retries 10 + timeout-minutes: 20 + outputs: + wasm_raw: ${{ steps.wasm.outputs.raw }} + wasm_gzip: ${{ steps.wasm.outputs.gzip }} + defaults: + run: + working-directory: packages/frontend steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Setup Node.js and Playwright - uses: ./.github/actions/setup-node + - name: Install Mesa Lavapipe Vulkan runtime and CJK and emoji fonts + run: | + t0=$(date +%s) + sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list + sudo apt-get update + sudo apt-get install -y --no-install-recommends mesa-vulkan-drivers libvulkan1 fonts-wqy-zenhei fonts-noto-color-emoji + echo "Install system packages $(( $(date +%s) - t0 ))" >> /tmp/np-wasm-timings.tsv + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@1.98.1 with: - electron-install: false - playwright-install: true - full-cache: true + targets: wasm32-unknown-unknown + + - name: Install wasm-bindgen CLI and Binaryen wasm-opt + run: | + t0=$(date +%s) + WBG_VERSION=$(awk '/^name = "wasm-bindgen"$/{getline; gsub(/"/, "", $3); print $3; exit}' Cargo.lock) + URL="https://github.com/wasm-bindgen/wasm-bindgen/releases/download/${WBG_VERSION}/wasm-bindgen-${WBG_VERSION}-x86_64-unknown-linux-musl.tar.gz" + if curl -fsSL "$URL" -o /tmp/wbg.tar.gz; then + tar -xzf /tmp/wbg.tar.gz -C /tmp + sudo install -m 0755 "/tmp/wasm-bindgen-${WBG_VERSION}-x86_64-unknown-linux-musl/wasm-bindgen" /usr/local/bin/wasm-bindgen + else + cargo install --locked wasm-bindgen-cli --version "$WBG_VERSION" + fi + wasm-bindgen --version + BINARYEN_VERSION="version_123" + BINARYEN_SHA256="e959f2170af4c20c552e9de3a0253704d6a9d2766e8fdb88e4d6ac4bae9388fe" + curl -fsSL "https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VERSION}/binaryen-${BINARYEN_VERSION}-x86_64-linux.tar.gz" \ + -o /tmp/binaryen.tar.gz + echo "${BINARYEN_SHA256} /tmp/binaryen.tar.gz" | sha256sum -c - + tar -xzf /tmp/binaryen.tar.gz -C /tmp + rm -f /tmp/binaryen.tar.gz + sudo install -m 0755 "/tmp/binaryen-${BINARYEN_VERSION}/bin/wasm-opt" /usr/local/bin/wasm-opt + wasm-opt --version + echo "Install Wasm tools $(( $(date +%s) - t0 ))" >> /tmp/np-wasm-timings.tsv + + - name: Cache Cargo artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: packages/frontend -> target + key: web-wasm-smoke + + - name: Build production WebAssembly bundles and check snapshot prefixes + id: wasm + env: + DESKTOP_LEAF_ONLY: ${{ needs.changes.outputs.desktop-leaf-only }} + run: | + set -euo pipefail + t0=$(date +%s) + playground_pkg=../../blocksuite/crates/playground/web/pkg + desktop_pkg=artifacts/desktop-pkg + wasm_target=target/wasm32-unknown-unknown/wasm-release-size + mkdir -p "$playground_pkg" "$desktop_pkg" + WASM_RUSTFLAGS="$(printf '%s\037%s\037%s' "--remap-path-prefix=$(cd ../.. && pwd)=/src" "--remap-path-prefix=${CARGO_HOME:-$HOME/.cargo}=/cargo" "-Ctarget-feature=+simd128")" + + optimize_bundle() { + local name="$1" pkg="$2" + wasm-bindgen --target web --out-dir "$pkg" "$wasm_target/$name.wasm" + wasm-opt -Oz --strip-debug --strip-producers \ + --enable-bulk-memory \ + --enable-nontrapping-float-to-int \ + --enable-sign-ext \ + --enable-mutable-globals \ + --enable-simd \ + "$pkg/${name}_bg.wasm" -o "$pkg/${name}_bg.opt.wasm" + } + + CARGO_ENCODED_RUSTFLAGS="$WASM_RUSTFLAGS" cargo rustc --locked --profile wasm-release-size -p affine-desktop --lib --target wasm32-unknown-unknown --crate-type cdylib + optimize_bundle affine_desktop "$desktop_pkg" + + if [ "${DESKTOP_LEAF_ONLY:-false}" = "true" ]; then + node scripts/check-snapshot-prefixes.mjs "$desktop_pkg/affine_desktop_bg.opt.wasm" + mv "$desktop_pkg/affine_desktop_bg.opt.wasm" "$desktop_pkg/affine_desktop_bg.wasm" + else + CARGO_ENCODED_RUSTFLAGS="$WASM_RUSTFLAGS" cargo build --locked --profile wasm-release-size -p playground --lib --target wasm32-unknown-unknown + optimize_bundle playground "$playground_pkg" + node scripts/check-snapshot-prefixes.mjs \ + "$playground_pkg/playground_bg.opt.wasm" \ + "$desktop_pkg/affine_desktop_bg.opt.wasm" + mv "$playground_pkg/playground_bg.opt.wasm" "$playground_pkg/playground_bg.wasm" + mv "$desktop_pkg/affine_desktop_bg.opt.wasm" "$desktop_pkg/affine_desktop_bg.wasm" + WASM_RAW=$(wc -c < "$playground_pkg/playground_bg.wasm" | tr -d ' ') + WASM_GZIP=$(gzip -9 -c "$playground_pkg/playground_bg.wasm" | wc -c | tr -d ' ') + echo "raw=$WASM_RAW" >> "$GITHUB_OUTPUT" + echo "gzip=$WASM_GZIP" >> "$GITHUB_OUTPUT" + fi + echo "Build Wasm bundles $(( $(date +%s) - t0 ))" >> /tmp/np-wasm-timings.tsv + + - name: Run headless Chromium Web smoke test + if: needs.changes.outputs.desktop-leaf-only != 'true' + run: | + t0=$(date +%s) + mkdir -p artifacts + node scripts/web-smoke.mjs \ + --out artifacts/wasm-chromium.png \ + --out-edgeless artifacts/wasm-chromium-edgeless.png + test -s artifacts/wasm-chromium.png + test -s artifacts/wasm-chromium-edgeless.png + echo "Chromium Web smoke $(( $(date +%s) - t0 ))" >> /tmp/np-wasm-timings.tsv + + - name: Run headless Chromium Desktop persistence smoke + run: | + t0=$(date +%s) + node hosts/web/scripts/verify-desktop-persistence.mjs \ + --pkg artifacts/desktop-pkg \ + --out artifacts/desktop-persistence + echo "Chromium Desktop persistence $(( $(date +%s) - t0 ))" >> /tmp/np-wasm-timings.tsv + + - name: Upload Web smoke artifacts + if: always() + uses: actions/upload-artifact@v4 + with: + name: web-wasm-smoke-artifacts + path: | + packages/frontend/artifacts/wasm-chromium.png + packages/frontend/artifacts/wasm-chromium-edgeless.png + packages/frontend/artifacts/desktop-persistence/*.png + if-no-files-found: ignore + + - name: Summarize step timings + if: always() + run: | + if [ -s /tmp/np-wasm-timings.tsv ]; then + { + echo "### WebAssembly Bundle & Chromium Smoke Step Timings" + echo "| Step | Duration (s) |" + echo "|---|---:|" + awk -F'\t' '{ printf "| %s | %s |\n", $1, $2 }' /tmp/np-wasm-timings.tsv + } >> "$GITHUB_STEP_SUMMARY" + fi + + headless-linux-and-perf: + name: Headless Linux, Web Smoke & Perf + needs: changes + if: needs.changes.outputs.native-ui == 'true' + runs-on: ubuntu-24.04 + timeout-minutes: 25 + defaults: + run: + working-directory: packages/frontend + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Mesa Lavapipe Vulkan driver, headers, and CJK/Emoji fallback fonts + run: | + t0=$(date +%s) + sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list + sudo apt-get update + sudo apt-get install -y --no-install-recommends mesa-vulkan-drivers libvulkan1 libfontconfig1-dev libfreetype-dev lld fonts-wqy-zenhei fonts-noto-color-emoji + echo "Install system packages $(( $(date +%s) - t0 ))" >> /tmp/np-headless-timings.tsv - name: Install Rust toolchain uses: dtolnay/rust-toolchain@1.98.1 @@ -154,25 +503,422 @@ jobs: - name: Cache Cargo artifacts uses: Swatinem/rust-cache@v2 with: - workspaces: packages/backend -> target - key: server-harness + workspaces: packages/frontend -> target + key: headless-linux - - name: Build affine-server binary - working-directory: packages/backend - run: cargo build --locked -p affine-server --bin affine-server - - - name: Generate Prisma client for test helpers - run: yarn affine @affine/server prisma generate - - - name: Run deterministic affine-cloud Playwright E2E against Rust affine-server + - name: Test Desktop on Linux (default and harness) + if: needs.changes.outputs.desktop-leaf-only == 'true' run: | - yarn --cwd tests/affine-cloud playwright test \ - e2e/login.spec.ts \ - e2e/workspace.spec.ts \ - e2e/storage.spec.ts \ - e2e/collaboration.spec.ts \ - e2e/share-page-1.spec.ts \ - e2e/share-page-2.spec.ts \ - e2e/page-history.spec.ts \ - e2e/comments.spec.ts \ - e2e/open-in-app.spec.ts + t0=$(date +%s) + cargo test --locked -p affine-desktop + cargo test --locked -p affine-desktop --features harness --bin desktop-harness + if [ "${{ needs.changes.outputs.desktop-rs-only }}" != "true" ]; then + cargo check --locked -p affine-desktop --all-targets --features harness + fi + echo "Desktop tests (default + harness) $(( $(date +%s) - t0 ))" >> /tmp/np-headless-timings.tsv + + - name: Run workspace unit tests (default) + if: needs.changes.outputs.desktop-leaf-only != 'true' + run: | + t0=$(date +%s) + cargo test --locked --workspace + echo "Workspace tests (default) $(( $(date +%s) - t0 ))" >> /tmp/np-headless-timings.tsv + + - name: Run workspace unit tests (harness) + if: needs.changes.outputs.desktop-leaf-only != 'true' + run: | + t0=$(date +%s) + cargo test --locked -p ui --features harness --test bidi_multiline_controls --test touch_dispatch + cargo test --locked --workspace --features harness --bin bs-harness --bin desktop-harness --bin mobile-harness + echo "Workspace tests (harness) $(( $(date +%s) - t0 ))" >> /tmp/np-headless-timings.tsv + + - name: Deterministic headless render, audit, 4-fps check, and 30-frame bench + if: needs.changes.outputs.desktop-leaf-only != 'true' + run: | + t0=$(date +%s) + cargo build --locked --workspace --features harness --bin bs-harness --test touch_dispatch + mkdir -p artifacts + ./target/debug/bs-harness render \ + --out artifacts/linux-run1.png \ + --snapshot artifacts/linux-run1.json \ + --width 1280 \ + --height 800 + ./target/debug/bs-harness render \ + --out artifacts/linux-run2.png \ + --snapshot artifacts/linux-run2.json \ + --width 1280 \ + --height 800 + test -s artifacts/linux-run1.png + test -s artifacts/linux-run1.json + sha1=$(sha256sum artifacts/linux-run1.png | awk '{print $1}') + sha2=$(sha256sum artifacts/linux-run2.png | awk '{print $1}') + echo "Run 1 SHA256: $sha1" + echo "Run 2 SHA256: $sha2" + test "$sha1" = "$sha2" + ./target/debug/bs-harness audit --snapshot artifacts/linux-run1.json + ./target/debug/bs-harness audit-states + ./target/debug/bs-harness fps-check + ./target/debug/bs-harness bench \ + --json artifacts/perf-metrics.json \ + --commit "${{ github.sha }}" + test -s artifacts/perf-metrics.json + echo "Render, audit, fps, and bench $(( $(date +%s) - t0 ))" >> /tmp/np-headless-timings.tsv + + - name: Upload raw perf metrics artifact + if: needs.changes.outputs.desktop-leaf-only != 'true' + uses: actions/upload-artifact@v4 + with: + name: headless-perf-raw + path: packages/frontend/artifacts/perf-metrics.json + if-no-files-found: error + + - name: Upload Linux headless artifacts + if: always() && needs.changes.outputs.desktop-leaf-only != 'true' + uses: actions/upload-artifact@v4 + with: + name: headless-linux-artifacts + path: | + packages/frontend/artifacts/linux-run1.png + packages/frontend/artifacts/linux-run1.json + if-no-files-found: ignore + + - name: Summarize step timings + if: always() + run: | + if [ -s /tmp/np-headless-timings.tsv ]; then + { + echo "### Headless Linux Step Timings" + echo "| Step | Duration (s) |" + echo "|---|---:|" + awk -F'\t' '{ printf "| %s | %s |\n", $1, $2 }' /tmp/np-headless-timings.tsv + } >> "$GITHUB_STEP_SUMMARY" + fi + + perf-guardrail: + name: Perf N-3 Guardrail + needs: [changes, headless-linux-and-perf, web-wasm-smoke] + if: needs.changes.outputs.native-ui == 'true' && needs.changes.outputs.desktop-leaf-only != 'true' + runs-on: ubuntu-24.04 + timeout-minutes: 5 + defaults: + run: + working-directory: packages/frontend + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download raw perf metrics + uses: actions/download-artifact@v4 + with: + name: headless-perf-raw + path: packages/frontend/artifacts + + - name: Merge Wasm sizes and compare against rolling N-3 baseline + env: + GH_TOKEN: ${{ github.token }} + NP_ALLOW_PERF_BOOTSTRAP: ${{ vars.NP_ALLOW_PERF_BOOTSTRAP }} + WASM_RAW: ${{ needs.web-wasm-smoke.outputs.wasm_raw }} + WASM_GZIP: ${{ needs.web-wasm-smoke.outputs.wasm_gzip }} + run: | + node -e ' + const fs = require("node:fs"); + const p = "artifacts/perf-metrics.json"; + const m = JSON.parse(fs.readFileSync(p, "utf8")); + for (const [key, value] of [ + ["web_wasm_raw", process.env.WASM_RAW], + ["web_wasm_gzip", process.env.WASM_GZIP], + ]) { + const bytes = Number(value); + if (!Number.isSafeInteger(bytes) || bytes <= 0) { + throw new Error(`Invalid Wasm size for ${key}: ${value}`); + } + m.artifacts_bytes[key] = bytes; + } + fs.writeFileSync(p, JSON.stringify(m, null, 2) + "\n"); + ' + test -f perf/compare-n3.mjs + STRICT_PERF_FLAG="--require-n3" + if [ "${NP_ALLOW_PERF_BOOTSTRAP:-0}" = "1" ]; then + STRICT_PERF_FLAG="" + fi + node perf/compare-n3.mjs \ + --fetch-github \ + --repo "${{ github.repository }}" \ + --branch darksky/native-playground \ + --workflow native-playground.yml \ + --run-id "${{ github.run_id }}" \ + --current artifacts/perf-metrics.json \ + --json-out artifacts/perf-verdict.json \ + $STRICT_PERF_FLAG \ + --fail-on-regression >> "$GITHUB_STEP_SUMMARY" + test -s artifacts/perf-verdict.json + node -e ' + const fs = require("node:fs"); + const v = JSON.parse(fs.readFileSync("artifacts/perf-verdict.json", "utf8")); + const allowBootstrap = process.env.NP_ALLOW_PERF_BOOTSTRAP === "1"; + const shaRe = /^[0-9a-f]{40}$/; + if ( + (!allowBootstrap && (v.baseline_depth !== "N-3" || !shaRe.test(v.baseline_commit || ""))) || + (allowBootstrap && v.baseline_depth !== "bootstrap" && !shaRe.test(v.baseline_commit || "")) || + !Array.isArray(v.metrics) || + v.metrics.length === 0 + ) { + throw new Error(`Invalid perf-verdict.json: baseline_depth=${v.baseline_depth}, baseline_commit=${v.baseline_commit}, metrics=${v.metrics?.length}`); + } + const dropped = v.metrics.filter(m => m.status === "DROPPED"); + if (dropped.length > 0) { + throw new Error(`Unacknowledged dropped baseline metrics: ${dropped.map(m => m.key).join(", ")}`); + } + const unacceptedBootstrap = v.metrics.filter(m => m.status === "BOOTSTRAP"); + if (!allowBootstrap && unacceptedBootstrap.length > 0) { + throw new Error(`Unacknowledged BOOTSTRAP metrics against N-3 baseline: ${unacceptedBootstrap.map(m => m.key).join(", ")}`); + } + const compared = v.metrics.filter(m => m.baseline != null && m.current != null); + if (!allowBootstrap && compared.length === 0) { + throw new Error("No metrics were compared against prior N-3 baseline history"); + } + console.log(`perf-verdict.json verified: ${v.baseline_depth} (${(v.baseline_commit || "none").slice(0, 10)}), ${v.metrics.length} metrics, ${unacceptedBootstrap.length} unacknowledged bootstrap, 0 dropped`); + ' + + - name: Upload perf metrics artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: perf-metrics + path: | + packages/frontend/artifacts/perf-metrics.json + packages/frontend/artifacts/perf-verdict.json + if-no-files-found: ignore + + macos-headless: + name: macOS Metal + CoreText Headless + needs: changes + # Topic branch pushes run this job only when they touch Apple code; Linux + # jobs cover the shared crates. + if: needs.changes.outputs.native-ui == 'true' && needs.changes.outputs.web-host-only != 'true' && needs.changes.outputs.apple-specific == 'true' + runs-on: macos-15 + defaults: + run: + working-directory: packages/frontend + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@1.98.1 + + - name: Cache Cargo artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: packages/frontend -> target + key: macos-headless + + - name: Check workspace all targets + if: needs.changes.outputs.desktop-leaf-only != 'true' + run: cargo check --locked --workspace --all-targets --features harness + + - name: Check iOS device and simulator targets + if: needs.changes.outputs.desktop-leaf-only != 'true' + run: | + rustup target add aarch64-apple-ios aarch64-apple-ios-sim + CARGO_ENCODED_RUSTFLAGS="" cargo check --locked -p ui-tokens -p ui -p ui-kit --target aarch64-apple-ios + CARGO_ENCODED_RUSTFLAGS="" cargo check --locked -p ui-tokens -p ui -p ui-kit --target aarch64-apple-ios-sim + + - name: Run Apple platform, CoreText, and Metal tests + if: needs.changes.outputs.desktop-leaf-only != 'true' + run: | + cargo test --locked -p ui --lib -- platform:: text_system:: + cargo test --locked -p ui --features harness --test metal_atlas_fence + + - name: Test Desktop on macOS + env: + DESKTOP_LEAF_ONLY: ${{ needs.changes.outputs.desktop-leaf-only }} + run: | + set -euo pipefail + cargo test --locked -p affine-desktop --lib --features harness + if [ "${DESKTOP_LEAF_ONLY:-false}" = "true" ]; then + cargo check --locked -p affine-desktop --all-targets --features harness + fi + + - name: Deterministic Metal headless render and audit + env: + DESKTOP_LEAF_ONLY: ${{ needs.changes.outputs.desktop-leaf-only }} + run: | + set -euo pipefail + mkdir -p artifacts + verify_desktop_gallery() { + local dir1="artifacts/desktop-gallery-1" + local dir2="artifacts/desktop-gallery-2" + rm -rf "$dir1" "$dir2" + ./target/debug/desktop-harness gallery --out "$dir1" + ./target/debug/desktop-harness gallery --out "$dir2" + local count=0 + for f1 in "$dir1"/*.png; do + test -e "$f1" + test -s "$f1" + local name f2 sha1 sha2 + name=$(basename "$f1") + f2="$dir2/$name" + test -s "$f2" + sha1=$( (shasum -a 256 "$f1" 2>/dev/null || sha256sum "$f1") | awk '{print $1}' ) + sha2=$( (shasum -a 256 "$f2" 2>/dev/null || sha256sum "$f2") | awk '{print $1}' ) + test "$sha1" = "$sha2" + cmp -s "$f1" "$f2" + count=$((count + 1)) + done + echo "Desktop gallery verified: $count/16 PNGs byte-identical" + test "$count" -eq 16 + } + if [ "${DESKTOP_LEAF_ONLY:-false}" = "true" ]; then + cargo build --locked --profile test -p affine-desktop --bin desktop-harness --features affine-desktop/harness + verify_desktop_gallery + else + cargo build --locked --profile test -p playground -p affine-desktop --bin bs-harness --bin desktop-harness --features playground/harness,affine-desktop/harness + ./target/debug/bs-harness render \ + --out artifacts/macos-run1.png \ + --snapshot artifacts/macos-run1.json \ + --width 1280 \ + --height 800 + ./target/debug/bs-harness render \ + --out artifacts/macos-run2.png \ + --snapshot artifacts/macos-run2.json \ + --width 1280 \ + --height 800 + test -s artifacts/macos-run1.png + test -s artifacts/macos-run1.json + sha1=$(shasum -a 256 artifacts/macos-run1.png | awk '{print $1}') + sha2=$(shasum -a 256 artifacts/macos-run2.png | awk '{print $1}') + echo "Run 1 SHA256: $sha1" + echo "Run 2 SHA256: $sha2" + test "$sha1" = "$sha2" + cmp artifacts/macos-run1.json artifacts/macos-run2.json + ./target/debug/bs-harness audit --snapshot artifacts/macos-run1.json + verify_desktop_gallery + fi + + - name: Upload macOS headless artifacts + if: needs.changes.outputs.desktop-leaf-only != 'true' + uses: actions/upload-artifact@v4 + with: + name: headless-macos-artifacts + path: | + packages/frontend/artifacts/macos-run1.png + packages/frontend/artifacts/macos-run1.json + if-no-files-found: error + + js-room-coop: + name: JS Room Coop & Rust-JS E2E + needs: changes + if: needs.changes.outputs.native-ui == 'true' && needs.changes.outputs.desktop-rs-only != 'true' + runs-on: ubuntu-24.04 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Enable Corepack and cache Yarn + run: corepack enable + + - name: Cache Yarn + uses: actions/cache@v4 + with: + path: | + .yarn/cache + node_modules + key: ${{ runner.os }}-yarn-np-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn-np- + + - name: Install JS dependencies + run: yarn install --immutable + + - name: Warm Chromium binary into OS page cache + run: | + CHROME_WARM_BIN=${CHROME_PATH:-${CHROME_BIN:-}} + if [ -z "$CHROME_WARM_BIN" ]; then + wrapper= + for bin in /usr/bin/google-chrome-stable /usr/bin/google-chrome /usr/bin/chromium /usr/bin/chromium-browser; do + [ -e "$bin" ] || continue + if [ "$(head -c 2 "$bin" 2>/dev/null)" = '#!' ]; then + wrapper=${wrapper:-$bin} + else + CHROME_WARM_BIN=$bin + break + fi + done + if [ -z "$CHROME_WARM_BIN" ] && [ -d "$HOME/.cache/ms-playwright" ]; then + CHROME_WARM_BIN=$(find "$HOME/.cache/ms-playwright" -name chrome -type f -print -quit) + fi + CHROME_WARM_BIN=${CHROME_WARM_BIN:-$wrapper} + fi + if [ -z "$CHROME_WARM_BIN" ] || [ ! -e "$CHROME_WARM_BIN" ]; then + echo "warning: skipping Chromium warm-up (no binary found)" >&2 + exit 0 + fi + WARM_PROFILE=$(mktemp -d "${TMPDIR:-/tmp}/np-chrome-warm.XXXXXX") + trap 'rm -rf "$WARM_PROFILE"' EXIT + status=0 + timeout --kill-after=2s 20s "$CHROME_WARM_BIN" --headless=new --no-sandbox --disable-gpu --disable-dbus --disable-dev-shm-usage --user-data-dir="$WARM_PROFILE" --dump-dom about:blank >/dev/null || status=$? + rm -rf "$WARM_PROFILE" + trap - EXIT + if [ "$status" -ne 0 ]; then + echo "warning: Chromium warm-up exited with status $status; continuing to test harness" >&2 + fi + + - name: Test Web host behavior in Chromium + run: node --test --test-concurrency=1 packages/frontend/hosts/web/tests/*.browser.mjs + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@1.98.1 + + - name: Cache Cargo artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: packages/frontend -> target + key: js-room-coop + + - name: Build bs-relay and bs_doc_driver + working-directory: packages/frontend + run: cargo build --locked -p blocksuite-playground-doc --bin bs-relay --example bs_doc_driver + + - name: Verify JS-authored surface snapshots without writeback + working-directory: packages/frontend + run: cargo test --locked -p blocksuite-playground-doc --example bs_doc_driver js_authored_surface + + - name: Lint, format, and typecheck JS room sync + run: | + yarn oxlint --deny-warnings \ + blocksuite/framework/sync/src/doc/source.ts \ + blocksuite/framework/sync/src/doc/peer.ts \ + blocksuite/framework/sync/src/__tests__/peer.unit.spec.ts \ + blocksuite/playground/apps/_common/sync/blob/mock-server.ts \ + blocksuite/playground/apps/_common/sync/room/index.ts \ + blocksuite/playground/apps/_common/sync/room/__tests__/room-sync.spec.ts \ + blocksuite/playground/apps/starter/utils/collection.ts \ + blocksuite/playground/vite.config.ts \ + blocksuite/playground/vitest.config.ts + yarn oxfmt --check \ + blocksuite/framework/sync/src/doc/source.ts \ + blocksuite/framework/sync/src/doc/peer.ts \ + blocksuite/framework/sync/src/__tests__/peer.unit.spec.ts \ + blocksuite/playground/apps/_common/sync/blob/mock-server.ts \ + blocksuite/playground/apps/_common/sync/room/index.ts \ + blocksuite/playground/apps/_common/sync/room/__tests__/room-sync.spec.ts \ + blocksuite/playground/apps/starter/utils/collection.ts \ + blocksuite/playground/vite.config.ts \ + blocksuite/playground/vitest.config.ts + ./node_modules/.bin/tsc -b \ + blocksuite/framework/sync/tsconfig.json \ + blocksuite/playground/tsconfig.json + + - name: Verify surface geometry oracle and live Rust-JS room sync + env: + BS_RELAY_BIN: ${{ github.workspace }}/packages/frontend/target/debug/bs-relay + BS_DOC_DRIVER_BIN: ${{ github.workspace }}/packages/frontend/target/debug/examples/bs_doc_driver + run: | + (cd blocksuite/framework/sync && ../../../node_modules/.bin/vitest run) + (cd blocksuite/playground && ../../node_modules/.bin/vitest run) diff --git a/.github/workflows/np-backend.yml b/.github/workflows/np-backend.yml new file mode 100644 index 0000000000..297ff70a58 --- /dev/null +++ b/.github/workflows/np-backend.yml @@ -0,0 +1,179 @@ +name: Native Playground Backend Checks + +on: + workflow_call: + +env: + CARGO_ENCODED_RUSTFLAGS: '' + CARGO_INCREMENTAL: '0' + CARGO_NET_GIT_FETCH_WITH_CLI: 'true' + CARGO_PROFILE_DEV_DEBUG: '0' + CARGO_PROFILE_TEST_DEBUG: '0' + CARGO_TERM_COLOR: always + +jobs: + server-harness-check: + name: Server Contracts & Test Harness + runs-on: ubuntu-24.04 + env: + # One installed toolchain for packages/backend/ and tools/parity-harness alike. + RUSTUP_TOOLCHAIN: '1.98.1' + AFFINE_COMMUNITY_DEFAULT_PUBLIC_KEY: ${{ secrets.AFFINE_COMMUNITY_DEFAULT_PUBLIC_KEY_V2 }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + electron-install: false + playwright-install: false + full-cache: true + + - name: Frozen v0.27.5 server contracts + run: | + node scripts/oracle/extract-v0275-contracts.mjs --check + node scripts/oracle/test-extractor.mjs + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@1.98.1 + with: + components: rustfmt, clippy + + - name: Cache Cargo artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: | + packages/backend -> target + tools/frame-audit -> target + tools/parity-harness -> target + key: server-harness + + - name: Pull pinned test images + run: | + docker pull -q docker.io/pgvector/pgvector:pg16@sha256:484e838076e04939d27d3e176e91c86eea96236126023be8d3059761122e579f & + docker pull -q docker.io/library/redis:7-alpine@sha256:7f7d30b7fdd09467bac58198a1f166dd69789d348d4fe859cccb20e0cf287fbe & + wait + + - name: Format, clippy and test packages/backend/ (real PostgreSQL and Redis) and the parity harness + working-directory: packages/backend + run: | + mkdir -p ../../.artifacts/server-harness + status=passed + timings=() + step() { + local name=$1; shift + local start=$(date +%s%3N) + echo "::group::$name" + "$@" || status=failed + echo "::endgroup::" + timings+=(--timing "$name=$(( $(date +%s%3N) - start ))") + } + step fmt cargo fmt --all -- --check + step clippy cargo clippy --locked --workspace --all-targets -- -D warnings + step test cargo test --locked --workspace + audit=(--manifest-path ../../tools/frame-audit/Cargo.toml) + step audit-fmt cargo fmt "${audit[@]}" --all -- --check + step audit-clippy cargo clippy --locked "${audit[@]}" --workspace --all-targets -- -D warnings + step audit-test cargo test --locked "${audit[@]}" --workspace + parity=(--manifest-path ../../tools/parity-harness/Cargo.toml) + step parity-fmt cargo fmt "${parity[@]}" --all -- --check + step parity-clippy cargo clippy --locked "${parity[@]}" --workspace --all-targets -- -D warnings + step parity-test cargo test --locked "${parity[@]}" --workspace + step csf-frame-audit node ../../scripts/ci/check-csf-frame-audit.mjs + cargo run --locked --quiet -p test-db-harness --bin affine-test-env -- \ + run-json --out ../../.artifacts/server-harness/run.json --lane server-harness --status "$status" \ + --sha "${{ github.sha }}" --run-id "${{ github.run_id }}-${{ github.run_attempt }}" \ + --select frame-audit --select csf-frame-audit --select test-db-harness --select parity-harness \ + --select server-types --select server-db --select server-spi --select server-domain \ + --select server-mail --select server-blob --select server-sync \ + --select server-http --select server-worker --select affine-server "${timings[@]}" + cat ../../.artifacts/server-harness/run.json + test -s ../../.artifacts/server-harness/run.json + test -s ../../.artifacts/csf-frame-audit/frames.json + test "$status" = passed + + - name: Upload run report + if: always() + uses: actions/upload-artifact@v4 + with: + name: server-harness-run + path: | + .artifacts/server-harness/run.json + .artifacts/csf-frame-audit/frames.json + if-no-files-found: ignore + + cloud-e2e-rust-server: + name: Cloud E2E (Rust affine-server) + runs-on: ubuntu-24.04 + timeout-minutes: 25 + env: + RUSTUP_TOOLCHAIN: '1.98.1' + CARGO_ENCODED_RUSTFLAGS: '' + AFFINE_COMMUNITY_DEFAULT_PUBLIC_KEY: ${{ secrets.AFFINE_COMMUNITY_DEFAULT_PUBLIC_KEY_V2 }} + DATABASE_URL: postgresql://affine:affine@127.0.0.1:5432/affine + REDIS_URL: redis://127.0.0.1:6379/0 + AFFINE_E2E_RUST_SERVER: '1' + AFFINE_SERVER_EXTERNAL_URL: http://localhost:8080 + services: + postgres: + image: docker.io/pgvector/pgvector:pg16@sha256:484e838076e04939d27d3e176e91c86eea96236126023be8d3059761122e579f + env: + POSTGRES_USER: affine + POSTGRES_PASSWORD: affine + POSTGRES_DB: affine + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 5s + --health-timeout 5s + --health-retries 10 + redis: + image: docker.io/library/redis:7-alpine@sha256:7f7d30b7fdd09467bac58198a1f166dd69789d348d4fe859cccb20e0cf287fbe + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 5s + --health-timeout 5s + --health-retries 10 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js and Playwright + uses: ./.github/actions/setup-node + with: + electron-install: false + playwright-install: true + full-cache: true + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@1.98.1 + + - name: Cache Cargo artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: packages/backend -> target + key: server-harness + + - name: Build affine-server binary + working-directory: packages/backend + run: cargo build --locked -p affine-server --bin affine-server + + - name: Generate Prisma client for test helpers + run: yarn affine @affine/server prisma generate + + - name: Run deterministic affine-cloud Playwright E2E against Rust affine-server + run: | + yarn --cwd tests/affine-cloud playwright test \ + e2e/login.spec.ts \ + e2e/workspace.spec.ts \ + e2e/storage.spec.ts \ + e2e/collaboration.spec.ts \ + e2e/share-page-1.spec.ts \ + e2e/share-page-2.spec.ts \ + e2e/page-history.spec.ts \ + e2e/comments.spec.ts \ + e2e/open-in-app.spec.ts diff --git a/.github/workflows/np-mobile.yml b/.github/workflows/np-mobile.yml new file mode 100644 index 0000000000..3229f32dea --- /dev/null +++ b/.github/workflows/np-mobile.yml @@ -0,0 +1,810 @@ +name: Native Playground Mobile CI + +on: + push: + branches: + - 'darksky/np/mobile' + - 'darksky/np/mobile-**' + workflow_dispatch: + inputs: + force_all: + description: Force all native mobile jobs + required: false + type: boolean + default: false + +concurrency: + group: np-mobile-${{ github.ref }} + cancel-in-progress: true + +env: + CARGO_ENCODED_RUSTFLAGS: '' + CARGO_INCREMENTAL: '0' + CARGO_NET_GIT_FETCH_WITH_CLI: 'true' + CARGO_PROFILE_DEV_DEBUG: '0' + CARGO_PROFILE_TEST_DEBUG: '0' + CARGO_TERM_COLOR: always + +jobs: + changes: + name: Changed Paths + runs-on: ubuntu-24.04 + timeout-minutes: 5 + outputs: + web-host-only: ${{ steps.classify.outputs.web_host_only }} + desktop-leaf-only: ${{ steps.classify.outputs.desktop_leaf_only }} + desktop-rs-only: ${{ steps.classify.outputs.desktop_rs_only }} + backend-only: ${{ steps.classify.outputs.backend_only }} + web-wrapper-only: ${{ steps.classify.outputs.web_wrapper_only }} + apple-specific: ${{ steps.base.outputs.force_all == 'true' && 'true' || steps.classify.outputs.apple_specific }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 50 + + - name: Resolve the base commit + id: base + env: + BEFORE: ${{ github.event.before }} + PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} + INPUT_FORCE_ALL: ${{ inputs.force_all }} + run: | + set -euo pipefail + force_all=false + sha="" + + if [ "${INPUT_FORCE_ALL:-false}" = "true" ]; then + force_all=true + fi + + case "${GITHUB_REF:-}" in + refs/heads/darksky/np/mobile|refs/heads/canary|refs/heads/darksky/native-playground) + force_all=true + ;; + esac + + if [ "$force_all" != "true" ]; then + if [ "${GITHUB_EVENT_NAME:-}" = "pull_request" ] && [ -n "${PR_BASE_SHA:-}" ]; then + if ! git cat-file -e "${PR_BASE_SHA}^{commit}" 2>/dev/null; then + git fetch --no-tags --depth=50 origin "$PR_BASE_SHA" >/dev/null 2>&1 || true + fi + if git cat-file -e "${PR_BASE_SHA}^{commit}" 2>/dev/null; then + sha=$PR_BASE_SHA + fi + else + case "${GITHUB_REF_NAME:-}" in + darksky/np/mobile-*) + git fetch --no-tags --depth=50 origin darksky/np/mobile:refs/remotes/origin/darksky/np/mobile >/dev/null 2>&1 || true + git fetch --no-tags --depth=50 origin canary:refs/remotes/origin/canary >/dev/null 2>&1 || true + if git rev-parse --verify origin/darksky/np/mobile >/dev/null 2>&1; then + sha=$(git merge-base HEAD origin/darksky/np/mobile 2>/dev/null || true) + fi + if [ -z "$sha" ] && git rev-parse --verify origin/canary >/dev/null 2>&1; then + sha=$(git merge-base HEAD origin/canary 2>/dev/null || true) + fi + ;; + *) + if [ -n "${BEFORE//0/}" ]; then + if ! git cat-file -e "${BEFORE}^{commit}" 2>/dev/null; then + git fetch --no-tags --depth=50 origin "$BEFORE" >/dev/null 2>&1 || true + fi + if git cat-file -e "${BEFORE}^{commit}" 2>/dev/null; then + sha=$BEFORE + fi + fi + if [ -z "$sha" ]; then + git fetch --no-tags --depth=50 origin darksky/np/mobile:refs/remotes/origin/darksky/np/mobile >/dev/null 2>&1 || true + git fetch --no-tags --depth=50 origin canary:refs/remotes/origin/canary >/dev/null 2>&1 || true + if git rev-parse --verify origin/darksky/np/mobile >/dev/null 2>&1; then + sha=$(git merge-base HEAD origin/darksky/np/mobile 2>/dev/null || true) + elif git rev-parse --verify origin/canary >/dev/null 2>&1; then + sha=$(git merge-base HEAD origin/canary 2>/dev/null || true) + fi + fi + ;; + esac + fi + fi + + if [ -z "$sha" ]; then + force_all=true + fi + + echo "sha=$sha" >> "$GITHUB_OUTPUT" + echo "force_all=$force_all" >> "$GITHUB_OUTPUT" + + - name: Classify web host and Desktop leaf changes + id: classify + env: + BASE: ${{ steps.base.outputs.sha }} + FORCE_ALL: ${{ steps.base.outputs.force_all }} + run: | + node scripts/ci/classify-web-host-only.mjs \ + --base "$BASE" \ + --force-all "$FORCE_ALL" \ + --ref "$GITHUB_REF" \ + --event "${GITHUB_EVENT_NAME:-}" \ + --github-output "$GITHUB_OUTPUT" + + mobile-gates-and-web: + name: L0, Invariants, Web Host & Preview Tests + needs: changes + if: needs.changes.outputs.backend-only != 'true' + runs-on: ubuntu-24.04 + timeout-minutes: 20 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: L0 Tier A static gates + run: | + node scripts/ci/check-l0-tier-a.mjs + node --test scripts/ci/classify-web-host-only.test.mjs + + - name: Web mobile thin host and perf comparator tests + working-directory: packages/frontend + run: | + node --test hosts/web/tests/*.test.mjs scripts/check-snapshot-prefixes.test.mjs + node hosts/web/scripts/verify-zero-third-party-js.mjs + node --test perf/compare-n3.test.mjs + + - name: Install Linux fontconfig, Mesa Lavapipe Vulkan, and CJK fallback font + if: needs.changes.outputs.desktop-leaf-only != 'true' + run: | + sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list + sudo apt-get update + sudo apt-get install -y --no-install-recommends mesa-vulkan-drivers libvulkan1 libfontconfig1-dev libfreetype-dev fonts-wqy-zenhei + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@1.98.1 + with: + components: rustfmt, clippy + targets: wasm32-unknown-unknown + + - name: Cache Cargo artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: packages/frontend -> target + key: np-mobile-gates + shared-key: np-mobile-gates + + - name: Format check + working-directory: packages/frontend + run: cargo fmt --all -- --check + + - name: Clippy check + if: needs.changes.outputs.desktop-leaf-only != 'true' + working-directory: packages/frontend + run: cargo clippy --locked --workspace --all-targets --features harness -- -D warnings + + - name: Host and preview tests + if: needs.changes.outputs.desktop-leaf-only != 'true' + working-directory: packages/frontend + run: cargo test --locked -p affine-android-host -p affine-ios-host -p blocksuite-preview --all-features + + - name: Mobile tests + if: needs.changes.outputs.desktop-leaf-only != 'true' + working-directory: packages/frontend + run: cargo test --locked -p affine-mobile --all-targets + + - name: Mobile harness audit matrix + if: needs.changes.outputs.desktop-leaf-only != 'true' + working-directory: packages/frontend + run: cargo run --locked -p affine-mobile --features harness --bin mobile-harness -- audit-matrix + + - name: Mobile harness frame replay + if: needs.changes.outputs.desktop-leaf-only != 'true' + working-directory: packages/frontend + run: cargo run --locked -p affine-mobile --features harness --bin mobile-harness -- fps-replay + + - name: Static invariants and link-flag check + working-directory: packages/frontend + run: ./scripts/check-invariants.sh + + s1-probes-bench: + name: S1 Release Probes (SQLite, Mermaid, RaTeX, Hayro PDF) + needs: changes + if: >- + needs.changes.outputs.backend-only != 'true' && + needs.changes.outputs.web-wrapper-only != 'true' && + needs.changes.outputs.web-host-only != 'true' && + needs.changes.outputs.desktop-leaf-only != 'true' + runs-on: ubuntu-24.04 + timeout-minutes: 30 + env: + CARGO_PROFILE_RELEASE_LTO: 'false' + CARGO_PROFILE_RELEASE_CODEGEN_UNITS: '16' + CARGO_PROFILE_RELEASE_DEBUG: '0' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@1.98.1 + + - name: Cache Cargo artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: packages/frontend -> target + key: np-mobile-s1-probes-v2 + shared-key: np-mobile-s1-probes-v2 + + - name: Cache Noto CJK font + id: noto-cjk-cache + uses: actions/cache@v4 + with: + path: ~/.cache/affine-s1-fonts + key: s1-noto-cjk-${{ runner.os }}-b76b0433203017ca + + - name: Install Noto CJK font for 24-case Mermaid visual probes + run: | + NOTO_SHA256="b76b0433203017ca80401b2ee0dd69350349871c4b19d504c34dbdd80541690a" + NOTO_URL="https://github.com/notofonts/noto-cjk/raw/523d033d6cb47f4a80c58a35753646f5c3608a78/Sans/OTC/NotoSansCJK-Regular.ttc" + FONT_CACHE_DIR="$HOME/.cache/affine-s1-fonts" + FONT_CACHE_FILE="$FONT_CACHE_DIR/NotoSansCJK-Regular.ttc" + mkdir -p "$FONT_CACHE_DIR" + if ! echo "$NOTO_SHA256 $FONT_CACHE_FILE" | sha256sum -c - >/dev/null 2>&1; then + if ! curl -fsSL --retry 3 "$NOTO_URL" -o "$FONT_CACHE_FILE.tmp"; then + rm -f "$FONT_CACHE_FILE.tmp" + sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list + sudo apt-get update + sudo apt-get install -y --no-install-recommends 'fonts-noto-cjk=1:20230817+repack1-3*' + FOUND_FONT=$(find /usr/share/fonts -name 'NotoSansCJK-Regular.ttc' -print -quit) + test -s "$FOUND_FONT" + cp -f "$FOUND_FONT" "$FONT_CACHE_FILE.tmp" + fi + mv -f "$FONT_CACHE_FILE.tmp" "$FONT_CACHE_FILE" + fi + echo "$NOTO_SHA256 $FONT_CACHE_FILE" | sha256sum -c - + sudo mkdir -p /usr/share/fonts/opentype/noto + sudo cp -f "$FONT_CACHE_FILE" /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc + sudo fc-cache -f /usr/share/fonts/opentype/noto + fc-list | grep -qi "Noto Sans CJK" + echo "AFFINE_CJK_FONT=$FONT_CACHE_FILE" >> "$GITHUB_ENV" + + - name: Run S1 release probes and validate artifacts + working-directory: packages/frontend + env: + AFFINE_S1_OUT_DIR: /tmp/s1-artifacts + run: | + test -s "$AFFINE_CJK_FONT" + rm -rf /tmp/s1-artifacts + mkdir -p /tmp/s1-artifacts + t0=$(date +%s) + CARGO_ENCODED_RUSTFLAGS="" cargo test --locked --release --no-run \ + -p affine-store --test s1_sqlite_probe \ + -p blocksuite-preview --test s1_probes + echo "Compile S1 release probes duration: $(( $(date +%s) - t0 ))s" + t0=$(date +%s) + CARGO_ENCODED_RUSTFLAGS="" cargo test --locked --release \ + -p affine-store --test s1_sqlite_probe \ + -p blocksuite-preview --test s1_probes \ + -- --nocapture + echo "Run S1 release probes duration: $(( $(date +%s) - t0 ))s" + test -s /tmp/s1-artifacts/s1-sqlite-report.json + test -s /tmp/s1-artifacts/s1-probes-report.json + PNG_COUNT=$(find /tmp/s1-artifacts -maxdepth 1 -name 'mermaid-*.png' | wc -l | tr -d ' ') + echo "Generated Mermaid PNG count: $PNG_COUNT" + test "$PNG_COUNT" -eq 24 + for theme in light dark; do + for name in flowchart sequence state class pie er gantt gitgraph wrapped-latin wrapped-cjk generic-class frontmatter; do + test -s "/tmp/s1-artifacts/mermaid-${theme}-${name}.png" + done + done + + - name: Upload S1 probes report and rendered PNG artifacts + uses: actions/upload-artifact@v4 + with: + name: s1-probes-artifacts + path: /tmp/s1-artifacts + if-no-files-found: error + + preview-wasm-workers: + name: Preview Wasm Workers (4 Independent Targets) + needs: changes + if: >- + needs.changes.outputs.backend-only != 'true' && + needs.changes.outputs.desktop-rs-only != 'true' + runs-on: ubuntu-24.04 + timeout-minutes: 20 + defaults: + run: + working-directory: packages/frontend + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@1.98.1 + with: + targets: wasm32-unknown-unknown + + - name: Cache Cargo artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: packages/frontend -> target + key: np-mobile-preview-wasm + shared-key: np-mobile-preview-wasm + + - name: Install wasm-bindgen CLI and Binaryen wasm-opt + run: | + WBG_VERSION=$(awk '/^name = "wasm-bindgen"$/{getline; gsub(/"/, "", $3); print $3; exit}' Cargo.lock) + URL="https://github.com/wasm-bindgen/wasm-bindgen/releases/download/${WBG_VERSION}/wasm-bindgen-${WBG_VERSION}-x86_64-unknown-linux-musl.tar.gz" + if curl -fsSL "$URL" | tar -xz -C /tmp; then + sudo install -m 0755 "/tmp/wasm-bindgen-${WBG_VERSION}-x86_64-unknown-linux-musl/wasm-bindgen" /usr/local/bin/wasm-bindgen + else + cargo install --locked wasm-bindgen-cli --version "$WBG_VERSION" + fi + wasm-bindgen --version + BINARYEN_VERSION="version_123" + BINARYEN_SHA256="e959f2170af4c20c552e9de3a0253704d6a9d2766e8fdb88e4d6ac4bae9388fe" + curl -fsSL "https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VERSION}/binaryen-${BINARYEN_VERSION}-x86_64-linux.tar.gz" \ + -o /tmp/binaryen.tar.gz + echo "${BINARYEN_SHA256} /tmp/binaryen.tar.gz" | sha256sum -c - + tar -xzf /tmp/binaryen.tar.gz -C /tmp + rm -f /tmp/binaryen.tar.gz + sudo install -m 0755 "/tmp/binaryen-${BINARYEN_VERSION}/bin/wasm-opt" /usr/local/bin/wasm-opt + wasm-opt --version + + - name: Build and verify main playground Wasm bundle and 4 preview Wasm workers + run: | + mkdir -p /tmp/preview-wasm/pkg + REPO_ROOT="$(cd ../.. && pwd)" + CARGO_HOME_DIR="${CARGO_HOME:-$HOME/.cargo}" + WASM_RUSTFLAGS="$(printf '%s\037%s\037%s' "--remap-path-prefix=${REPO_ROOT}=/src" "--remap-path-prefix=${CARGO_HOME_DIR}=/cargo" "-Ctarget-feature=+simd128")" + work_dir=$(mktemp -d) + set -m + trap 'exit 1' USR1 + trap 'for pid in $(jobs -pr); do kill -- "-$pid" 2>/dev/null || true; done; wait || true; rm -rf "$work_dir"' EXIT + + kinds=(mermaid math typst pdf) + pids=() + optimize_wasm() { + wasm-opt -Oz --strip-debug --strip-producers \ + --enable-bulk-memory \ + --enable-nontrapping-float-to-int \ + --enable-sign-ext \ + --enable-mutable-globals \ + --enable-simd "$1" -o "$2" + } + + postprocess() ( + local kind="$1" + shift + trap 'rc=$?; if [ "$rc" -ne 0 ]; then + printf "Wasm post-processing for %s failed (status %s)\n" "$kind" "$rc" >&3 + cat "$work_dir/${kind}.log" >&3 + kill -USR1 "$$" + fi' EXIT + "$@" + ) + + # Wait on Cargo so a failed optimizer can interrupt the build. + for kind in "${kinds[@]}"; do + CARGO_ENCODED_RUSTFLAGS="$WASM_RUSTFLAGS" cargo rustc --locked --target wasm32-unknown-unknown --profile wasm-worker-size -p blocksuite-preview --lib --crate-type cdylib --no-default-features --features "${kind},wasm-worker" & + wait "$!" + cp target/wasm32-unknown-unknown/wasm-worker-size/blocksuite_preview.wasm "$work_dir/${kind}.wasm" + postprocess "$kind" optimize_wasm "$work_dir/${kind}.wasm" "/tmp/preview-wasm/${kind}.wasm" 3>&2 > "$work_dir/${kind}.log" 2>&1 & + pids+=("$!") + done + CARGO_ENCODED_RUSTFLAGS="$WASM_RUSTFLAGS" cargo build --locked --profile wasm-release-size -p playground --lib --target wasm32-unknown-unknown & + wait "$!" + + bindgen_playground() { + wasm-bindgen --target web --out-dir /tmp/preview-wasm/pkg target/wasm32-unknown-unknown/wasm-release-size/playground.wasm + optimize_wasm /tmp/preview-wasm/pkg/playground_bg.wasm /tmp/preview-wasm/pkg/playground_bg.opt.wasm + mv /tmp/preview-wasm/pkg/playground_bg.opt.wasm /tmp/preview-wasm/pkg/playground_bg.wasm + } + postprocess playground bindgen_playground 3>&2 > "$work_dir/playground.log" 2>&1 & + pids+=("$!") + kinds+=(playground) + for i in "${!pids[@]}"; do + wait "${pids[$i]}" + kind=${kinds[$i]} + echo "=== $kind Wasm post-processing ===" + cat "$work_dir/${kind}.log" + done + for kind in mermaid math typst pdf; do + test -s "/tmp/preview-wasm/${kind}.wasm" + done + test -s /tmp/preview-wasm/pkg/playground_bg.wasm + { + echo "### 5-Wasm Bundle Sizes (post wasm-opt -Oz)" + echo "| Artifact | Raw (bytes) | Raw (KB) | Gzip (bytes) | Gzip (KB) |" + echo "|---|---:|---:|---:|---:|" + for f in /tmp/preview-wasm/pkg/playground_bg.wasm /tmp/preview-wasm/mermaid.wasm /tmp/preview-wasm/math.wasm /tmp/preview-wasm/typst.wasm /tmp/preview-wasm/pdf.wasm; do + raw_b=$(wc -c < "$f" | tr -d ' ') + gz_b=$(gzip -c -9 "$f" | wc -c | tr -d ' ') + raw_kb=$(awk "BEGIN { printf \"%.1f\", $raw_b / 1024 }") + gz_kb=$(awk "BEGIN { printf \"%.1f\", $gz_b / 1024 }") + echo "| \`$(basename "$f")\` | ${raw_b} | ${raw_kb} KB | ${gz_b} | ${gz_kb} KB |" + done + } | tee -a "${GITHUB_STEP_SUMMARY:-/dev/null}" + node hosts/web/scripts/stage-preview-workers.mjs /tmp/preview-wasm dev-local + node hosts/web/scripts/verify-preview-workers-e2e.mjs + + - name: Warm Chromium binary into OS page cache + run: | + CHROME_WARM_BIN=${CHROME_PATH:-${CHROME_BIN:-}} + if [ -z "$CHROME_WARM_BIN" ]; then + wrapper= + for bin in /usr/bin/google-chrome-stable /usr/bin/google-chrome /usr/bin/chromium /usr/bin/chromium-browser; do + [ -e "$bin" ] || continue + if [ "$(head -c 2 "$bin" 2>/dev/null)" = '#!' ]; then + wrapper=${wrapper:-$bin} + else + CHROME_WARM_BIN=$bin + break + fi + done + if [ -z "$CHROME_WARM_BIN" ] && [ -d "$HOME/.cache/ms-playwright" ]; then + CHROME_WARM_BIN=$(find "$HOME/.cache/ms-playwright" -name chrome -type f -print -quit) + fi + CHROME_WARM_BIN=${CHROME_WARM_BIN:-$wrapper} + fi + if [ -z "$CHROME_WARM_BIN" ] || [ ! -e "$CHROME_WARM_BIN" ]; then + echo "warning: skipping Chromium warm-up (no binary found)" >&2 + exit 0 + fi + WARM_PROFILE=$(mktemp -d "${TMPDIR:-/tmp}/np-chrome-warm.XXXXXX") + trap 'rm -rf "$WARM_PROFILE"' EXIT + status=0 + timeout --kill-after=2s 20s "$CHROME_WARM_BIN" --headless=new --no-sandbox --disable-gpu --disable-dbus --disable-dev-shm-usage --user-data-dir="$WARM_PROFILE" --dump-dom about:blank >/dev/null || status=$? + rm -rf "$WARM_PROFILE" + trap - EXIT + if [ "$status" -ne 0 ]; then + echo "warning: Chromium warm-up exited with status $status; continuing to test harness" >&2 + fi + + - name: Verify real-browser IndexedDB storage and V1 Yjs extraction + run: node hosts/web/scripts/verify-idb-real-browser.mjs + + - name: Verify real-browser S3-Web GPU recovery, selection menu, and lazy hayro PDF worker + run: node hosts/web/scripts/verify-s3-web-real-browser.mjs + + - name: Verify real-browser Canary dual-shell staging, zero-empty-IDB guard, and crash fallback CRDT round-trip + run: node hosts/web/scripts/verify-canary-dual-shell-browser.mjs /tmp/preview-wasm + + android-host: + name: Android Thin Host (NDK .so Link & kotlinc) + needs: changes + if: >- + needs.changes.outputs.backend-only != 'true' && + needs.changes.outputs.web-wrapper-only != 'true' && + needs.changes.outputs.web-host-only != 'true' && + needs.changes.outputs.desktop-leaf-only != 'true' + runs-on: ubuntu-24.04 + timeout-minutes: 20 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Cache Kotlin compiler archive + uses: actions/cache@v4 + with: + path: ${{ runner.temp }}/kotlin-compiler-2.1.20.zip + key: kotlinc-2.1.20-v1 + + - name: Install Kotlin compiler + run: | + archive="$RUNNER_TEMP/kotlin-compiler-2.1.20.zip" + checksum="a118197b0de55ffab2bc8d5cd03a5e39033cfb53383d6931bc761dec0784891a $archive" + if [ ! -f "$archive" ] || ! printf '%s\n' "$checksum" | sha256sum --check --status; then + curl -fsSL https://github.com/JetBrains/kotlin/releases/download/v2.1.20/kotlin-compiler-2.1.20.zip -o "$archive" + printf '%s\n' "$checksum" | sha256sum --check + fi + unzip -q "$archive" -d "$RUNNER_TEMP" + "$RUNNER_TEMP/kotlinc/bin/kotlinc" -version + echo "$RUNNER_TEMP/kotlinc/bin" >> "$GITHUB_PATH" + + - name: Install Rust toolchain with Android target + uses: dtolnay/rust-toolchain@1.98.1 + with: + targets: aarch64-linux-android + + - name: Cache Cargo artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: packages/frontend -> target + key: np-mobile-android-host + shared-key: np-mobile-android-host + + - name: Install Linux fontconfig and freetype headers for host tests + run: | + sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list + sudo apt-get update + sudo apt-get install -y --no-install-recommends pkg-config libfontconfig1-dev libfreetype-dev + + - name: Link Android NDK arm64-v8a .so binary + working-directory: packages/frontend + run: | + NDK_BIN="$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin" + export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$NDK_BIN/aarch64-linux-android24-clang" + export CC_aarch64_linux_android="$NDK_BIN/aarch64-linux-android24-clang" + export AR_aarch64_linux_android="$NDK_BIN/llvm-ar" + cargo build --locked -p affine-android-host --target aarch64-linux-android + SRC="target/aarch64-linux-android/debug/libaffine_android_host.so" + test -s "$SRC" + DST="/tmp/libaffine_android_host_aarch64-linux-android.stripped.so" + cp "$SRC" "$DST" + "$NDK_BIN/llvm-strip" --strip-unneeded "$DST" + BYTES=$(stat -c '%s' "$DST") + MAX_BYTES=165000000 + echo "Stripped aarch64-linux-android libaffine_android_host.so bytes: ${BYTES} (max ${MAX_BYTES})" + test "$BYTES" -le "$MAX_BYTES" + + - name: Compile Android thin host Kotlin sources with kotlinc and run real JNI parity check + run: | + ANDROID_JAR=$(ls -1 "$ANDROID_HOME"/platforms/android-*/android.jar | sort -V | tail -n 1) + echo "Using Android SDK jar: $ANDROID_JAR" + cargo build --locked --manifest-path packages/frontend/Cargo.toml -p affine-android-host --features host-jni + test -s packages/frontend/target/debug/libaffine_android_host.so + mkdir -p /tmp/affine-android-kotlin + kotlinc -classpath "$ANDROID_JAR" \ + -d /tmp/affine-android-kotlin \ + packages/frontend/hosts/android/kotlin/app/affine/pro/host/MainActivity.kt \ + packages/frontend/hosts/android/kotlin/app/affine/pro/host/LegacyLocalStorageProbe.kt \ + packages/frontend/hosts/android/kotlin/app/affine/pro/host/AndroidBootstrapCoordinator.kt \ + packages/frontend/hosts/android/kotlin/app/affine/pro/host/AuthDataStore.kt \ + packages/frontend/hosts/android/kotlin/app/affine/pro/host/ShareIntentBridge.kt \ + packages/frontend/hosts/android/kotlin/app/affine/pro/host/ShareReceiverActivity.kt \ + packages/frontend/hosts/android/tests/ImeHostParityCheck.kt + test -s /tmp/affine-android-kotlin/app/affine/pro/host/MainActivity.class + test -s /tmp/affine-android-kotlin/app/affine/pro/host/ShareReceiverActivity.class + test -s /tmp/affine-android-kotlin/app/affine/pro/host/AffineImeController.class + test -s /tmp/affine-android-kotlin/app/affine/pro/host/AffineInputConnection.class + test -s /tmp/affine-android-kotlin/app/affine/pro/host/LegacyLocalStorageProbe.class + test -s /tmp/affine-android-kotlin/app/affine/pro/host/AndroidBootstrapCoordinator.class + test -s /tmp/affine-android-kotlin/app/affine/pro/host/AuthSessionStore.class + test -s /tmp/affine-android-kotlin/app/affine/pro/host/AuthTokenCipher.class + kotlin -J-Djava.library.path="$PWD/packages/frontend/target/debug" \ + -cp "/tmp/affine-android-kotlin:$ANDROID_JAR" \ + ImeHostParityCheckKt + ./packages/frontend/hosts/android/scripts/package-debug-apk.sh /tmp/android-apk + rm -rf /tmp/android-apk/work + sha256sum /tmp/android-apk/AffineAndroidHost-debug.apk | tee /tmp/android-apk/AffineAndroidHost-debug.apk.sha256 + + - name: Upload signed Android debug APK artifact + uses: actions/upload-artifact@v4 + with: + name: android-debug-apk + path: | + /tmp/android-apk/AffineAndroidHost-debug.apk + /tmp/android-apk/AffineAndroidHost-debug.apk.sha256 + if-no-files-found: error + + ios-device-check: + name: iOS Device SDK Check (ui & affine-ios-host) + needs: changes + if: >- + needs.changes.outputs.backend-only != 'true' && + needs.changes.outputs.web-wrapper-only != 'true' && + needs.changes.outputs.web-host-only != 'true' && + needs.changes.outputs.desktop-leaf-only != 'true' && + needs.changes.outputs.apple-specific == 'true' + runs-on: macos-15 + timeout-minutes: 20 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust toolchain with iOS device target + uses: dtolnay/rust-toolchain@1.98.1 + with: + targets: aarch64-apple-ios + + - name: Cache Cargo artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: packages/frontend -> target + shared-key: ios-device-check + key: np-mobile-ios-device-v1 + + - name: Check affine-ios-host and ui for iOS device target + working-directory: packages/frontend + env: + CARGO_PROFILE_DEV_DEBUG: '0' + CARGO_INCREMENTAL: '0' + run: cargo check --locked -p ui -p affine-ios-host --target aarch64-apple-ios + + ios-host: + name: iOS Thin Host (Rust staticlib & Swift Simulator Link) + needs: changes + if: >- + needs.changes.outputs.backend-only != 'true' && + needs.changes.outputs.web-wrapper-only != 'true' && + needs.changes.outputs.web-host-only != 'true' && + needs.changes.outputs.desktop-leaf-only != 'true' && + needs.changes.outputs.apple-specific == 'true' + runs-on: macos-15 + timeout-minutes: 20 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust toolchain with iOS Simulator target + uses: dtolnay/rust-toolchain@1.98.1 + with: + targets: aarch64-apple-ios-sim + + - name: Cache Cargo artifacts + uses: Swatinem/rust-cache@v2 + with: + workspaces: packages/frontend -> target + shared-key: ios-sim-host + key: np-mobile-ios-host-v5 + + - name: Build the iOS staticlib and select a Simulator + working-directory: packages/frontend + env: + CARGO_PROFILE_DEV_DEBUG: '0' + CARGO_INCREMENTAL: '0' + shell: bash + run: bash hosts/ios/scripts/check-sim-host.sh + + - name: Link zero-CocoaPods Swift iOS host and run 7/7 Simulator smoke tests + shell: bash + run: | + run_timed() { + local label="$1" started=$SECONDS rc=0 + shift + echo "$(date -u +%FT%TZ) Start $label" + "$@" || rc=$? + echo "$(date -u +%FT%TZ) End $label after $(( SECONDS - started ))s (status $rc)" + return "$rc" + } + + smoke_dir=$(mktemp -d "${RUNNER_TEMP:-/tmp}/ios-host.XXXXXXXX") + trap 'rm -rf "$smoke_dir"' EXIT + SDK=$(xcrun --sdk iphonesimulator --show-sdk-path) + SMOKE_SOURCES=() + for f in packages/frontend/hosts/ios/Sources/*.swift; do + case "$(basename "$f")" in + AppDelegate.swift|SceneDelegate.swift|main.swift) continue ;; + esac + SMOKE_SOURCES+=("$f") + done + + swift_flags=( + -emit-executable + -sdk "$SDK" + -target arm64-apple-ios16.0-simulator + -import-objc-header packages/frontend/hosts/ios/include/affine_mobile_host.h + -L packages/frontend/target/aarch64-apple-ios-sim/debug + -laffine_ios_host + -framework UIKit + -framework QuartzCore + -framework Metal + -framework WebKit + -framework PDFKit + -framework CoreText + -framework CoreGraphics + -framework CoreVideo + -framework CoreFoundation + -framework Foundation + -framework UniformTypeIdentifiers + -framework StoreKit + -framework AuthenticationServices + ) + + prepare_simulator() { + local boot_output boot_rc=0 + case "$SIM_STATE" in + Shutdown) + boot_output=$(xcrun simctl boot "$SIM_UDID" 2>&1) || boot_rc=$? + if [ "$boot_rc" -ne 0 ]; then + printf '%s\n' "$boot_output" >&2 + if ! grep -Exq 'Unable to boot device in current state: (Booted|Booting)' <<< "$boot_output"; then + return "$boot_rc" + fi + fi + ;; + Booted|Booting) ;; + *) echo "Unexpected Simulator state $SIM_STATE for $SIM_UDID" >&2; return 1 ;; + esac + xcrun simctl bootstatus "$SIM_UDID" -b || return $? + echo "$(date -u +%FT%TZ) Simulator ready: $SIM_UDID" + } + + # Each task reports when it finishes so failures appear in completion order. + mkfifo "$smoke_dir/completed" + exec 3<>"$smoke_dir/completed" + run_parallel() { + set +m + local label="$1" started=$SECONDS rc=0 + run_timed "$@" > "$smoke_dir/$label.log" 2>&1 || rc=$? + printf '%s %s\n' "$label" "$(( SECONDS - started ))" >&3 + return "$rc" + } + + # Give each task a process group so cancellation reaches its child processes. + set -m + run_parallel AffineIosHost swiftc "${swift_flags[@]}" \ + -o "$smoke_dir/AffineIosHost" packages/frontend/hosts/ios/Sources/*.swift & + host_pid=$! + run_parallel IosHostS3SmokeTest swiftc "${swift_flags[@]}" \ + -o "$smoke_dir/IosHostS3SmokeTest" "${SMOKE_SOURCES[@]}" \ + packages/frontend/hosts/ios/tests/IosHostS3SmokeTest.swift & + smoke_link_pid=$! + run_parallel Simulator prepare_simulator & + simulator_pid=$! + set +m + + parallel_rc=0 + swift_s=0 + for _ in 1 2 3; do + read -r label elapsed <&3 + case "$label" in + AffineIosHost) pid=$host_pid ;; + IosHostS3SmokeTest) pid=$smoke_link_pid ;; + Simulator) + pid=$simulator_pid + echo "sim_boot_s=$elapsed" + ;; + esac + if [[ "$label" != Simulator && "$elapsed" -gt "$swift_s" ]]; then + swift_s=$elapsed + fi + rc=0 + wait "$pid" || rc=$? + cat "$smoke_dir/$label.log" + if [ "$rc" -ne 0 ]; then + echo "::error::$label failed with status $rc" + parallel_rc=$rc + break + fi + done + exec 3>&- + if [ "$parallel_rc" -ne 0 ]; then + task_groups=("-$host_pid" "-$smoke_link_pid" "-$simulator_pid") + kill -TERM -- "${task_groups[@]}" 2>/dev/null || true + sleep 0.1 + kill -KILL -- "${task_groups[@]}" 2>/dev/null || true + wait "$host_pid" "$smoke_link_pid" "$simulator_pid" || true + exit "$parallel_rc" + fi + + echo "swift_s=$swift_s" + test -s "$smoke_dir/AffineIosHost" + test -s "$smoke_dir/IosHostS3SmokeTest" + echo "Running iOS smoke tests on Simulator UDID: $SIM_UDID" + smoke_started=$SECONDS + if run_timed "Seven iOS smoke tests" env SIMCTL_CHILD_NSUnbufferedIO=YES \ + xcrun simctl spawn "$SIM_UDID" "$smoke_dir/IosHostS3SmokeTest"; then + echo "smoke_s=$(( SECONDS - smoke_started ))" + echo "$(date -u +%FT%TZ) Seven iOS smoke tests passed" + else + rc=$? + echo "smoke_s=$(( SECONDS - smoke_started ))" + echo "::warning::IosHostS3SmokeTest exited with status $rc; collecting last 2m Simulator WebKit logs" >&2 + perl -e 'alarm 15; exec @ARGV' -- xcrun simctl spawn "$SIM_UDID" log show \ + --last 2m \ + --style compact \ + --predicate 'subsystem BEGINSWITH "com.apple.WebKit" OR process CONTAINS "WebContent" OR process CONTAINS "Networking" OR process CONTAINS "IosHostS3SmokeTest"' \ + 2>&1 | tail -n 200 >&2 || true + exit "$rc" + fi + + - name: Shutdown iOS Simulator + if: always() && env.SIM_UDID != '' + timeout-minutes: 1 + continue-on-error: true + run: | + echo "$(date -u +%FT%TZ) Shut down Simulator $SIM_UDID" + xcrun simctl shutdown "$SIM_UDID" + echo "$(date -u +%FT%TZ) Simulator shut down" + + - name: Remove iOS host archives before cache save + working-directory: packages/frontend/target/aarch64-apple-ios-sim/debug + run: rm -f libaffine_ios_host.a deps/libaffine_ios_host* diff --git a/.github/workflows/np-web-build.yml b/.github/workflows/np-web-build.yml new file mode 100644 index 0000000000..88e23849f4 --- /dev/null +++ b/.github/workflows/np-web-build.yml @@ -0,0 +1,73 @@ +name: Native Playground Web Build + +# Production bundles of the web, mobile web and admin apps, without the +# Electron binary, Playwright browsers or Sentry CLI downloads. +# native-playground.yml calls this only when frontend sources change. +on: + workflow_call: + +env: + ELECTRON_SKIP_BINARY_DOWNLOAD: '1' + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' + SENTRYCLI_SKIP_DOWNLOAD: '1' + +jobs: + build: + name: Build ${{ matrix.package }} + runs-on: ubuntu-24.04 + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + package: + - '@affine/web' + - '@affine/mobile' + - '@affine/admin' + env: + BUILD_TYPE: canary + NODE_OPTIONS: --max-old-space-size=8192 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + electron-install: false + playwright-install: false + full-cache: true + + - name: Run i18n codegen + run: | + yarn affine @affine/i18n build + git checkout packages/frontend/i18n/src/i18n-completenesses.json + + - name: Build ${{ matrix.package }} + # The bundle itself must stay within eight minutes. + timeout-minutes: 8 + run: yarn affine ${{ matrix.package }} build + + - name: Check the bundle entry exists + # `affine bundle` can report an internal error and still exit 0. + run: | + case '${{ matrix.package }}' in + '@affine/web') dist=packages/frontend/apps/web/dist ;; + '@affine/mobile') + dist=packages/frontend/apps/mobile/dist + test -s "$dist/assets-manifest.json" + node -e ' + const fs = require("node:fs"); + const path = require("node:path"); + const dist = process.argv[1]; + const m = JSON.parse(fs.readFileSync(path.join(dist, "assets-manifest.json"), "utf8")); + if (!Array.isArray(m.js) || m.js.length === 0) throw new Error("Empty @affine/mobile js manifest"); + for (const rel of [...(m.js || []), ...(m.css || [])]) { + const p = path.join(dist, String(rel).replace(/^\/+/, "")); + if (!fs.existsSync(p)) throw new Error("Missing @affine/mobile asset: " + p); + } + ' "$dist" + ;; + '@affine/admin') dist=packages/frontend/admin/dist ;; + esac + test -s "$dist/index.html" + du -sh "$dist" diff --git a/.github/workflows/np-web-fast.yml b/.github/workflows/np-web-fast.yml new file mode 100644 index 0000000000..9d3f36d918 --- /dev/null +++ b/.github/workflows/np-web-fast.yml @@ -0,0 +1,86 @@ +name: Native Playground Web Fast Checks + +on: + workflow_call: + +env: + ELECTRON_SKIP_BINARY_DOWNLOAD: '1' + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' + SENTRYCLI_SKIP_DOWNLOAD: '1' + +jobs: + lint: + name: Web Lint + runs-on: ubuntu-24.04 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + electron-install: false + full-cache: true + + - name: Run oxlint + run: yarn lint:ox + + - name: Run i18n codegen + run: | + yarn affine @affine/i18n build + git checkout packages/frontend/i18n/src/i18n-completenesses.json + + - name: Run oxfmt + # setup-node may rewrite .yarnrc.yml (nmMode); format-check the tracked file. + run: | + git checkout .yarnrc.yml + yarn lint:format + + typecheck: + name: Web Typecheck + runs-on: ubuntu-24.04 + env: + NODE_OPTIONS: --max-old-space-size=12288 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + electron-install: false + full-cache: true + + - name: Run i18n codegen + run: | + yarn affine @affine/i18n build + git checkout packages/frontend/i18n/src/i18n-completenesses.json + + - name: Run type check + run: yarn typecheck + + unit-test: + name: Web Unit Test (Node projects) + runs-on: ubuntu-24.04 + env: + DISTRIBUTION: web + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: ./.github/actions/setup-node + with: + electron-install: false + playwright-install: false + full-cache: true + + - name: Run Vitest Node projects + # Browser-mode, Electron and Rust-binary projects need downloads or + # builds this lane skips; build-test.yml and js-room-coop run them. + run: | + set -euo pipefail + raw="$(node scripts/ci/vitest-node-projects.mjs)" + read -r -a projects <<< "$raw" + test "${#projects[@]}" -gt 0 + yarn vitest run "${projects[@]}" diff --git a/.gitignore b/.gitignore index e1234d867d..17ee0686fe 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,11 @@ storageState.json /.playwright-browsers/ **/.vitest-attachments/ /blocksuite/framework/std/src/__tests__/gfx/__screenshots__/ +/packages/frontend/target/ +/packages/frontend/artifacts/ +/packages/frontend/hosts/web/assets/*.wasm +/packages/frontend/hosts/web/assets/fonts/*.ttf +/blocksuite/crates/playground/web/assets/ +/blocksuite/crates/playground/web/pkg/ +/blocksuite/crates/playground/web/wasm-scalar-rpc.js +/blocksuite/crates/playground/web/workers/ diff --git a/.oxfmtrc.json b/.oxfmtrc.json index 0fd2b803b7..fd36a88d85 100644 --- a/.oxfmtrc.json +++ b/.oxfmtrc.json @@ -6,5 +6,9 @@ "tabWidth": 2, "arrowParens": "avoid", "sortPackageJson": false, - "ignorePatterns": ["**/*.toml"] + "ignorePatterns": [ + "**/*.toml", + "packages/frontend/artifacts/**", + "blocksuite/crates/playground/web/pkg/**" + ] } diff --git a/.oxlintrc.json b/.oxlintrc.json index 606e839ca1..9ecd11021f 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -43,6 +43,7 @@ ".vscode", ".context", ".codex", + ".agents", ".yarnrc.yml", ".docker", "**/.storybook", @@ -72,6 +73,11 @@ "tests/blocksuite/snapshots", "tests/oracle-contracts/**", "packages/backend/server-types/assets/*.license.json", + "packages/ui/**", + "packages/frontend/perf/**", + "packages/frontend/scripts/**", + "packages/frontend/artifacts/**", + "blocksuite/crates/**", "blocksuite/docs/api/**", "blocksuite/docs-site/.vitepress/.temp/**", "blocksuite/docs-site/api/**", diff --git a/.prettierignore b/.prettierignore index 9a3f88b5a3..5d8b7db3ed 100644 --- a/.prettierignore +++ b/.prettierignore @@ -42,10 +42,15 @@ packages/frontend/apps/ios/App/** tests/blocksuite/snapshots tests/oracle-contracts/** packages/backend/server-types/assets/*.license.json +packages/backend/native/src/*.license.json +packages/ui/** +packages/frontend/perf/** +packages/frontend/scripts/** +packages/frontend/artifacts/** +blocksuite/crates/** blocksuite/docs/api/** blocksuite/docs-site/.vitepress/.temp/** blocksuite/docs-site/api/** packages/frontend/admin/src/config.json **/test-docs.json **/test-blocks.json -packages/backend/native/src/*.license.json diff --git a/AGENTS.md b/AGENTS.md index 6e3ae6d286..f8de656bd3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,6 +1,6 @@ # Working on AFFiNE Native Playground (for agents) -These rules apply at the repository root on the `darksky/native-playground` branch and on topic branches under `darksky/np/**`. Subdirectory `AGENTS.md` files (for example `packages/backend/AGENTS.md`) give narrower rules beside the code they govern. +These rules apply at the repository root on the `darksky/native-playground` branch and on topic branches under `darksky/np/**`. Subdirectory `AGENTS.md` files (for example `packages/frontend/AGENTS.md`, `packages/ui/AGENTS.md`, and `blocksuite/crates/AGENTS.md`) give narrower rules beside the code they govern. ## Branch and CI workflow @@ -12,11 +12,13 @@ These rules apply at the repository root on the `darksky/native-playground` bran - **Performance regression gate:** A CI benchmark metric can regress by **more than 10%** against the rolling `N-3` baseline. In that case, the performance guardian reviews the change before it lands. -- **Cargo rustflags isolation:** Root `.cargo/config.toml` adds NAPI linker flags (`-all_load`, `-undefined dynamic_lookup`, `-z nodelete`). Cargo joins these flags into nested workspaces. Always set `CARGO_ENCODED_RUSTFLAGS=""` when you build and test the standalone `packages/backend/` workspace. +- **Cargo rustflags isolation:** Root `.cargo/config.toml` adds NAPI linker flags (`-all_load`, `-undefined dynamic_lookup`, `-z nodelete`). Cargo joins these flags into nested workspaces. Always set `CARGO_ENCODED_RUSTFLAGS=""` when you build and test `packages/frontend/` and the standalone `packages/backend/` workspace. - **Static gates:** `node scripts/ci/check-l0-tier-a.mjs` has no dependencies and runs in under a second. It guards the `packages/backend/` layering and hygiene. It also guards workflow references and the `waitForTimeout` / `.skip` ratchet in `scripts/ci/l0-ratchet.json`. The ratchet counts can only go down. To lower the ceiling, run the script with `--update-baseline`. -- **Fast lanes:** `native-playground.yml` always runs the L0 Tier-A check. It also always runs the frozen server contract checks (`scripts/oracle`), the `packages/backend/` checks and the `tools/parity-harness` checks. +- **Fast lanes:** `native-playground.yml` always runs the zero-dependency L0 Tier-A check (`scripts/ci/check-l0-tier-a.mjs`) in `changes`. It runs the frozen server contract checks (`scripts/oracle`), `packages/backend/`, `tools/parity-harness`, zero-backend CSF geometry audit (`scripts/ci/check-csf-frame-audit.mjs`), and `cloud-e2e-rust-server` lanes only when backend, contract, harness, or cloud test sources change (`backend`), and it runs the Rust UI and editor lanes (`lint-and-wasm`, `headless-linux-and-perf`, `macos-headless`, and `js-room-coop`) only when client, UI, or BlockSuite sources change (`native-ui`). Topic branches under `darksky/np/mobile-*` compute changed paths against `origin/darksky/np/mobile`. Topic branches run Apple jobs only when Apple paths, Cargo or CI files, or Apple `cfg` lines change. Trunk pushes, pull requests, and manual runs run all Apple checks. + +- **Web lanes:** `native-playground.yml` calls `np-web-fast.yml` only when web sources change. That lane runs lint, typecheck and the Node-only Vitest projects. It calls `np-web-build.yml` only when frontend sources change. That lane builds the production bundles of `@affine/web`, `@affine/mobile` and `@affine/admin`. It downloads no Electron or Playwright binaries, and each bundle has eight minutes. ## Pull requests and evidence diff --git a/packages/frontend/AGENTS.md b/packages/frontend/AGENTS.md new file mode 100644 index 0000000000..37c40ba72b --- /dev/null +++ b/packages/frontend/AGENTS.md @@ -0,0 +1,49 @@ +# Working in `packages/frontend/` (for agents) + +`packages/frontend/` holds the client Rust Cargo workspace (`Cargo.toml` and `Cargo.lock`) alongside legacy TypeScript frontend packages. +It uses `resolver = "3"`, edition 2024, and its own `rust-toolchain.toml` (`1.98.1` with `wasm32-unknown-unknown`) and `rustfmt.toml`. + +## Workspace boundaries and four-domain guards + +- `packages/frontend/Cargo.toml` lists every client member crate explicitly (`../ui/tokens`, `../ui/ui`, `../ui/kit`, `../common/store`, `legacy-import`, `client`, `mobile`, `desktop`, `../../blocksuite/crates/doc`, `../../blocksuite/crates/editor`, `../../blocksuite/crates/playground`, `../../blocksuite/crates/preview`, `hosts/android`, and `hosts/ios`). + Never use directory wildcards that can scan asset directories. +- `packages/frontend/Cargo.toml` excludes `native` and `mobile-native`. + Those legacy crates remain members of the root `Cargo.toml` workspace. +- Legacy directories (`native/`, `mobile-native/`, and `apps/`) carry a `1.97.1` `rust-toolchain.toml` file that matches the repository root byte-for-byte. + `native/` and `mobile-native/` also carry a `rustfmt.toml` file that matches the repository root byte-for-byte. +- Client trees (`packages/frontend/`, `packages/ui/`, `blocksuite/crates/`, and `packages/common/store/`) share byte-identical `1.98.1` `rust-toolchain.toml` and client `rustfmt.toml` files. +- `scripts/check-invariants.sh` discovers client workspace members from `cargo metadata --locked --no-deps`, enforces four-domain acyclic dependencies (zero reverse edges), checks domain isolation, wall-clock isolation, zero tester branches, module structure, LOC ceilings, toolchain/rustfmt alignment, `workspace_root` resolution, `rustup show active-toolchain` for legacy (`1.97.1`) and client (`1.98.1`) directories, workflow YAML validity, `CARGO_ENCODED_RUSTFLAGS=""` link-flag isolation, and that every harness snapshot ID prefix in `scripts/check-snapshot-prefixes.mjs` still occurs in non-test Rust sources under `blocksuite/crates/*/src` and `packages/frontend/desktop/src`. +- See `packages/ui/AGENTS.md`, `blocksuite/crates/AGENTS.md`, and `packages/common/store/AGENTS.md` for domain-specific invariants. + +### Performance guardrail and theme/style oracle + +- **`perf/` (`schema.json`, `accepted.json`, `compare-n3.mjs`, `compare-n3.test.mjs`)**: Zero-dependency rolling `N-3` CI comparator with strict schema validation and rerun history anchoring (`--run-id` `created_at` cutoff + pagination). Deterministic byte sizes (`artifacts_bytes.*`), work counters (non-`_ms` `benchmarks.*`), and unacknowledged `DROPPED` / `--require-n3` `BOOTSTRAP` metrics are hard-gated (`--fail-on-regression` exits `1`); shared-runner wall-clock timings (`benchmarks.*_ms` at `> 10%`, `ci_wall_ms.*` at `> 10%` and `> 15_000 ms`) are report-only `ADVISORY_SLOWDOWN`. Intentional changes are acknowledged in `packages/frontend/perf/accepted.json` via `action: "ceiling"` (`{ metric, accepted_value, reason }`), `action: "bootstrap"` (newly added metrics under `--require-n3`), or `action: "drop"` (retired metrics), with report-only `stale_acceptances` once the rolling `N-3` baseline catches up. Unmeasured sub-keys are omitted or `null` (never padded with synthetic `0`s). + +## Build & verification commands + +Always clear inherited root rustflags: + +```sh +CARGO_ENCODED_RUSTFLAGS="" cargo fmt --all -- --check +CARGO_ENCODED_RUSTFLAGS="" cargo clippy --locked --workspace --all-targets --features harness -- -D warnings +CARGO_ENCODED_RUSTFLAGS="" cargo check --locked -p ui-tokens -p ui -p ui-kit -p blocksuite-editor -p playground --target wasm32-unknown-unknown +CARGO_ENCODED_RUSTFLAGS="" cargo check --locked -p blocksuite-playground-doc --no-default-features --target wasm32-unknown-unknown +CARGO_ENCODED_RUSTFLAGS="" cargo check --locked -p affine-store --no-default-features --target wasm32-unknown-unknown +CARGO_ENCODED_RUSTFLAGS="" cargo test --locked --workspace +CARGO_ENCODED_RUSTFLAGS="" cargo test --locked --workspace --features harness +CARGO_ENCODED_RUSTFLAGS="" cargo run --locked --bin bs-harness --features harness -- render --theme dark --mode page --out frame.png --snapshot frame.json +CARGO_ENCODED_RUSTFLAGS="" cargo run --locked --bin bs-harness --features harness -- probes +CARGO_ENCODED_RUSTFLAGS="" cargo run --locked --bin bs-harness --features harness -- bench --json perf-metrics.json +CARGO_ENCODED_RUSTFLAGS="" cargo run --locked --bin bs-harness --features harness -- render-surface-sample --theme light --out surface-light.png --snapshot surface-light.json +CARGO_ENCODED_RUSTFLAGS="" cargo run --locked --bin bs-harness --features harness -- render-editor artifacts/editor +CARGO_ENCODED_RUSTFLAGS="" cargo run --locked --bin bs-harness --features harness -- render --state slash_menu_open --out slash.png --snapshot slash.json +CARGO_ENCODED_RUSTFLAGS="" cargo run --locked --bin bs-harness --features harness -- audit-states +CARGO_ENCODED_RUSTFLAGS="" cargo run --locked --bin bs-harness --features harness -- fps-check +CARGO_ENCODED_RUSTFLAGS="" cargo run --locked --bin bs-harness --features harness -- record-demo artifacts/demo +./scripts/check-invariants.sh +node --test perf/compare-n3.test.mjs +node ../ui/tokens/extract-tokens.mjs --check +rustc --edition 2024 --test -D warnings ../ui/tokens/tokens.rs -o /tmp/tokens_test && /tmp/tokens_test +rustc --edition 2024 --test -D warnings ../ui/tokens/icons.rs -o /tmp/icons_test && /tmp/icons_test +rm -f /tmp/tokens_test /tmp/icons_test +``` diff --git a/packages/frontend/CLAUDE.md b/packages/frontend/CLAUDE.md new file mode 100644 index 0000000000..43c994c2d3 --- /dev/null +++ b/packages/frontend/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/packages/frontend/Cargo.lock b/packages/frontend/Cargo.lock new file mode 100644 index 0000000000..a5e7a94b03 --- /dev/null +++ b/packages/frontend/Cargo.lock @@ -0,0 +1,8340 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" + +[[package]] +name = "addr2line" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e567177890eb1617b1f774005b66b26b2377afd138a2ca37aae7d8f0c81429d4" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "affine-android-host" +version = "0.1.0" +dependencies = [ + "affine-client", + "affine-legacy-import", + "affine-mobile", + "affine-store", + "anyhow", + "base64 0.22.1", + "blocksuite-playground-doc", + "chrono", + "futures", + "playground", + "raw-window-handle", + "serde", + "serde_json", + "sha2 0.10.9", + "smallvec", + "sqlx", + "tokio", + "ui", + "ui-tokens", + "url", + "uuid", + "y-octo", +] + +[[package]] +name = "affine-client" +version = "0.1.0" +dependencies = [ + "affine-legacy-import", + "affine-store", + "blocksuite-editor", + "blocksuite-playground-doc", + "getrandom 0.3.4", + "serde", + "serde_json", + "thiserror 2.0.21", + "tokio", + "y-octo", +] + +[[package]] +name = "affine-desktop" +version = "0.1.0" +dependencies = [ + "affine-client", + "affine-store", + "anyhow", + "blocksuite-editor", + "blocksuite-playground-doc", + "image", + "js-sys", + "playground", + "serde", + "serde_json", + "sha2 0.10.9", + "tokio", + "ui", + "ui-kit", + "ui-tokens", + "unicode-normalization", + "wasm-bindgen", + "y-octo", +] + +[[package]] +name = "affine-ios-host" +version = "0.1.0" +dependencies = [ + "affine-client", + "affine-legacy-import", + "affine-mobile", + "affine-store", + "anyhow", + "blocksuite-playground-doc", + "chrono", + "futures", + "parking_lot", + "playground", + "raw-window-handle", + "serde", + "serde_json", + "smallvec", + "sqlx", + "thiserror 2.0.21", + "tokio", + "ui", + "ui-tokens", + "uuid", +] + +[[package]] +name = "affine-legacy-import" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "affine-mobile" +version = "0.1.0" +dependencies = [ + "affine-client", + "affine-store", + "anyhow", + "blocksuite-playground-doc", + "image", + "playground", + "serde", + "serde_json", + "tokio", + "ui", + "ui-kit", + "ui-tokens", + "unicode-segmentation", +] + +[[package]] +name = "affine-store" +version = "0.1.0" +dependencies = [ + "base64 0.22.1", + "blocksuite-playground-doc", + "chrono", + "serde", + "serde_json", + "sha2 0.10.9", + "sqlx", + "thiserror 2.0.21", + "tokio", + "url", + "y-octo", +] + +[[package]] +name = "ahash" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae442e79f0396cdfccee3e4380cc8d4a9fabbd23dc4a25e1bcc7f960693104ed" +dependencies = [ + "getrandom 0.2.17", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "const-random", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e76a019e91224d279006ff972f1e984179a6e9feb050adba6ce8274aef23195" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ar_archive_writer" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523e5e187fff36fcb8d1d19ccf0ca4ca43ec3d158316057f66dc6f72716bc5ec" +dependencies = [ + "object 0.39.1", +] + +[[package]] +name = "arbitrary" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "arraydeque" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "ash" +version = "0.38.0+1.3.281" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" +dependencies = [ + "libloading", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-lock" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0876700b0d007ad25d5508865a4259c3af9af6d296bf663a0d586d0bc3369f6f" +dependencies = [ + "event-listener", + "event-listener-strategy", + "loom", + "pin-project-lite", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "git+https://github.com/zed-industries/async-task.git?rev=015845a19fc31752c02367567d3b8900a406f9da#015845a19fc31752c02367567d3b8900a406f9da" + +[[package]] +name = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "axum" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b698c5f9a010f6573133b09e0de5408834d0c82f8d7475a89fc1867a71cd90" +dependencies = [ + "axum-core", + "base64 0.22.1", + "bytes", + "form_urlencoded", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sha1", + "sync_wrapper", + "tokio", + "tokio-tungstenite 0.29.0", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "az" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be5eb007b7cacc6c660343e96f650fedf4b5a77512399eb952ca6642cf8d13f7" + +[[package]] +name = "backtrace" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f4220217f3288537b83684130f42fad43320b1c3b805f1910d683d52ded24f" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide 0.9.1", + "object 0.40.0", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "beef" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" + +[[package]] +name = "biblatex" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "591eba69b7c085632e22ca03606f0bbea68d53bbe26c8962e2d549af20c6a561" +dependencies = [ + "paste", + "roman-numerals-rs", + "strum 0.27.2", + "unic-langid", + "unicode-normalization", + "unscanny", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec 0.8.0", +] + +[[package]] +name = "bit-set" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56d87354e4229f54a44f7bf2435906a4656dba36026ab6eaca629a2c436a691c" +dependencies = [ + "bit-vec 0.10.2", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bit-vec" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72503af1e72be411d74ca45cd6b309878fcb35354e252fc2a3a8bda3a97082a0" +dependencies = [ + "borsh", + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +dependencies = [ + "serde_core", +] + +[[package]] +name = "bitvec" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddcec3d12c579d40898fe0a9a358a803c23e9c52ca3c425707f81c9436211837" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + +[[package]] +name = "blocksuite-editor" +version = "0.1.0" +dependencies = [ + "anyhow", + "blocksuite-playground-doc", + "blocksuite-preview", + "fontdb", + "icu_segmenter", + "image", + "js-sys", + "serde", + "serde_json", + "ttf-parser", + "ui", + "ui-tokens", + "unicode-bidi", + "unicode-linebreak", + "unicode-normalization", + "unicode-segmentation", + "wasm-bindgen", + "y-octo", +] + +[[package]] +name = "blocksuite-playground-doc" +version = "0.1.0" +dependencies = [ + "axum", + "clap", + "futures-util", + "getrandom 0.3.4", + "proptest", + "rand 0.9.5", + "rand_chacha 0.9.0", + "reqwest", + "serde", + "serde_json", + "thiserror 2.0.21", + "tokio", + "tokio-tungstenite 0.26.2", + "tracing", + "tracing-subscriber", + "y-octo", +] + +[[package]] +name = "blocksuite-preview" +version = "0.1.0" +dependencies = [ + "comemo", + "hayro 0.9.0", + "merman", + "mitex", + "ratex-katex-fonts", + "ratex-layout", + "ratex-parser", + "ratex-types", + "resvg", + "roxmltree 0.21.2", + "serde", + "serde_json", + "sha2 0.10.9", + "thiserror 2.0.21", + "ttf-parser", + "typst", + "typst-assets", + "typst-layout", + "typst-svg", + "usvg 0.46.0", + "wasm-bindgen", +] + +[[package]] +name = "borsh" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "553c5d846a6ba5150c65e3b1b8ec073bcf1abc20f9b7220de384a4443ea4e20a" +dependencies = [ + "borsh-derive", + "bytes", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12cdfe656708a01f89b451a7d36466e6fe6c414de0aa18fc54f864f6f9ca9f56" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "brotli" +version = "8.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc91aac060a7a1e25823bdccbfb6af1875b88f17c6daac97894eed8207166b3" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "5.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a32acac15fe1967bc3986b2a6347dffc965602354ea6f450ad07e8bfd253583" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bumpalo" +version = "3.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db" + +[[package]] +name = "by_address" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06" + +[[package]] +name = "bytecheck" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c" + +[[package]] +name = "cbindgen" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadd868a2ce9ca38de7eeafdcec9c7065ef89b42b32f0839278d55f35c54d1ff" +dependencies = [ + "heck 0.4.1", + "indexmap", + "log", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn 2.0.119", + "tempfile", + "toml", +] + +[[package]] +name = "cc" +version = "1.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02f0e023adb368345ce0ca6cdfc0f24a06554468d0e8503e14a0841de79bfa69" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core 0.10.1", +] + +[[package]] +name = "chinese-number" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e964125508474a83c95eb935697abbeb446ff4e9d62c71ce880e3986d1c606b" +dependencies = [ + "chinese-variant", + "enum-ordinalize", + "num-bigint", + "num-traits", +] + +[[package]] +name = "chinese-variant" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d1275808335c5583ea45a4141d631dafcb36b79fa8a5e10b00e356b6af3e08a" + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "windows-link 0.2.1", +] + +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + +[[package]] +name = "citationberg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "756ff1e3d43a9ecc8183932fb4d9fd3971236f3ce4acb62fe51d1cd43297547d" +dependencies = [ + "quick-xml 0.38.4", + "serde", + "serde_path_to_error", +] + +[[package]] +name = "clap" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "844c5c0b65be192cb68d570cca1b21a6444431d24e39c084dc0336177015337c" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c174f11f949b9ca8c60580925e282b9cbd5454750e506f08648b2038080cd7" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "clap_lex" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0921b3876b3a1df8a1c9f912e7f94342458022c2e84288015893d83c4d62a79" + +[[package]] +name = "cobs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "codespan-reporting" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +dependencies = [ + "serde", + "termcolor", + "unicode-width", +] + +[[package]] +name = "codex" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0732ab1a27b4ea05e6f9f60a5122c9924dd5123defde0d8e907f58cf643d40e6" +dependencies = [ + "chinese-number", +] + +[[package]] +name = "color" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ec7c5eb7a16992b1904d76c517d170ab353b0e0b3d5a0c81a8a0cd1037893cf" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "comemo" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c963350b2b08aa4b725d7802593245380ab53dacfedcaa971385fc33306c0d4" +dependencies = [ + "comemo-macros", + "parking_lot", + "rustc-hash 2.1.3", + "siphasher", + "slab", +] + +[[package]] +name = "comemo-macros" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3c400139ba1389ef9e20ad2d87cda68b437a66483aa0da616bdf2cea7413853" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "const-oid" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a" + +[[package]] +name = "const-random" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom 0.2.17", + "once_cell", + "tiny-keccak", +] + +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1" +dependencies = [ + "bitflags 2.13.2", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.13.2", + "core-foundation", + "libc", +] + +[[package]] +name = "core-text" +version = "21.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a593227b66cbd4007b2a050dfdd9e1d1318311409c8d600dc82ba1b15ca9c130" +dependencies = [ + "core-foundation", + "core-graphics", + "foreign-types", + "libc", +] + +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + +[[package]] +name = "core_maths" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30" +dependencies = [ + "libm", +] + +[[package]] +name = "cosmic-text" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be17b688510d934ce13f48a2beba700e11583e281e0fda99c22bb256a14eda73" +dependencies = [ + "bitflags 2.13.2", + "fontdb", + "harfrust", + "linebender_resource_handle", + "log", + "rangemap", + "rustc-hash 2.1.3", + "self_cell", + "skrifa 0.40.0", + "smol_str", + "swash", + "sys-locale", + "unicode-bidi", + "unicode-linebreak", + "unicode-script", + "unicode-segmentation", +] + +[[package]] +name = "countme" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853" + +[[package]] +name = "crc32fast" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03e8bd762f7479489c70ed6c768ddca99d7296857de437a68dcb2a94365b3fae" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "cssparser" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11119743ad110e8c1bdccd930d7f5c30c99e5fc76a7b63ec9807e84eef0c5f59" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf 0.14.0", + "smallvec", +] + +[[package]] +name = "cssparser-macros" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d045de693cb712d0b22c6a64be5b953f67b3ce00ab5ad3dd5d8b441886ab8e1a" +dependencies = [ + "quote", + "syn 3.0.10", +] + +[[package]] +name = "csv" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52cd9d68cf7efc6ddfaaee42e7288d3a99d613d4b50f76ce9827ae0c6e14f938" +dependencies = [ + "csv-core", + "itoa", + "ryu", + "serde_core", +] + +[[package]] +name = "csv-core" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "704a3c26996a80471189265814dbc2c257598b96b8a7feae2d31ace646bb9782" +dependencies = [ + "memchr", +] + +[[package]] +name = "ctor" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea691ed9f36489d087419b8b2ba3ef27d89621380b4178c73e2445a379e4e0f4" +dependencies = [ + "link-section", + "linktime-proc-macro", +] + +[[package]] +name = "data-encoding" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" + +[[package]] +name = "data-url" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid 0.9.6", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" + +[[package]] +name = "derive_arbitrary" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b034bd7d5f032402a2479444dcc6f74e36a03f31854d41680fb240ef682a1ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.119", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "const-oid 0.9.6", + "crypto-common 0.1.7", + "subtle", +] + +[[package]] +name = "digest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +dependencies = [ + "block-buffer 0.12.1", + "const-oid 0.10.3", + "crypto-common 0.2.2", +] + +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.61.2", +] + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + +[[package]] +name = "dtoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" + +[[package]] +name = "dtoa-short" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] + +[[package]] +name = "dugong" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76274e60c76cfe5eb809869b706ec0d427c5c5781dbd1ab65c267626fab0ff3" +dependencies = [ + "dugong-graphlib", + "rustc-hash 2.1.3", + "serde", + "serde_json", +] + +[[package]] +name = "dugong-graphlib" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49aff7cb470b59ad2c92a90f376d2a56edf982e3191f971f46c5692c50a87684" +dependencies = [ + "hashbrown 0.17.1", + "rustc-hash 2.1.3", + "serde", + "serde_json", +] + +[[package]] +name = "dwrote" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b35532432acc8b19ceed096e35dfa088d3ea037fe4f3c085f1f97f33b4d02" +dependencies = [ + "lazy_static", + "libc", + "winapi", + "wio", +] + +[[package]] +name = "ecow" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78e4f79b296fbaab6ce2e22d52cb4c7f010fe0ebe7a32e34fa25885fd797bd02" +dependencies = [ + "serde", +] + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" +dependencies = [ + "serde", +] + +[[package]] +name = "ena" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabffdaee24bd1bf95c5ef7cec31260444317e72ea56c4c91750e8b7ee58d5f1" +dependencies = [ + "log", +] + +[[package]] +name = "enum-ordinalize" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89dd01549b09589510cf0647475075d12071456586d70f5c75c98ae2a5537677" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a65863d15a4ce2888bd2f0f543cc963d3879c3a022c8ee43f6141d479a3ac815" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "errno" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "etagere" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc89bf99e5dc15954a60f707c1e09d7540e5cd9af85fa75caa0b510bc08c5342" +dependencies = [ + "euclid", + "svg_fmt", +] + +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys 0.48.0", +] + +[[package]] +name = "euclid" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06" +dependencies = [ + "num-traits", +] + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "loom", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "fancy-regex" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "998b056554fbe42e03ae0e152895cd1a7e1002aec800fdc6635d20270260c46f" +dependencies = [ + "bit-set 0.8.0", + "regex-automata", + "regex-syntax 0.8.12", +] + +[[package]] +name = "fancy-regex" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a2e16b9a584b602f1e0e5e22c30ca0906786088c27500653e432d086def8b53" +dependencies = [ + "bit-set 0.8.0", + "regex-automata", + "regex-syntax 0.8.12", +] + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "fearless_simd" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" + +[[package]] +name = "fearless_simd" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4beca3cb2444e3304ac30843cc091f44ed58932353cd492ce740067bfce6b12" + +[[package]] +name = "fearless_simd" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a7107516a8be9a4ffe92495f3dbfe04348be0ad18f17c67a1d846511f99e599" + +[[package]] +name = "find-msvc-tools" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" + +[[package]] +name = "flate2" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4" +dependencies = [ + "crc32fast", + "miniz_oxide 0.9.1", + "zlib-rs", +] + +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" + +[[package]] +name = "float-ord" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d" + +[[package]] +name = "float_next_after" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8" + +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "spin 0.9.9", +] + +[[package]] +name = "flume" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e139bc46ca777eb5efaf62df0ab8cc5fd400866427e56c68b22e414e53bd3be" +dependencies = [ + "futures-core", + "futures-sink", + "spin 0.9.9", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "font-types" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b38ad915f6dadd993ced50848a8291a543bd41ca62bc10740d5e64e2ab4cfd7" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "font-types" +version = "0.12.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835ae9d781464a79026cde387f9cbc650c9a4909d7cf7e658b127e3c35d2f35d" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "fontconfig-parser" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbc773e24e02d4ddd8395fd30dc147524273a83e54e0f312d986ea30de5f5646" +dependencies = [ + "roxmltree 0.20.0", +] + +[[package]] +name = "fontdb" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "457e789b3d1202543297a350643cf459f836cade38934e7a4cf6a39e7cde2905" +dependencies = [ + "fontconfig-parser", + "log", + "memmap2", + "slotmap", + "tinyvec", + "ttf-parser", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "frame-audit" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "freetype-sys" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7edc5b9669349acfda99533e9e0bcf26a51862ab43b08ee7745c55d28eb134" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot", +] + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generator" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6c6a73cd1aa4f4f00c02b109fa55d3a9d6ecc2fc4f53177b74ed6ee23b0c53" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "windows-core 0.100.0", + "windows-sys 0.61.2", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 5.3.0", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", +] + +[[package]] +name = "gif" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "gimli" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1033caf0b349c518623b5396bfb2cf0bddf44f0306d543a250e5743297aafd10" + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glidesort" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2e102e6eb644d3e0b186fc161e4460417880a0a0b87d235f2e5b8fb30f2e9e0" + +[[package]] +name = "glifo" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d99fc21d493812643aae86d53b7bbd02f376434a90317e8a790bc209fdd6605e" +dependencies = [ + "bytemuck", + "foldhash 0.2.0", + "hashbrown 0.17.1", + "log", + "peniko", + "png 0.18.1", + "skrifa 0.42.1", + "smallvec", + "vello_common 0.0.9", +] + +[[package]] +name = "glifo" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1218dedd5348c1b166ec3b8b3cbca49d2f527bd43b3fa072ea5123c523ed3f" +dependencies = [ + "bytemuck", + "foldhash 0.2.0", + "hashbrown 0.17.1", + "log", + "peniko", + "png 0.18.1", + "skrifa 0.44.0", + "smallvec", + "vello_common 0.3.0", +] + +[[package]] +name = "glow" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "263218b0ba2b0715c3370fb04674f5f8aa331594b521c94ff0a8e4a8472d1386" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "gpu-allocator" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +dependencies = [ + "ash", + "hashbrown 0.16.1", + "log", + "presser", + "thiserror 2.0.21", +] + +[[package]] +name = "granit-parser" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd04d0d9c7079b416b458d2317aea4aa964c81938cb7c20f559758c4f422dc8" +dependencies = [ + "arraydeque", + "smallvec", +] + +[[package]] +name = "guillotiere" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b17e70c989c36bad147b27a58d148c0741c51448aa5653436547323e524d0ab" +dependencies = [ + "euclid", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "num-traits", + "zerocopy", +] + +[[package]] +name = "harfrust" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9da2e5ae821f6e96664977bf974d6d6a2d6682f9ccee23e62ec1d134246845f9" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "core_maths", + "read-fonts 0.37.0", + "smallvec", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.9", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "hashlink" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "hayagriva" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b6c185c5c72546d50b25b70187f01ab9a1a2fa21c4db8691e2426fa5fce805c" +dependencies = [ + "biblatex", + "ciborium", + "citationberg", + "icu_collator", + "icu_locale", + "indexmap", + "paste", + "roman-numerals-rs", + "serde", + "serde_yaml", + "thiserror 2.0.21", + "unic-langid", + "unicode-segmentation", + "unscanny", + "url", +] + +[[package]] +name = "hayro" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4caa128ab87fd48ffb7490617cf93f77f606820dffbc9fd9ef6ab0ed077f56d" +dependencies = [ + "bytemuck", + "hayro-interpret 0.7.0", + "image", + "kurbo", + "pic-scale", + "vello_cpu 0.0.8", +] + +[[package]] +name = "hayro" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34d3977ae664ab6eea015be3024379c83c6a3580f67d51be6884f1992bf683ba" +dependencies = [ + "ab_glyph_rasterizer", + "bytemuck", + "fearless_simd 1.3.0", + "hayro-interpret 0.9.0", + "image", + "kurbo", + "pic-scale", + "rustc-hash 2.1.3", + "vello_cpu 0.3.0", +] + +[[package]] +name = "hayro-ccitt" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" + +[[package]] +name = "hayro-ccitt" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2866f0d976e76497480b853d5e258dab6e4b89ecfe991124e08f15dfa8fd03ad" + +[[package]] +name = "hayro-ccitt" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adbed896e99325bc312778bb9c9c289d795d51c12775c44dd5e4352f679c7e46" + +[[package]] +name = "hayro-cmap" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a14afde3344be69225fec4f6f44f6a219a3a492f9d8301eb25ef608fe4b7014c" +dependencies = [ + "brotli", + "hayro-postscript", +] + +[[package]] +name = "hayro-font" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ac7f0c78172573e9bd6eeb17f62c63f4d378b2a2d127c3ee9c2c7cc6fbdf78b" +dependencies = [ + "bitflags 2.13.2", + "hayro-cmap", + "hayro-syntax 0.9.0", + "kurbo", + "phf 0.13.1", + "rustc-hash 2.1.3", + "siphasher", + "skrifa 0.49.0", +] + +[[package]] +name = "hayro-interpret" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2613d0406898995042d0794c4245b2f2fba1246490c8ac593769bba6551129d" +dependencies = [ + "bitflags 2.13.2", + "hayro-cmap", + "hayro-syntax 0.7.2", + "kurbo", + "moxcms", + "phf 0.13.1", + "rustc-hash 2.1.3", + "siphasher", + "skrifa 0.42.1", + "smallvec", + "yoke", +] + +[[package]] +name = "hayro-interpret" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "166477622df4b770a0fc5889a9e4b48c7ff8595d6ec019bf71b4297b97b55fb6" +dependencies = [ + "bitflags 2.13.2", + "hayro-cmap", + "hayro-font", + "hayro-syntax 0.9.0", + "kurbo", + "moxcms", + "rustc-hash 2.1.3", + "siphasher", + "smallvec", +] + +[[package]] +name = "hayro-jbig2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000e025850f4592ddcaee85640db70704151f2bafd43b6f431aa5b6a2c6a35a9" +dependencies = [ + "fearless_simd 1.3.0", + "hayro-ccitt 0.4.0", +] + +[[package]] +name = "hayro-jbig2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb5c7f3a4eb551c2bb7fa16e268f728d4bc2a5c9b090554b8dc0ee2503fb5840" +dependencies = [ + "fearless_simd 1.3.0", + "hayro-ccitt 0.5.0", +] + +[[package]] +name = "hayro-jpeg2000" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ab947623ef4ccaa7acf0579edf7cbb5a73838e3839a7be73335e522f433a1" +dependencies = [ + "fearless_simd 0.4.1", +] + +[[package]] +name = "hayro-jpeg2000" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e5e5f2b3de970707fc22fd956d8f44211602939d5e4588603afa919cb7b3740" +dependencies = [ + "fearless_simd 1.3.0", +] + +[[package]] +name = "hayro-postscript" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc2d80da85f31c3fdc0366431f44cfd645a9da1e242ed1f4a61f213d9765660f" + +[[package]] +name = "hayro-svg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7434c89e920d84e077214a29e69b462a6518754610f732f1124af3948410cb8c" +dependencies = [ + "base64 0.22.1", + "hayro-interpret 0.7.0", + "image", + "kurbo", + "siphasher", + "xmlwriter", +] + +[[package]] +name = "hayro-syntax" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0edeafd70aa2db743de8ede8637d07ec87db05efe69cde371d03f1b185fcef27" +dependencies = [ + "flate2", + "hayro-ccitt 0.3.0", + "hayro-jbig2 0.3.1", + "hayro-jpeg2000 0.3.5", + "memchr", + "rustc-hash 2.1.3", + "smallvec", + "zune-jpeg", +] + +[[package]] +name = "hayro-syntax" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6ced8279487b029813f6cc05399099fa34df6fa23d8f7b0d41d972c49d5b30d" +dependencies = [ + "flate2", + "hayro-ccitt 0.5.0", + "hayro-jbig2 0.4.0", + "hayro-jpeg2000 0.5.0", + "memchr", + "rustc-hash 2.1.3", + "smallvec", + "zune-jpeg", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "html5ever" +version = "0.40.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456a1a377e608e555d22ddab27ac0114bc7a7b4199078108e34c2aeae6c9b130" +dependencies = [ + "log", + "markup5ever", + "memchr", +] + +[[package]] +name = "htmlize" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e815d50d9e411ba2690d730e6ec139c08260dddb756df315dbd16d01a587226" +dependencies = [ + "memchr", + "pastey 0.1.1", + "phf 0.13.1", + "phf_codegen 0.13.1", + "serde_json", +] + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hybrid-array" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" +dependencies = [ + "typenum", +] + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-core", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "hypher" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45f2b4f6b5da34d400d4c112eadcc14512cc5d04307a8eee182586d9bebd7ce6" + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.62.2", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collator" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24cb0205c419b2036da3f9082964905d6849b3f2130dd4a517940c45899a544b" +dependencies = [ + "icu_collator_data", + "icu_collections", + "icu_locale_core", + "icu_locale_fallback", + "icu_normalizer", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "zerovec", +] + +[[package]] +name = "icu_collator_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183f47e821a327661c1ebe152f61d5b6c2000010d228cadbbf226e0e2b8c2634" + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "serde", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe8fa57bcddc15cb921582ee5259c5b77da39f946f188ca5213fad24d9241236" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_locale_data", + "icu_locale_fallback", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "serde", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locale_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a64014dac577a11d8d2cee48517c73c1984bd72ab11031e934269bd3cefb2ad9" + +[[package]] +name = "icu_locale_fallback" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "406e9ae5b95d8aa37db6293405931b766a6172d1848daee22d70eb44aa78a43c" +dependencies = [ + "icu_locale_core", + "icu_locale_fallback_data", + "icu_provider", + "potential_utf", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3632ebbd0c5c3637ba1a40bdf8288f2cb9d2268e73441a69d5fc73d7cfbaa87c" + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "serde", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "postcard", + "serde", + "stable_deref_trait", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_provider_blob" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ef59e2bab24a70e7b25d8025861b7c3b2de2982a6e6f64c1ca19e44e554889" +dependencies = [ + "icu_provider", + "postcard", + "serde", + "writeable", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_segmenter" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61b195dc605f81aa181bec9b3bd14e26cc71b903e4644f6af578ca9772c7a710" +dependencies = [ + "core_maths", + "icu_collections", + "icu_locale_fallback", + "icu_provider", + "icu_segmenter_data", + "potential_utf", + "serde", + "smallvec", + "utf8_iter", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_segmenter_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913a7d294ad056474749152107309fdee3ec17d2482d1ab70fdc61a81c64b9a3" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "image" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" +dependencies = [ + "bytemuck", + "byteorder-lite", + "color_quant", + "gif", + "image-webp", + "moxcms", + "num-traits", + "png 0.18.1", + "zune-core", + "zune-jpeg", +] + +[[package]] +name = "image-webp" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" +dependencies = [ + "byteorder-lite", + "quick-error 2.0.1", +] + +[[package]] +name = "imagesize" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e54e57b4c48b40f7aec75635392b12b3421fa26fe8b4332e63138ed278459c" + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", + "rayon", + "serde", + "serde_core", +] + +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "jiff" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e77cbfb9fff4798e283c2d69dff39fc2c45e7da017e5ce95b654e46ea41236" +dependencies = [ + "jiff-core", + "jiff-static", + "jiff-tzdb-platform", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-link 0.2.1", +] + +[[package]] +name = "jiff-core" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b46a105a9874634dd96231021526bf24ca04955a5998c59a9c7666e634b7b8" +dependencies = [ + "log", +] + +[[package]] +name = "jiff-static" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9067a0b23e5be3147d56b2dcf652b18e6b1364caca93fb157653b6fbcab23a9" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "jiff-tzdb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e71a1b68a875a44a33bb7a1dd84392cb77145a3367a552a3cfe6a4f5cf3afc" + +[[package]] +name = "jiff-tzdb-platform" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc65b284afcfa8f6cf189c7274c805505314a7ab975c60e1f548bff56525420e" +dependencies = [ + "jiff-tzdb", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "js-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "json5" +version = "1.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c1d229cedc4e210dd2e2a6cdc59e36ce28e7338fb69367d0d2566e26de7d599" +dependencies = [ + "serde", + "ucd-trie", +] + +[[package]] +name = "kamadak-exif" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8772c92c0f41c4a672cbdee6728253e5ae8fcc1c5eb5c6c676579565684bbf68" +dependencies = [ + "mutate_once", +] + +[[package]] +name = "khronos-egl" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" +dependencies = [ + "libc", + "libloading", + "pkg-config", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "kurbo" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2" +dependencies = [ + "arrayvec", + "euclid", + "polycool", + "smallvec", +] + +[[package]] +name = "lalrpop-util" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "364b49d1c98c07972e16fe1346463becc08bcd663da04e6e37ab1bea068dce6a" + +[[package]] +name = "lazy_static" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" +dependencies = [ + "spin 0.9.9", +] + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link 0.2.1", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "bitflags 2.13.2", + "libc", + "plain", + "redox_syscall 0.9.5", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linebender_resource_handle" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" + +[[package]] +name = "link-section" +version = "0.19.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d9aae57673c1a235149777a74d152f3210ebd3e3b13346d2cdb6809e566bd3c" + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linktime-proc-macro" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e57c38c1e860fd37c604281cdfb1dd2216977fd76a50f85ba2f388ef3219616" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "lipsum" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "636860251af8963cc40f6b4baadee105f02e21b28131d76eba8e40ce84ab8064" +dependencies = [ + "rand 0.8.8", + "rand_chacha 0.3.1", +] + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" +dependencies = [ + "serde_core", +] + +[[package]] +name = "litrs" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4744e383959f0db86ede514b809b1c53251889093803c05267acc7d4e7030d70" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" + +[[package]] +name = "logos" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c000ca4d908ff18ac99b93a062cb8958d331c3220719c52e77cb19cc6ac5d2c1" +dependencies = [ + "logos-derive", +] + +[[package]] +name = "logos-codegen" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc487311295e0002e452025d6b580b77bb17286de87b57138f3b5db711cded68" +dependencies = [ + "beef", + "fnv", + "proc-macro2", + "quote", + "regex-syntax 0.6.29", + "syn 2.0.119", +] + +[[package]] +name = "logos-derive" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbfc0d229f1f42d790440136d941afd806bc9e949e2bcb8faa813b0f00d1267e" +dependencies = [ + "logos-codegen", +] + +[[package]] +name = "loom" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1611ddbf89dc6ae42cfbd51fc207836140130257646eab8d6d2fb16577db2d2" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", + "serde", + "serde_json", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "lyon" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0578bdecb7d6d88987b8b2b1e3a4e2f81df9d0ece1078623324a567904e7b7" +dependencies = [ + "lyon_algorithms", + "lyon_tessellation", +] + +[[package]] +name = "lyon_algorithms" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a6b9d4e8b48acd531fbf1241ad9b270df6e60b6b92bdea1469f4f40899d805" +dependencies = [ + "lyon_path", + "num-traits", +] + +[[package]] +name = "lyon_geom" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82dd26aa4dc0b5b70b9115de59824842bcb43cf4a28e1b1e6d0ad148c93f93e" +dependencies = [ + "arrayvec", + "euclid", + "num-traits", +] + +[[package]] +name = "lyon_path" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c463f9c428b7fc5ec885dcd39ce4aa61e29111d0e33483f6f98c74e89d8621e" +dependencies = [ + "lyon_geom", + "num-traits", +] + +[[package]] +name = "lyon_tessellation" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd4872650e70dc907dd4f7ebc449d7d657a0d2658e423b2e724970870bbbf75b" +dependencies = [ + "float_next_after", + "lyon_path", + "num-traits", +] + +[[package]] +name = "mach2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b" + +[[package]] +name = "macro_rules_attribute" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3ae8f6d608c795738406608304d30a2dfbdc8e58e44f7ba43236da5208ded3c" +dependencies = [ + "macro_rules_attribute-proc_macro", + "pastey 0.2.3", +] + +[[package]] +name = "macro_rules_attribute-proc_macro" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc04a4c58212d57930a24bf47d3fa87485264a3a054e9c10e042eb373573ad3c" + +[[package]] +name = "manatee" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b13dd38e6b5e9d099849ecf473c887fa99532ccc92aca25be0ef8fec92cb209" +dependencies = [ + "indexmap", + "libm", + "rustc-hash 2.1.3", + "thiserror 2.0.21", +] + +[[package]] +name = "markup5ever" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab3dc68ac4a0f5719e560136778c1ee716e296030d75dbd4484e37e39e3a842" +dependencies = [ + "log", + "tendril", + "web_atoms", +] + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest 0.10.7", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memmap2" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "merman" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f9848959ed141728e224aaba721ef824b19352ac82c1213f24152a06dbfd5b7" +dependencies = [ + "merman-analysis", + "merman-ascii", + "merman-core", + "merman-editor-core", + "merman-markup", + "merman-model", + "merman-render", + "merman-theme-contract", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "merman-analysis" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9df8b3c3bc1a0023b9239aaf9db5f4383ed32ff5ac81de83c694b354f657ca3c" +dependencies = [ + "merman-core", + "merman-model", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "merman-ascii" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01788fbca30fa4d1f38f9a8763254a8711034c3a43f0ab38cbdbe9d8f7aab126" +dependencies = [ + "dugong", + "merman-model", + "pulldown-cmark", + "rustc-hash 2.1.3", + "ryu-js", + "serde", + "serde_json", + "thiserror 2.0.21", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "merman-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91173dcd1eb1f0e5942429297b38867e22c1918a9dc23fc95ec515186144ee9a" +dependencies = [ + "cssparser", + "granit-parser", + "indexmap", + "json5", + "lalrpop-util", + "merman-markup", + "merman-model", + "rustc-hash 2.1.3", + "ryu-js", + "serde", + "serde_json", + "thiserror 2.0.21", + "unicode-general-category", +] + +[[package]] +name = "merman-editor-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "715da862a80bf1493dae9ffe869304c06f97c402386e286813e5f172dcbb00d6" +dependencies = [ + "merman-analysis", + "merman-core", + "merman-model", + "serde", +] + +[[package]] +name = "merman-elk-layered" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897499a47993ef5999ce9d9498210a95e0ab6fe7b0814cb4513a7418ba66d132" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "merman-layout-elk" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668cd869cdfd7b774b6e7d4ff7d1d477b29dd47f61cd96ee9d24e69a2441584b" +dependencies = [ + "merman-elk-layered", + "thiserror 2.0.21", +] + +[[package]] +name = "merman-markup" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce03974f937dc170850da04a02221d4a2c06da519ab637e5b5f7a2c13c05424f" +dependencies = [ + "html5ever", + "htmlize", + "merman-model", + "ryu-js", + "serde_json", + "url", +] + +[[package]] +name = "merman-model" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c4af8ea8e627cdd4c95b01355d6e30e157c0b92175cf2a973b736e402c348b3" +dependencies = [ + "htmlize", + "indexmap", + "rustc-hash 2.1.3", + "serde", + "serde_json", + "thiserror 2.0.21", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "merman-render" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb626fa6363caa109dd459e48e0f1b9df495be762248a8cf4aafd0b9366f9b73" +dependencies = [ + "base64 0.23.1", + "cssparser", + "data-encoding", + "data-url", + "dugong", + "euclid", + "indexmap", + "kurbo", + "libm", + "manatee", + "memchr", + "merman-layout-elk", + "merman-markup", + "merman-model", + "merman-theme-contract", + "merman-unicode-linebreak", + "pulldown-cmark", + "quick-xml 0.42.0", + "roughr-merman", + "rustc-hash 2.1.3", + "ryu-js", + "serde", + "serde_json", + "sha2 0.11.1", + "svgtypes", + "thiserror 2.0.21", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "merman-theme-contract" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3434b63ebf143f086a633a3f95ac0044959a8a04252041e22bef4c96bc6cf4" +dependencies = [ + "serde", + "serde_json", + "serde_json_canonicalizer", + "thiserror 2.0.21", +] + +[[package]] +name = "merman-unicode-linebreak" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdf56ac6bf384e8187604351dca20f412bb186be11a9b44dd42e4d5b3f4189e6" + +[[package]] +name = "mime" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5848f5a9e8117cf94f2f90faac24a87ff81600ff8628c1e3deaab572e76bfa1" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20521a903f02b0a573cd6840e9d0a5a0cc043d361fe924092cd70f8556cc9c4a" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "mitex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81f1eb466efdd212fe624f8bf24083f21d582f2d08e3b879bc4a059b25969d6c" +dependencies = [ + "mitex-parser", + "mitex-spec-gen", + "rowan", +] + +[[package]] +name = "mitex-glob" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3074187856f137e3392e906daefa2fdc993175d1c7d55ff1348e3bb9321d415" + +[[package]] +name = "mitex-lexer" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fd0a245774eed6cbf0df25bc3a9c6cc64445a5ea2c3a241f1c9691d83ae214b" +dependencies = [ + "ecow", + "ena", + "fxhash", + "logos", + "mitex-spec", + "once_cell", +] + +[[package]] +name = "mitex-parser" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a42a2f86c46d250802262387dfb1d6bb18affd2d99328bbe4dbd12ce294c3a4" +dependencies = [ + "mitex-glob", + "mitex-lexer", + "mitex-spec", + "rowan", +] + +[[package]] +name = "mitex-spec" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ecaa5f36d60e2d64ea5508d1be44b1c19daa50518f5b8425f36697fdc60509" +dependencies = [ + "fxhash", + "rkyv", + "serde", + "serde_json", +] + +[[package]] +name = "mitex-spec-gen" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e9ef918ec9c2a14e60ebb20275684b483d23afb5c3314127c9eb46ce74ae68" +dependencies = [ + "anyhow", + "mitex-spec", + "once_cell", + "serde", + "serde_json", + "which", +] + +[[package]] +name = "moxcms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "mutate_once" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d2233c9842d08cfe13f9eac96e207ca6a2ea10b80259ebe8ad0268be27d2af" + +[[package]] +name = "naga" +version = "30.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=cddb2f5d80dc0009b2ef6767635140cacf90a007#cddb2f5d80dc0009b2ef6767635140cacf90a007" +dependencies = [ + "arrayvec", + "bit-set 0.11.1", + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.17.1", + "indexmap", + "libm", + "log", + "naga-types", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv", + "thiserror 2.0.21", + "unicode-ident", +] + +[[package]] +name = "naga-types" +version = "30.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=cddb2f5d80dc0009b2ef6767635140cacf90a007#cddb2f5d80dc0009b2ef6767635140cacf90a007" +dependencies = [ + "hashbrown 0.17.1", + "indexmap", + "rustc-hash 1.1.0", + "thiserror 2.0.21", +] + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7" +dependencies = [ + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand 0.8.8", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "objc2-uniform-type-identifiers", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +dependencies = [ + "bitflags 2.13.2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-core-video" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6" +dependencies = [ + "bitflags 2.13.2", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-io-surface", + "objc2-metal", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.13.2", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags 2.13.2", + "block2", + "dispatch2", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.13.2", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "objc2-metal", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7902ac02859fc1f7045f8b598c63f1ae0cc7efeaa06a9bc9f3d9a3c955974fa4" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "object" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b" +dependencies = [ + "memchr", +] + +[[package]] +name = "object" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd229a0361b9d0d4396176e02d65897f487eebeab7caa6d443855ee152ca0b9c" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "ordered-float" +version = "5.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f59006ce1e204c30956638535b74d317bca99477b9356dfaec54c37f6f600ab" +dependencies = [ + "arbitrary", + "num-traits", +] + +[[package]] +name = "palette" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddeed8580d347d2abf3dcf06a5f0b3dc020258338526b277847cd4248a70fc64" +dependencies = [ + "approx", + "libm", + "palette_derive", + "palette_math", +] + +[[package]] +name = "palette_derive" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88537020289b719d81be994ccf1bbf4990f477e2f69ee52fe3e45f43a02e56be" +dependencies = [ + "by_address", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "palette_math" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e6eb142958d64335fb0e345c5b9ead2ecd6fc438c307e9d7d3c4fd428dbaf12" +dependencies = [ + "libm", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" +dependencies = [ + "loom", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link 0.2.1", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pastey" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" + +[[package]] +name = "pastey" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4" + +[[package]] +name = "pathfinder_geometry" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b7e7b4ea703700ce73ebf128e1450eb69c3a8329199ffbfb9b2a0418e5ad3" +dependencies = [ + "log", + "pathfinder_simd", +] + +[[package]] +name = "pathfinder_simd" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4500030c302e4af1d423f36f3b958d1aecb6c04184356ed5a833bf6b60435777" +dependencies = [ + "rustc_version", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "peniko" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "839c8299360d2e998bdb106dc0a6cd71dcc5f4df51df1b620361bf50e283cca6" +dependencies = [ + "bytemuck", + "color", + "kurbo", + "linebender_resource_handle", + "smallvec", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_macros 0.13.1", + "phf_shared 0.13.1", + "serde", +] + +[[package]] +name = "phf" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6" +dependencies = [ + "phf_macros 0.14.0", + "phf_shared 0.14.0", + "serde", +] + +[[package]] +name = "phf_codegen" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1" +dependencies = [ + "phf_generator 0.13.1", + "phf_shared 0.13.1", +] + +[[package]] +name = "phf_codegen" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b585a510fb76fdebead6897982ef2a03a21d8e6cbcca904999742a4afc6ffe" +dependencies = [ + "phf_generator 0.14.0", + "phf_shared 0.14.0", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared 0.13.1", +] + +[[package]] +name = "phf_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100" +dependencies = [ + "fastrand", + "phf_shared 0.14.0", +] + +[[package]] +name = "phf_macros" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +dependencies = [ + "phf_generator 0.13.1", + "phf_shared 0.13.1", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_macros" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085" +dependencies = [ + "phf_generator 0.14.0", + "phf_shared 0.14.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pic-scale" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76fd225dc3b8f089eaac369a74f57f557faffbd5da109ddd4e011010ab3ca10" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "pico-args" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" + +[[package]] +name = "pin-project" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6c2123f4708bbd422630a6dae7c03f678b1ce1f1c99e4c4b3beac69c8174cc9" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "358938fd6df944c1e44bb328b60fb275f13c804aac47ba26a1165d45a3f87756" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752" + +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "playground" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-channel", + "axum", + "blocksuite-editor", + "blocksuite-playground-doc", + "console_error_panic_hook", + "futures-util", + "image", + "jiff", + "js-sys", + "serde", + "serde_json", + "sha2 0.10.9", + "tempfile", + "tokio", + "tokio-tungstenite 0.26.2", + "ui", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "y-octo", +] + +[[package]] +name = "plist" +version = "1.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86a77b7d9cdebd9643c180c158748db7d894b24a3935ed4b5843e698ae086eb" +dependencies = [ + "base64 0.23.1", + "indexmap", + "quick-xml 0.42.0", + "serde", + "time", +] + +[[package]] +name = "png" +version = "0.17.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.13.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "pollster" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" + +[[package]] +name = "polycool" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "postcard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5431b3dcfdf6d1985c87d11f267a171c0dec0a8cd544c6727b747d36365f1fca" +dependencies = [ + "cobs", + "serde", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "serde_core", + "writeable", + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit 0.25.20+spec-1.1.0", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" + +[[package]] +name = "proptest" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8530004ccb15eae51c7e40009fbe317f341f804db54dc033eec1c50be28cfa0" +dependencies = [ + "bit-set 0.11.1", + "bit-vec 0.10.2", + "bitflags 2.13.2", + "chacha20", + "core_detect", + "num-traits", + "rand 0.10.4", + "rand_xorshift", + "regex-syntax 0.8.12", + "rusty-fork", + "tempfile", + "unarray", +] + +[[package]] +name = "psm" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd034599e63b970727f70d79e02d62390a4a84f7c6b827c27c46d5ac3fa622" +dependencies = [ + "ar_archive_writer", + "cc", +] + +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "pulldown-cmark" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db2be46835f013dd3f4fa7f5f7402c537787b54ebb6fe2b94bbdd7e2669bb7b" +dependencies = [ + "bitflags 2.13.2", + "memchr", + "unicase", +] + +[[package]] +name = "pxfm" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quick-xml" +version = "0.38.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66c2058c55a409d601666cffe35f04333cf1013010882cec174a7467cd4e21c" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "quick-xml" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11" +dependencies = [ + "getrandom 0.4.3", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_xorshift" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60aa6af80be32871323012e02e6e65f8a7cc7890931ae421d217ad8fe0df2ccf" +dependencies = [ + "rand_core 0.10.1", +] + +[[package]] +name = "rangemap" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a611d15b50743feb4c76b7d03edcb0e64f399c26961e4efe6975bc398be6aa3d" + +[[package]] +name = "ratex-font" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c3599bafdf0e0637d1bb9cf97c01528eaa46fab0c6810c3959c2da5f66b2242" +dependencies = [ + "phf 0.13.1", + "ratex-types", +] + +[[package]] +name = "ratex-katex-fonts" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "575eb89e2ab455fe9618b5f06d1838dff40064642d8ec454fedf14852d2ed0a3" + +[[package]] +name = "ratex-layout" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "667f0b07c558d07d77c53208d90a5bd1918cbe5f76c1c36f3547bf08bc3d625a" +dependencies = [ + "ratex-font", + "ratex-parser", + "ratex-types", + "serde_json", +] + +[[package]] +name = "ratex-lexer" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d0fb77ea76a6f650f382f9660949cddc8afd695901f1c9293f92175a3d9e62f" +dependencies = [ + "ratex-types", + "serde", + "thiserror 1.0.69", +] + +[[package]] +name = "ratex-parser" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dbc57077b89566bde9fc17f468b83d6b17df90930874f8a3d0e7ef988f1ae9c" +dependencies = [ + "fancy-regex 0.20.2", + "ratex-font", + "ratex-lexer", + "ratex-types", + "regex", + "regex-lite", + "serde", + "serde_json", + "thiserror 1.0.69", + "unicode-normalization", +] + +[[package]] +name = "ratex-types" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74b856c4a2c1d4b9669a10f03b207f97e16a53119bf607501732b97b5c87007f" +dependencies = [ + "serde", +] + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "raw-window-metal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" +dependencies = [ + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "objc2-quartz-core", +] + +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "read-fonts" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b634fabf032fab15307ffd272149b622260f55974d9fad689292a5d33df02e5" +dependencies = [ + "bytemuck", + "core_maths", + "font-types 0.11.3", +] + +[[package]] +name = "read-fonts" +version = "0.39.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4ed38b89c2c77ff968c524145ad65fb010f38af5c7a224b53b81d47ac2daa81" +dependencies = [ + "bytemuck", + "font-types 0.11.3", +] + +[[package]] +name = "read-fonts" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" +dependencies = [ + "bytemuck", + "font-types 0.12.7", + "once_cell", +] + +[[package]] +name = "read-fonts" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdaa4fffe9ff3ca2c353fa9729792805b9b3e324695ff5a081f860612e81b330" +dependencies = [ + "bytemuck", + "foldhash 0.2.0", + "font-types 0.12.7", + "once_cell", + "smallvec", + "yoke", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_syscall" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_users" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60dc65c0ff1a7ae1294b0c67b9f14baf70b644404010370171787bfac1038fc0" +dependencies = [ + "libredox", + "thiserror 2.0.21", +] + +[[package]] +name = "regex" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax 0.8.12", +] + +[[package]] +name = "regex-automata" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.12", +] + +[[package]] +name = "regex-lite" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973" + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6" + +[[package]] +name = "rend" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" +dependencies = [ + "bytecheck", +] + +[[package]] +name = "renderdoc-sys" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "resvg" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b563218631706d614e23059436526d005b50ab5f2d506b55a17eb65c5eb83419" +dependencies = [ + "gif", + "image-webp", + "log", + "pico-args", + "rgb", + "svgtypes", + "tiny-skia", + "usvg 0.46.0", + "zune-jpeg", +] + +[[package]] +name = "rgb" +version = "0.8.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "rkyv" +version = "0.7.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2297bf9c81a3f0dc96bc9521370b88f054168c29826a75e89c55ff196e7ed6a1" +dependencies = [ + "bitvec", + "bytecheck", + "bytes", + "hashbrown 0.12.3", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", + "tinyvec", + "uuid", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84d7b42d4b8d06048d3ac8db0eb31bcb942cbeb709f0b5f2b2ebde398d3038f5" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "roman-numerals-rs" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c85cd47a33a4510b1424fe796498e174c6a9cf94e606460ef022a19f3e4ff85e" + +[[package]] +name = "roughr-merman" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e197669bd3b80a7952e04bd8226f71a266c5e1d456dc48e4d576e32c57570e36" +dependencies = [ + "euclid", + "num-traits", + "palette", + "ryu-js", + "svgtypes", +] + +[[package]] +name = "rowan" +version = "0.15.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2441aaccb50f4267d4f0f58b21e0138e96a449f361ed57a2673a83c9bca0772" +dependencies = [ + "countme", + "hashbrown 0.14.5", + "memoffset", + "rustc-hash 1.1.0", + "text-size", +] + +[[package]] +name = "roxmltree" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" + +[[package]] +name = "roxmltree" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9da7f59328b09405b181fee1018925fad50f157afb43c0c0f5c522c256dd5907" +dependencies = [ + "memchr", +] + +[[package]] +name = "rsa" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" +dependencies = [ + "const-oid 0.9.6", + "digest 0.10.7", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core 0.6.4", + "signature", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "rust_decimal" +version = "1.43.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7653272e75dcac41dc199fbea6f5797633994fafd339943c06c9af16bf29cd3a" +dependencies = [ + "arrayvec", + "num-traits", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "rusty-fork" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" +dependencies = [ + "fnv", + "quick-error 1.2.3", + "tempfile", + "wait-timeout", +] + +[[package]] +name = "rustybuzz" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3c7c96f8a08ee34eff8857b11b49b07d71d1c3f4e88f8a88d4c9e9f90b1702" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "core_maths", + "log", + "smallvec", + "ttf-parser", + "unicode-bidi-mirroring", + "unicode-ccc", + "unicode-properties", + "unicode-script", +] + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "ryu-js" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04d056b875a9d2e6cb9a61d127afee9ac5999b9f87bcb32079d1318e505be714" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + +[[package]] +name = "self_cell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "foldhash 0.2.0", + "indexmap", + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_json_canonicalizer" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f7bb64f8c7e9f783fdfe883b5fe93a90bee1597c63705baa91842c5f698620" +dependencies = [ + "ryu-js", + "serde", + "serde_json", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[package]] +name = "sha1" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "digest 0.11.3", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "simplecss" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9c6883ca9c3c7c90e888de77b7a5c849c779d25d74a1269b0218b14e8b136c" +dependencies = [ + "log", +] + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "skrifa" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fbdfe3d2475fbd7ddd1f3e5cf8288a30eb3e5f95832829570cd88115a7434ac" +dependencies = [ + "bytemuck", + "read-fonts 0.37.0", +] + +[[package]] +name = "skrifa" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c34617370ae968efb7161bb2beb517d9084659aae19e24b89e3db25b46e4564" +dependencies = [ + "bytemuck", + "read-fonts 0.39.2", +] + +[[package]] +name = "skrifa" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" +dependencies = [ + "bytemuck", + "read-fonts 0.41.0", +] + +[[package]] +name = "skrifa" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7459fb60888ad9a5f367dd293fa2fb9df142cb451aa6bfd6cd66a7d6a9b739d" +dependencies = [ + "bytemuck", + "once_cell", + "read-fonts 0.46.0", + "smallvec", + "yoke", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.16.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59" +dependencies = [ + "serde", +] + +[[package]] +name = "smol_str" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeb7109d23f319619d4cc0de5464613c8b7b1a09db2774a58101459cf6be2f10" +dependencies = [ + "borsh", + "serde_core", +] + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "spin" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spin" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "023a211cb3138dbc438680b32560ad89f699977624c9f8dbb95a47d5b4c07dd3" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spirv" +version = "0.4.0+sdk-1.4.341.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "sqlx" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc" +dependencies = [ + "sqlx-core", + "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", +] + +[[package]] +name = "sqlx-core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6" +dependencies = [ + "base64 0.22.1", + "bytes", + "chrono", + "crc", + "crossbeam-queue", + "either", + "event-listener", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashbrown 0.15.5", + "hashlink", + "indexmap", + "log", + "memchr", + "once_cell", + "percent-encoding", + "serde", + "serde_json", + "sha2 0.10.9", + "smallvec", + "thiserror 2.0.21", + "tokio", + "tokio-stream", + "tracing", + "url", +] + +[[package]] +name = "sqlx-macros" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 2.0.119", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b" +dependencies = [ + "dotenvy", + "either", + "heck 0.5.0", + "hex", + "once_cell", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2 0.10.9", + "sqlx-core", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", + "syn 2.0.119", + "tokio", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526" +dependencies = [ + "atoi", + "base64 0.22.1", + "bitflags 2.13.2", + "byteorder", + "bytes", + "chrono", + "crc", + "digest 0.10.7", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand 0.8.8", + "rsa", + "serde", + "sha1", + "sha2 0.10.9", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror 2.0.21", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46" +dependencies = [ + "atoi", + "base64 0.22.1", + "bitflags 2.13.2", + "byteorder", + "chrono", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "rand 0.8.8", + "serde", + "serde_json", + "sha2 0.10.9", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror 2.0.21", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2d12fe70b2c1b4401038055f90f151b78208de1f9f89a7dbfd41587a10c3eea" +dependencies = [ + "atoi", + "chrono", + "flume 0.11.1", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "serde_urlencoded", + "sqlx-core", + "thiserror 2.0.21", + "tracing", + "url", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "stacker" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707f49d46706bacf8a2b00d51dace3f9de527c13eec3778f570c411f89e69967" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "windows-sys 0.61.2", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" +dependencies = [ + "float-cmp", +] + +[[package]] +name = "string_cache" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffa8a5dbe8b3f0bbe29d4c3225daafaeead63afdc1b65fc4c01a1384166038e6" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared 0.14.0", + "precomputed-hash", +] + +[[package]] +name = "string_cache_codegen" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928dcdf75e47626b3617a976ec205d9f057584c371c1f23b782129268d0e6edc" +dependencies = [ + "phf_generator 0.14.0", + "phf_shared 0.14.0", + "proc-macro2", + "quote", +] + +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" +dependencies = [ + "strum_macros 0.27.2", +] + +[[package]] +name = "strum" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" +dependencies = [ + "strum_macros 0.28.0", +] + +[[package]] +name = "strum_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "strum_macros" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "svg_fmt" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0193cc4331cfd2f3d2011ef287590868599a2f33c3e69bc22c1a3d3acf9e02fb" + +[[package]] +name = "svgtypes" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f12b12995e3638c70618c1facb1ce65302f6a6f706b675f07c58a5d7391120e" +dependencies = [ + "kurbo", + "siphasher", +] + +[[package]] +name = "swash" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c2499c2d826531388872b2268718aed907a39bd785ab0dcfe57fab26283f92e" +dependencies = [ + "skrifa 0.40.0", + "yazi", + "zeno", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "syntect" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "656b45c05d95a5704399aeef6bd0ddec7b2b3531b7c9e900abbf7c4d2190c925" +dependencies = [ + "bincode", + "fancy-regex 0.16.2", + "flate2", + "fnv", + "once_cell", + "plist", + "regex-syntax 0.8.12", + "serde", + "serde_derive", + "serde_json", + "thiserror 2.0.21", + "walkdir", + "yaml-rust", +] + +[[package]] +name = "sys-locale" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" +dependencies = [ + "libc", +] + +[[package]] +name = "taffy" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8480887e8803986d96a7173729565520d4bbb721ad6b7ad6941a22897207aa" +dependencies = [ + "serde", + "slotmap", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix 1.1.6", + "windows-sys 0.61.2", +] + +[[package]] +name = "tendril" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fed54709c5b3a53d09bb1c113ea4f5ceafd1e772ddcb0030a82e1d56c087b08" +dependencies = [ + "new_debug_unreachable", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "text-size" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233" + +[[package]] +name = "thin-vec" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6a4b9ba8738cb4a4f399d37e266becfd475e75eb73425b87a05a2f2039ba63e" + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "thread_local" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "time" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tiny-skia" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "png 0.17.16", + "tiny-skia-path 0.11.4", +] + +[[package]] +name = "tiny-skia-path" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tiny-skia-path" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edca365c3faccca67d06593c5980fa6c57687de727a03131735bb85f01fdeeb9" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "serde_core", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tokio-stream" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite 0.26.2", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f72a05e828585856dacd553fba484c242c46e391fb0e58917c942ee9202915c" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite 0.29.0", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime 0.6.11", + "toml_edit 0.22.27", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime 0.6.11", + "toml_write", + "winnow 0.7.15", +] + +[[package]] +name = "toml_edit" +version = "0.25.20+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e76360e201d6dbd6583e17795ba71a88f47365a9139c8450a7979c32303b8e73" +dependencies = [ + "indexmap", + "toml_datetime 1.1.3+spec-1.1.0", + "toml_parser", + "winnow 1.0.5", +] + +[[package]] +name = "toml_parser" +version = "1.1.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6769c452d71ba30696c6b37770c439a9cc9110f47f7d5cdbeda79840ef5ea31" +dependencies = [ + "winnow 1.0.5", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags 2.13.2", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "ttf-parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" +dependencies = [ + "core_maths", +] + +[[package]] +name = "tungstenite" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.9.5", + "sha1", + "thiserror 2.0.21", + "utf-8", +] + +[[package]] +name = "tungstenite" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c01152af293afb9c7c2a57e4b559c5620b421f6d133261c60dd2d0cdb38e6b8" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.9.5", + "sha1", + "thiserror 2.0.21", +] + +[[package]] +name = "two-face" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e51b6e60e545cfdae5a4639ff423818f52372211a8d9a3e892b4b0761f76b2" +dependencies = [ + "serde", + "serde_derive", + "syntect", +] + +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "typst" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cb79435d128de5d5443a058a983f6dcc16738760fa55ed703762bc278b1fd3" +dependencies = [ + "arrayvec", + "comemo", + "ecow", + "rustc-hash 2.1.3", + "typst-eval", + "typst-html", + "typst-layout", + "typst-library", + "typst-macros", + "typst-realize", + "typst-syntax", + "typst-timing", + "typst-utils", +] + +[[package]] +name = "typst-assets" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcee505dac6702dd1c5e65aa2e94a6179d19ee09e2e5637d7313db91765dc4e0" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "typst-eval" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8823e1822bd181d8bee47b05632d16bf3a0a8ab042e01d815826350d7ae16c3" +dependencies = [ + "comemo", + "ecow", + "indexmap", + "rustc-hash 2.1.3", + "stacker", + "toml", + "typst-library", + "typst-macros", + "typst-syntax", + "typst-timing", + "typst-utils", + "unicode-segmentation", +] + +[[package]] +name = "typst-html" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f41bcfbe480b640c4447d8bf9bb59020da610f239aa032d53328651a03572c09" +dependencies = [ + "az", + "bumpalo", + "comemo", + "ecow", + "palette", + "rustc-hash 2.1.3", + "time", + "typst-assets", + "typst-library", + "typst-macros", + "typst-svg", + "typst-syntax", + "typst-timing", + "typst-utils", + "unicode-math-class", +] + +[[package]] +name = "typst-layout" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1916c407baf8f8815e5d50030eed6d5ac6a0702d927b3c156e38db7a618499e2" +dependencies = [ + "az", + "bumpalo", + "codex", + "comemo", + "ecow", + "either", + "hypher", + "icu_properties", + "icu_provider", + "icu_provider_blob", + "icu_segmenter", + "kurbo", + "libm", + "memchr", + "rustc-hash 2.1.3", + "rustybuzz", + "smallvec", + "ttf-parser", + "typst-assets", + "typst-library", + "typst-macros", + "typst-syntax", + "typst-timing", + "typst-utils", + "unicode-bidi", + "unicode-math-class", + "unicode-script", + "unicode-segmentation", +] + +[[package]] +name = "typst-library" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12becd02464849f1507f3c4ef3f401a4d28d5938cc74b6acc6f1d703458bf393" +dependencies = [ + "arrayvec", + "az", + "bitflags 2.13.2", + "bumpalo", + "ciborium", + "codex", + "comemo", + "csv", + "ecow", + "either", + "flate2", + "fontdb", + "glidesort", + "hayagriva", + "hayro-syntax 0.7.2", + "icu_properties", + "image", + "indexmap", + "kamadak-exif", + "kurbo", + "libm", + "lipsum", + "memchr", + "moxcms", + "palette", + "percent-encoding", + "phf 0.13.1", + "png 0.18.1", + "rayon", + "regex", + "regex-syntax 0.8.12", + "roxmltree 0.21.2", + "rust_decimal", + "rustc-hash 2.1.3", + "rustybuzz", + "serde", + "serde_json", + "serde_yaml", + "siphasher", + "smallvec", + "syntect", + "time", + "toml", + "ttf-parser", + "two-face", + "typed-arena", + "typst-assets", + "typst-macros", + "typst-syntax", + "typst-timing", + "typst-utils", + "unicode-math-class", + "unicode-normalization", + "unicode-segmentation", + "unscanny", + "usvg 0.47.0", + "utf8_iter", + "wasmi", + "xmlwriter", +] + +[[package]] +name = "typst-macros" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "033626e6fd43dc09170a9237c55a4dd308005fd751456a0c81b5864f822a97df" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "typst-realize" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f2eb73ab25add88cab03b26effabc657977fe850ff81556b28c6b137ff4bf1" +dependencies = [ + "arrayvec", + "bumpalo", + "comemo", + "ecow", + "regex", + "typst-html", + "typst-library", + "typst-macros", + "typst-syntax", + "typst-timing", + "typst-utils", +] + +[[package]] +name = "typst-svg" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5df6dc785695aae085678bd6657aa04a1d26058a76ed042e738658078bca681e" +dependencies = [ + "base64 0.22.1", + "comemo", + "ecow", + "flate2", + "hayro 0.7.1", + "hayro-svg", + "image", + "indexmap", + "itoa", + "rustc-hash 2.1.3", + "ryu", + "ttf-parser", + "typst-assets", + "typst-layout", + "typst-library", + "typst-macros", + "typst-timing", + "typst-utils", + "xmlwriter", +] + +[[package]] +name = "typst-syntax" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92a20d79df5d10c7fb0b4f7c18e4b2671edfc21e5ed9ad9894e18cccefd1c70f" +dependencies = [ + "ecow", + "rustc-hash 2.1.3", + "serde", + "toml", + "typst-timing", + "typst-utils", + "unicode-ident", + "unicode-math-class", + "unicode-script", + "unicode-segmentation", + "unscanny", +] + +[[package]] +name = "typst-timing" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab6ee5110f671a23164c61caa85dbc476043d503103dedd36f16d93f970f3f59" +dependencies = [ + "parking_lot", + "serde", + "serde_json", +] + +[[package]] +name = "typst-utils" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b33ad1675497b45ae9d960a16e95207c35c2c46330d1a6249a9a977670c8c160" +dependencies = [ + "libm", + "once_cell", + "portable-atomic", + "rayon", + "rustc-hash 2.1.3", + "semver", + "siphasher", + "smallvec", + "thin-vec", + "unicode-math-class", +] + +[[package]] +name = "ucd-trie" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f20bdbfc9915686faa18fb5bbe8b4552778505defbf9f12289beefbc44092a6" + +[[package]] +name = "ui" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-channel", + "async-task", + "backtrace", + "bitflags 2.13.2", + "block2", + "bytemuck", + "cbindgen", + "console_error_panic_hook", + "core-foundation", + "core-foundation-sys", + "core-graphics", + "core-text", + "cosmic-text", + "ctor", + "derive_more", + "dispatch2", + "etagere", + "flume 0.12.0", + "foreign-types", + "frame-audit", + "futures", + "getrandom 0.3.4", + "icu_segmenter", + "image", + "indexmap", + "itertools", + "js-sys", + "libc", + "log", + "lyon", + "mach2", + "num_cpus", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-core-text", + "objc2-core-video", + "objc2-foundation", + "objc2-metal", + "objc2-quartz-core", + "objc2-uniform-type-identifiers", + "parking", + "parking_lot", + "pathfinder_geometry", + "pin-project", + "pollster", + "rand 0.9.5", + "raw-window-handle", + "resvg", + "rustc-hash 2.1.3", + "seahash", + "semver", + "serde", + "serde_json", + "slotmap", + "smallvec", + "smol_str", + "spin 0.10.1", + "strum 0.28.0", + "swash", + "taffy", + "thiserror 2.0.21", + "unicode-bidi", + "unicode-properties", + "unicode-script", + "unicode-segmentation", + "url", + "usvg 0.46.0", + "uuid", + "waker-fn", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "web-time", + "wgpu", + "zed-font-kit", +] + +[[package]] +name = "ui-kit" +version = "0.1.0" +dependencies = [ + "ui", +] + +[[package]] +name = "ui-tokens" +version = "0.1.0" + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unic-langid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ba52c9b05311f4f6e62d5d9d46f094bd6e84cb8df7b3ef952748d752a7d05" +dependencies = [ + "unic-langid-impl", + "unic-langid-macros", +] + +[[package]] +name = "unic-langid-impl" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce1bf08044d4b7a94028c93786f8566047edc11110595914de93362559bc658" +dependencies = [ + "serde", + "tinystr", +] + +[[package]] +name = "unic-langid-macros" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5957eb82e346d7add14182a3315a7e298f04e1ba4baac36f7f0dbfedba5fc25" +dependencies = [ + "proc-macro-hack", + "tinystr", + "unic-langid-impl", + "unic-langid-macros-impl", +] + +[[package]] +name = "unic-langid-macros-impl" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1249a628de3ad34b821ecb1001355bca3940bcb2f88558f1a8bd82e977f75b5" +dependencies = [ + "proc-macro-hack", + "quote", + "syn 2.0.119", + "unic-langid-impl", +] + +[[package]] +name = "unicase" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357cc3acc6a036009fd6c973ed009037c732d60d0b4f6c673e9041497482a28f" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-bidi-mirroring" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfa6e8c60bb66d49db113e0125ee8711b7647b5579dc7f5f19c42357ed039fe" + +[[package]] +name = "unicode-ccc" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e" + +[[package]] +name = "unicode-general-category" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + +[[package]] +name = "unicode-math-class" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d246cf599d5fae3c8d56e04b20eb519adb89a8af8d0b0fbcded369aa3647d65" + +[[package]] +name = "unicode-normalization" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75cd3fb03d5288b3ba9a1ee103ac7e9cbb59f0b03d64f8ddfcc04dd42758a85d" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-properties" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" + +[[package]] +name = "unicode-script" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa04c955db05429d464c74d495c1ee677e1866e783a4c3747f9c0cef7756cabf" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-vo" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" + +[[package]] +name = "unicode-width" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557" + +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + +[[package]] +name = "unscanny" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9df2af067a7953e9c3831320f35c1cc0600c30d44d9f7a12b01db1cd88d6b47" + +[[package]] +name = "url" +version = "2.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", + "serde_derive", +] + +[[package]] +name = "usvg" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e419dff010bb12512b0ae9e3d2f318dfbdf0167fde7eb05465134d4e8756076f" +dependencies = [ + "base64 0.22.1", + "data-url", + "flate2", + "fontdb", + "imagesize", + "kurbo", + "log", + "pico-args", + "roxmltree 0.21.2", + "rustybuzz", + "simplecss", + "siphasher", + "strict-num", + "svgtypes", + "tiny-skia-path 0.11.4", + "unicode-bidi", + "unicode-script", + "unicode-vo", + "xmlwriter", +] + +[[package]] +name = "usvg" +version = "0.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d46cf96c5f498d36b7a9693bc6a7075c0bb9303189d61b2249b0dc3d309c07de" +dependencies = [ + "base64 0.22.1", + "data-url", + "flate2", + "fontdb", + "imagesize", + "kurbo", + "log", + "pico-args", + "roxmltree 0.21.2", + "rustybuzz", + "simplecss", + "siphasher", + "strict-num", + "svgtypes", + "tiny-skia-path 0.12.0", + "ttf-parser", + "unicode-bidi", + "unicode-script", + "unicode-vo", + "xmlwriter", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf16_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c7de35d9d8757dbc1f5125dc8b51438c68b4430546a735c3a9b91aaaaf9a18a" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf8_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + +[[package]] +name = "uuid" +version = "1.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c14b15dffa2f4bd712103e857140aa04a4f2ff6e955c77d7eb8e53ee02a3b64" +dependencies = [ + "getrandom 0.4.3", + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "vello_common" +version = "0.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3361bff7f7d82c0c496b92048db83846691f0e844cc28dee92b1c824291b55ee" +dependencies = [ + "bytemuck", + "fearless_simd 0.4.1", + "guillotiere", + "hashbrown 0.17.1", + "log", + "peniko", + "png 0.18.1", + "smallvec", + "thiserror 2.0.21", +] + +[[package]] +name = "vello_common" +version = "0.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d672facaa2d697285a786cd9d44d614cd2ce54cdc022504bf339f8fff3b750" +dependencies = [ + "bytemuck", + "fearless_simd 0.4.1", + "guillotiere", + "hashbrown 0.17.1", + "log", + "peniko", + "png 0.18.1", + "smallvec", + "thiserror 2.0.21", +] + +[[package]] +name = "vello_common" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73c2fbe53548bcd25c8ff42f75a93770a8611a16b37bee56d7ef7b44e36027f1" +dependencies = [ + "bytemuck", + "fearless_simd 0.7.0", + "guillotiere", + "log", + "peniko", + "png 0.18.1", + "smallvec", + "thiserror 2.0.21", +] + +[[package]] +name = "vello_cpu" +version = "0.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d8ded630e8316bb94a55881256506d1f3b9947b5f66db8a7d32ca7ba02decd0" +dependencies = [ + "bytemuck", + "glifo 0.1.1", + "hashbrown 0.17.1", + "png 0.18.1", + "vello_common 0.0.8", +] + +[[package]] +name = "vello_cpu" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed1fec424fbba6acf6cbc78bb526447eb77590d95f40419d598870fe37535212" +dependencies = [ + "bytemuck", + "glifo 0.4.0", + "hashbrown 0.17.1", + "png 0.18.1", + "vello_common 0.3.0", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] + +[[package]] +name = "waker-fn" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" + +[[package]] +name = "walkdir" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42e295b7452c4604982280d8586001fcad9b8b201cac67bca9771e7a7475403" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" +dependencies = [ + "cfg-if", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.10", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasmi" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2300d0f78cba12f14e29e8dd157ea64050c0a688179aefdb2050105805594a0c" +dependencies = [ + "spin 0.9.9", + "wasmi_collections", + "wasmi_core", + "wasmi_ir", + "wasmparser", +] + +[[package]] +name = "wasmi_collections" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8a8c42a2a76148d43097b1d7cc2a5bf33d5c23bd4dd69015fc887e311767884" + +[[package]] +name = "wasmi_core" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9013136083d988725953390bf668b64b7a218fabf26f8b913bbc59546b97ee27" +dependencies = [ + "libm", +] + +[[package]] +name = "wasmi_ir" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba1fa003f79156f406d62ef0e1464dc03e11ace37170e9fa7524299a75ad8f68" +dependencies = [ + "wasmi_core", +] + +[[package]] +name = "wasmparser" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "wayland-sys" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web_atoms" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7572660c8890448ba236b7376f27e389c6a7e1c70195622faced601f855c0ada" +dependencies = [ + "phf 0.14.0", + "phf_codegen 0.14.0", + "string_cache", + "string_cache_codegen", +] + +[[package]] +name = "weezl" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" + +[[package]] +name = "wgpu" +version = "30.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=cddb2f5d80dc0009b2ef6767635140cacf90a007#cddb2f5d80dc0009b2ef6767635140cacf90a007" +dependencies = [ + "arrayvec", + "bitflags 2.13.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "js-sys", + "log", + "naga", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core", + "wgpu-hal", + "wgpu-sync", + "wgpu-types", +] + +[[package]] +name = "wgpu-core" +version = "30.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=cddb2f5d80dc0009b2ef6767635140cacf90a007#cddb2f5d80dc0009b2ef6767635140cacf90a007" +dependencies = [ + "arrayvec", + "bit-set 0.11.1", + "bit-vec 0.10.2", + "bitflags 2.13.2", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "indexmap", + "log", + "naga", + "naga-types", + "num-traits", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "scopeguard", + "smallvec", + "thiserror 2.0.21", + "wgpu-core-deps-emscripten", + "wgpu-core-deps-linux-android-bsd", + "wgpu-core-deps-wasm", + "wgpu-core-deps-windows", + "wgpu-hal", + "wgpu-naga-bridge", + "wgpu-sync", + "wgpu-types", +] + +[[package]] +name = "wgpu-core-deps-emscripten" +version = "30.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=cddb2f5d80dc0009b2ef6767635140cacf90a007#cddb2f5d80dc0009b2ef6767635140cacf90a007" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-linux-android-bsd" +version = "30.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=cddb2f5d80dc0009b2ef6767635140cacf90a007#cddb2f5d80dc0009b2ef6767635140cacf90a007" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-wasm" +version = "30.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=cddb2f5d80dc0009b2ef6767635140cacf90a007#cddb2f5d80dc0009b2ef6767635140cacf90a007" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-windows" +version = "30.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=cddb2f5d80dc0009b2ef6767635140cacf90a007#cddb2f5d80dc0009b2ef6767635140cacf90a007" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-hal" +version = "30.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=cddb2f5d80dc0009b2ef6767635140cacf90a007#cddb2f5d80dc0009b2ef6767635140cacf90a007" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bitflags 2.13.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "glow", + "glutin_wgl_sys", + "gpu-allocator", + "hashbrown 0.17.1", + "js-sys", + "khronos-egl", + "libc", + "libloading", + "log", + "naga", + "naga-types", + "ndk-sys", + "objc2", + "ordered-float", + "profiling", + "raw-window-handle", + "raw-window-metal", + "renderdoc-sys", + "smallvec", + "static_assertions", + "thiserror 2.0.21", + "wasm-bindgen", + "wayland-sys", + "web-sys", + "wgpu-naga-bridge", + "wgpu-sync", + "wgpu-types", + "windows", + "windows-core 0.62.2", + "windows-result 0.4.1", +] + +[[package]] +name = "wgpu-naga-bridge" +version = "30.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=cddb2f5d80dc0009b2ef6767635140cacf90a007#cddb2f5d80dc0009b2ef6767635140cacf90a007" +dependencies = [ + "naga", + "wgpu-types", +] + +[[package]] +name = "wgpu-sync" +version = "30.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=cddb2f5d80dc0009b2ef6767635140cacf90a007#cddb2f5d80dc0009b2ef6767635140cacf90a007" +dependencies = [ + "cfg-if", + "lock_api", + "once_cell", + "parking_lot", + "portable-atomic", + "portable-atomic-util", +] + +[[package]] +name = "wgpu-types" +version = "30.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=cddb2f5d80dc0009b2ef6767635140cacf90a007#cddb2f5d80dc0009b2ef6767635140cacf90a007" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "js-sys", + "log", + "macro_rules_attribute", + "naga-types", + "raw-window-handle", + "static_assertions", + "web-sys", +] + +[[package]] +name = "which" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bf3ea8596f3a0dd5980b46430f2058dfe2c36a27ccfbb1845d6fbfcd9ba6e14" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.44", + "windows-sys 0.48.0", +] + +[[package]] +name = "whoami" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d" +dependencies = [ + "libredox", + "wasite", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core 0.62.2", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core 0.62.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement 0.60.2", + "windows-interface 0.59.3", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-core" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "803590c6856f51d15fa2e9fabe4f4703122c8737f72ef2741b4ac09d4c2192f5" +dependencies = [ + "windows-implement 0.100.0", + "windows-interface 0.100.0", + "windows-link 0.100.0", + "windows-result 0.100.0", + "windows-strings 0.100.0", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core 0.62.2", + "windows-link 0.2.1", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-implement" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc1bc82e5a1b1a4d7255861b07881a0407b552f50a4d8543c0c7276fa96f6e8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3f7005c3b757b9b82c2f40c0e71094ff1080adddaf3e8b6ce99b545d3c48796" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-link" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b39de7c7fe78858b0144c50c3fc000bab3be17d5e9b85b1053871693c7f7415" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core 0.62.2", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-result" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44873a1ef61c85d5e2991db91fe656cfcf0731097e00dff1ac860f1cb3b752a0" +dependencies = [ + "windows-link 0.100.0", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a70b590c684f1d2854f74999896f7c0558f1bdde62f599088599e20ea1d2f60" +dependencies = [ + "windows-link 0.100.0", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef" +dependencies = [ + "memchr", +] + +[[package]] +name = "wio" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" +dependencies = [ + "winapi", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "xml-rs" +version = "0.8.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" + +[[package]] +name = "xmlwriter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" + +[[package]] +name = "y-octo" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1c249c160b09c4f0bd6cef90881200667c8e119feff6a9f7c07bb538760d574" +dependencies = [ + "ahash 0.8.12", + "arbitrary", + "async-lock", + "byteorder", + "log", + "loom", + "nom", + "ordered-float", + "ryu-js", + "serde", + "serde_json", + "smol_str", + "thiserror 2.0.21", +] + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "yazi" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac366ea532fa8ee6a992cec9dea525b1dc284e69702f36c2ab5fbebadc81ec86" + +[[package]] +name = "yeslogic-fontconfig-sys" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8b8abf912b9a29ff112e1671c97c33636903d13a69712037190e6805af4f76" +dependencies = [ + "dlib", + "once_cell", + "pkg-config", +] + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zed-font-kit" +version = "0.14.1-zed" +source = "git+https://github.com/zed-industries/font-kit?rev=94b0f28166665e8fd2f53ff6d268a14955c82269#94b0f28166665e8fd2f53ff6d268a14955c82269" +dependencies = [ + "bitflags 2.13.2", + "byteorder", + "core-foundation", + "core-graphics", + "core-text", + "dirs", + "dwrote", + "float-ord", + "freetype-sys", + "lazy_static", + "libc", + "log", + "pathfinder_geometry", + "pathfinder_simd", + "walkdir", + "winapi", + "yeslogic-fontconfig-sys", +] + +[[package]] +name = "zeno" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524" + +[[package]] +name = "zerocopy" +version = "0.8.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed43f3060383c64b000f3c630550aebdfa9d3b76d48de32390483dd2cc7e0865" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5cbd820fe3e35fb38c83b6dc7e6b1618bc46e0cd10073ae94e8d52dc468d8b9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "litemap", + "serde_core", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "serde", + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zune-core" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" + +[[package]] +name = "zune-jpeg" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" +dependencies = [ + "zune-core", +] diff --git a/packages/frontend/Cargo.toml b/packages/frontend/Cargo.toml new file mode 100644 index 0000000000..4af624a321 --- /dev/null +++ b/packages/frontend/Cargo.toml @@ -0,0 +1,374 @@ +[workspace] +resolver = "3" +members = [ + "../ui/tokens", + "../ui/ui", + "../ui/kit", + "../common/store", + "legacy-import", + "client", + "mobile", + "desktop", + "../../blocksuite/crates/doc", + "../../blocksuite/crates/editor", + "../../blocksuite/crates/playground", + "../../blocksuite/crates/preview", + "hosts/android", + "hosts/ios", +] +default-members = [ + "../ui/tokens", + "../ui/ui", + "../ui/kit", + "../common/store", + "legacy-import", + "client", + "mobile", + "desktop", + "../../blocksuite/crates/doc", + "../../blocksuite/crates/editor", + "../../blocksuite/crates/playground", +] +exclude = ["native", "mobile-native"] + +[workspace.package] +version = "0.1.0" +edition = "2024" +publish = false +license = "Apache-2.0" + +[workspace.dependencies] +anyhow = "1.0.86" +async-channel = { version = "2.5", default-features = false } +async-task = "4.7" +backtrace = "0.3" +base64 = "0.22" +bitflags = "2.6.0" +block2 = "0.6" +bytemuck = "1" +cbindgen = { version = "0.28.0", default-features = false } +chrono = { version = "0.4", default-features = false, features = ["std"] } +console_error_panic_hook = "0.1.7" +core-foundation = "0.10" +core-foundation-sys = "0.8.6" +core-graphics = "0.24" +core-text = "21" +cosmic-text = "0.19.0" +ctor = "1.0.12" +derive_more = { version = "2.1", features = ["add", "add_assign", "deref", "deref_mut", "from_str", "mul", "mul_assign", "not"] } +dispatch2 = { version = "0.3", default-features = false, features = ["std"] } +etagere = "0.2" +flume = { version = "0.12", default-features = false, features = ["async"] } +font-kit = { git = "https://github.com/zed-industries/font-kit", rev = "94b0f28166665e8fd2f53ff6d268a14955c82269", package = "zed-font-kit", version = "0.14.1-zed", default-features = false } +fontdb = { version = "0.23.0", default-features = false } +foreign-types = "0.5" +frame-audit = { path = "../../tools/frame-audit" } +futures = "0.3.34" +getrandom = { version = "0.3.4", features = ["wasm_js"] } +icu_segmenter = { version = "2.3.0", default-features = false, features = ["compiled_data"] } +image = { version = "0.25.1", default-features = false, features = ["bmp", "gif", "ico", "jpeg", "png", "webp"] } +indexmap = { version = "2.7.0", features = ["serde"] } +itertools = "0.14.0" +jiff = "1.0" +js-sys = "0.3" +libc = "0.2" +log = { version = "0.4", default-features = false, features = ["std"] } +lyon = "1.0" +mach2 = "0.6" +num_cpus = "1.13" +objc2 = "0.6" +objc2-app-kit = { version = "0.3.2", default-features = false, features = [ + "NSAlert", + "NSAppearance", + "NSApplication", + "NSButton", + "NSCell", + "NSColor", + "NSControl", + "NSCursor", + "NSDocumentController", + "NSDragging", + "NSDraggingItem", + "NSEvent", + "NSGraphics", + "NSImage", + "NSMenu", + "NSMenuItem", + "NSOpenPanel", + "NSPanel", + "NSPasteboard", + "NSResponder", + "NSRunningApplication", + "NSSavePanel", + "NSScreen", + "NSScroller", + "NSTrackingArea", + "NSView", + "NSVisualEffectView", + "NSWindow", + "NSWorkspace", + "block2", + "objc2-core-foundation", + "objc2-uniform-type-identifiers", +] } +objc2-core-foundation = { version = "=0.3.2", default-features = false, features = ["std", "CFData", "CFDictionary", "CFString", "CFNumber", "CFBase", "CFCGTypes"] } +objc2-core-graphics = { version = "=0.3.2", default-features = false, features = ["CGColor", "CGColorSpace", "CGDirectDisplay", "objc2"] } +objc2-core-text = { version = "0.3.2", default-features = false, features = ["std", "CTFont", "CTFontDescriptor"] } +objc2-core-video = { version = "=0.3.2", default-features = false, features = ["CVBuffer", "CVHostTime", "CVImageBuffer", "CVMetalTexture", "CVMetalTextureCache", "CVPixelBuffer", "CVReturn", "objc2", "objc2-metal"] } +objc2-foundation = { version = "=0.3.2", default-features = false, features = [ + "NSArray", + "NSAttributedString", + "NSBundle", + "NSCoder", + "NSData", + "NSDate", + "NSDictionary", + "NSEnumerator", + "NSError", + "NSGeometry", + "NSNotification", + "NSNull", + "NSObjCRuntime", + "NSObject", + "NSOperation", + "NSProcessInfo", + "NSRange", + "NSRunLoop", + "NSSet", + "NSString", + "NSThread", + "NSURL", + "NSValue", + "block2", + "objc2-core-foundation", + "std", +] } +objc2-metal = { version = "0.3.2", default-features = false, features = [ + "std", + "block2", + "dispatch2", + "MTLAllocation", + "MTLBlitCommandEncoder", + "MTLBuffer", + "MTLCommandBuffer", + "MTLCommandEncoder", + "MTLCommandQueue", + "MTLDevice", + "MTLDrawable", + "MTLLibrary", + "MTLPixelFormat", + "MTLRenderCommandEncoder", + "MTLRenderPass", + "MTLRenderPipeline", + "MTLResource", + "MTLTexture", + "MTLTypes", +] } +objc2-quartz-core = { version = "=0.3.2", default-features = false, features = ["std", "CALayer", "CAMetalDisplayLink", "CAMetalLayer", "objc2-core-foundation", "objc2-core-graphics", "objc2-metal"] } +objc2-uniform-type-identifiers = { version = "0.3", default-features = false, features = ["std", "UTCoreTypes", "UTType"] } +parking = "2.0.0" +parking_lot = "0.12.1" +pathfinder_geometry = "0.5" +pin-project = "1.1.10" +pollster = "0.4.0" +rand = { version = "0.9", default-features = false, features = ["std", "std_rng", "os_rng", "small_rng", "thread_rng"] } +raw-window-handle = "0.6" +resvg = { version = "0.46.0", default-features = false, features = ["raster-images"] } +rustc-hash = "2.1.0" +seahash = "4.1" +semver = { version = "1.0", features = ["serde"] } +serde = { version = "1.0", features = ["derive", "rc"] } +serde_json = { version = "1.0.144", features = ["preserve_order"] } +sha2 = "0.10" +slotmap = "1.0.6" +smallvec = { version = "1.6", features = ["union", "const_new"] } +smol_str = { version = "0.3.6", default-features = false, features = ["serde"] } +spin = { version = "0.10", default-features = false, features = ["mutex", "spin_mutex", "lock_api"] } +sqlx = { version = "0.8.6", default-features = false, features = ["sqlite", "migrate", "runtime-tokio", "chrono"] } +strum = { version = "0.28", features = ["derive"] } +swash = "0.2.6" +taffy = { version = "=0.15.0", default-features = false, features = ["std", "taffy_tree", "flexbox", "block_layout", "float_layout", "content_size"] } +thiserror = "2.0.12" +tokio = { version = "1", features = ["macros", "rt-multi-thread"] } +ttf-parser = "0.25" +unicode-bidi = { version = "0.3.18", default-features = false, features = ["hardcoded-data"] } +unicode-normalization = "0.1.26" +unicode-properties = "=0.1.3" +unicode-script = "0.5.7" +unicode-segmentation = "1.10" +url = "2.2" +usvg = { version = "0.46.0", default-features = false } +uuid = { version = "1.1", features = ["serde", "v4"] } +waker-fn = "1.2.0" +wasm-bindgen = "0.2.120" +wasm-bindgen-futures = "0.4" +web-sys = "0.3" +web-time = "1.1.0" +wgpu = { git = "https://github.com/gfx-rs/wgpu", rev = "cddb2f5d80dc0009b2ef6767635140cacf90a007", default-features = false } +y-octo = { version = "0.4.0", default-features = false, features = ["session", "large_refs"] } + +[workspace.lints.rust] +unexpected_cfgs = { level = "deny" } + +[workspace.lints.clippy] +dbg_macro = "deny" +todo = "deny" +declare_interior_mutable_const = "deny" +style = { level = "allow", priority = -1 } +type_complexity = "allow" +let_underscore_future = "allow" +single_range_in_vec_init = "allow" +too_many_arguments = "allow" +large_enum_variant = "allow" +nonminimal_bool = "allow" + +[patch.crates-io] +async-task = { git = "https://github.com/zed-industries/async-task.git", rev = "015845a19fc31752c02367567d3b8900a406f9da" } + +[profile.dev] +debug = 0 +incremental = false +codegen-units = 16 + +[profile.dev.package.merman] +opt-level = "s" +[profile.dev.package.merman-analysis] +opt-level = "s" +[profile.dev.package.merman-ascii] +opt-level = "s" +[profile.dev.package.merman-core] +opt-level = "s" +[profile.dev.package.merman-editor-core] +opt-level = "s" +[profile.dev.package.merman-elk-layered] +opt-level = 0 +[profile.dev.package.merman-layout-elk] +opt-level = 0 +[profile.dev.package.merman-markup] +opt-level = "s" +[profile.dev.package.merman-model] +opt-level = "s" +[profile.dev.package.merman-render] +opt-level = "s" +[profile.dev.package.merman-theme-contract] +opt-level = "s" +[profile.dev.package.typst] +opt-level = "s" +[profile.dev.package.typst-eval] +opt-level = "s" +[profile.dev.package.typst-html] +opt-level = "s" +[profile.dev.package.typst-layout] +opt-level = "s" +[profile.dev.package.typst-library] +opt-level = "s" +[profile.dev.package.typst-realize] +opt-level = "s" +[profile.dev.package.typst-svg] +opt-level = "s" +[profile.dev.package.typst-syntax] +opt-level = "s" +[profile.dev.package.typst-utils] +opt-level = "s" +[profile.dev.package.comemo] +opt-level = "s" +[profile.dev.package.wgpu-core] +opt-level = "s" +[profile.dev.package.wgpu-hal] +opt-level = "s" +[profile.dev.package.naga] +opt-level = "s" +[profile.dev.package.hayro] +opt-level = "s" +[profile.dev.package.hayro-interpret] +opt-level = "s" +[profile.dev.package.hayro-syntax] +opt-level = "s" +[profile.dev.package.hayro-font] +opt-level = "s" +[profile.dev.package.hayro-svg] +opt-level = "s" +[profile.dev.package.resvg] +opt-level = "s" +[profile.dev.package.usvg] +opt-level = "s" +[profile.dev.package.tiny-skia] +opt-level = "s" +[profile.dev.package.cosmic-text] +opt-level = "s" +[profile.dev.package.swash] +opt-level = "s" +[profile.dev.package.skrifa] +opt-level = "s" + +[profile.test] +debug = 0 +incremental = false +codegen-units = 16 + +[profile.release] +debug = "limited" +lto = "thin" +codegen-units = 1 + +[profile.release.package.merman] +opt-level = "z" +[profile.release.package.merman-analysis] +opt-level = "z" +[profile.release.package.merman-ascii] +opt-level = "z" +[profile.release.package.merman-core] +opt-level = "z" +[profile.release.package.merman-editor-core] +opt-level = "z" +[profile.release.package.merman-elk-layered] +opt-level = "z" +[profile.release.package.merman-layout-elk] +opt-level = "z" +[profile.release.package.merman-markup] +opt-level = "z" +[profile.release.package.merman-model] +opt-level = "z" +[profile.release.package.merman-render] +opt-level = "z" +[profile.release.package.merman-theme-contract] +opt-level = "z" +[profile.release.package.typst] +opt-level = "z" +[profile.release.package.typst-eval] +opt-level = "z" +[profile.release.package.typst-html] +opt-level = "z" +[profile.release.package.typst-layout] +opt-level = "z" +[profile.release.package.typst-library] +opt-level = "z" +[profile.release.package.typst-realize] +opt-level = "z" +[profile.release.package.typst-svg] +opt-level = "z" +[profile.release.package.typst-syntax] +opt-level = "z" +[profile.release.package.typst-utils] +opt-level = "z" +[profile.release.package.comemo] +opt-level = "z" + +[profile.wasm-release] +inherits = "release" +debug = 0 + +[profile.wasm-release-size] +inherits = "wasm-release" +opt-level = "s" +lto = false +codegen-units = 1 +strip = "debuginfo" + +[profile.wasm-worker-size] +inherits = "release" +debug = 0 +opt-level = "z" +lto = "fat" +codegen-units = 1 +strip = "debuginfo" diff --git a/packages/frontend/apps/rust-toolchain.toml b/packages/frontend/apps/rust-toolchain.toml new file mode 100644 index 0000000000..30a41bc1f6 --- /dev/null +++ b/packages/frontend/apps/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.97.1" +profile = "default" diff --git a/packages/frontend/component/src/ui/frame-audit/frame-audit.stories.tsx b/packages/frontend/component/src/ui/frame-audit/frame-audit.stories.tsx new file mode 100644 index 0000000000..1686548137 --- /dev/null +++ b/packages/frontend/component/src/ui/frame-audit/frame-audit.stories.tsx @@ -0,0 +1,219 @@ +import type { Meta } from '@storybook/react'; +import type { CSSProperties, ReactNode } from 'react'; + +import { Button } from '../button'; +import { Divider } from '../divider'; + +export default { + title: 'UI/Frame Audit', +} satisfies Meta; + +interface AuditOptions { + role?: 'divider' | 'overlay'; + text?: boolean; + ellipsis?: boolean; + baseline?: string; + footer?: [group: string, priority: number]; +} + +/** Marks an element for the geometry snapshot read by `harness.tsx`. */ +const audit = (id: string, options: AuditOptions = {}) => ({ + 'data-audit-id': id, + 'data-audit-role': options.role, + 'data-audit-text': options.text ? '' : undefined, + 'data-audit-ellipsis': options.ellipsis ? '' : undefined, + 'data-audit-baseline': options.baseline, + 'data-audit-footer': options.footer?.join(':'), +}); + +const Scene = ({ + width = 480, + children, +}: { + width?: number; + children: ReactNode; +}) => ( +
+ {children} +
+); + +const line: CSSProperties = { + display: 'block', + width: 200, + fontSize: 15, + lineHeight: '24px', +}; + +export const FirstLineBaseline = () => ( + +
+ + + A title long enough to wrap onto a second line of this row + + +
+
+); + +export const DialogFooter = () => ( + +
+ + +
+
+); + +export const NestedRadii = () => ( + +
+
+
+ +); + +export const DividedList = () => ( + +
+ {['a', 'b', 'c'].flatMap((item, index) => [ + ...(index > 0 + ? [ + , + ] + : []), +
+ {item} +
, + ])} +
+
+); + +export const NarrowContainer = () => ( + + + A document name far longer than its container + + + +); + +export const FractionalThirds = () => ( + +
+ {['a', 'b', 'c'].map(cell => ( +
+ ))} +
+ +); + +export const FloatingOverlay = () => ( + + +
+ +
+
+); diff --git a/packages/frontend/component/src/ui/frame-audit/harness.tsx b/packages/frontend/component/src/ui/frame-audit/harness.tsx new file mode 100644 index 0000000000..92c987d5bb --- /dev/null +++ b/packages/frontend/component/src/ui/frame-audit/harness.tsx @@ -0,0 +1,196 @@ +import '../../theme'; + +import { flushSync } from 'react-dom'; +import { createRoot } from 'react-dom/client'; + +import * as stories from './frame-audit.stories'; + +type Story = Exclude<(typeof stories)[keyof typeof stories], { title: string }>; + +interface Rect { + x: number; + y: number; + width: number; + height: number; +} + +/** + * Layout may place a box on fractional pixels (three `flex: 1` cells in 470px), + * but the browser paints its edges on the device pixel grid. Each edge is + * rounded on its own, as painted, so adjacent boxes stay adjacent and the + * `pixel-alignment` rule reports only what native layout can get wrong. + */ +const rectOf = ({ left, top, right, bottom }: DOMRect): Rect => { + const snap = (edge: number) => + Math.round(edge * devicePixelRatio) / devicePixelRatio; + const [x, y] = [snap(left), snap(top)]; + return { x, y, width: snap(right) - x, height: snap(bottom) - y }; +}; + +const intersect = (a: Rect, b: Rect): Rect => { + const x = Math.max(a.x, b.x); + const y = Math.max(a.y, b.y); + return { + x, + y, + width: Math.max(0, Math.min(a.x + a.width, b.x + b.width) - x), + height: Math.max(0, Math.min(a.y + a.height, b.y + b.height) - y), + }; +}; + +const CURSORS: Record = { + default: 'default', + pointer: 'pointer', + text: 'text', + grab: 'grab', + 'not-allowed': 'not_allowed', +}; + +function contentMask(el: Element, viewport: Rect) { + let mask = viewport; + for (let p = el.parentElement; p; p = p.parentElement) { + if (getComputedStyle(p).overflow !== 'visible') { + mask = intersect(mask, rectOf(p.getBoundingClientRect())); + } + } + return mask; +} + +function effectiveOpacity(el: Element) { + let opacity = 1; + for (let p: Element | null = el; p; p = p.parentElement) { + opacity *= Number(getComputedStyle(p).opacity); + } + return opacity; +} + +function firstBaseline(el: HTMLElement) { + const probe = document.createElement('span'); + probe.style.cssText = + 'display:inline-block;width:0;height:0;vertical-align:baseline'; + el.prepend(probe); + const baseline = probe.getBoundingClientRect().bottom; + probe.remove(); + return baseline; +} + +function textMetrics(el: HTMLElement) { + const range = document.createRange(); + range.selectNodeContents(el); + const lines = [...range.getClientRects()]; + const style = getComputedStyle(el); + const lineHeight = Number.parseFloat(style.lineHeight); + const lineCount = new Set(lines.map(r => Math.round(r.top))).size; + return { + first_baseline: firstBaseline(el), + first_line: { ...rectOf(el.getBoundingClientRect()), height: lineHeight }, + line_count: lineCount, + overflowed: + el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight, + ellipsis_allowed: + Object.hasOwn(el.dataset, 'auditEllipsis') && + style.textOverflow === 'ellipsis' && + style.overflowX !== 'visible', + }; +} + +function snapshotElement(el: HTMLElement, viewport: Rect) { + const style = getComputedStyle(el); + const footer = el.dataset.auditFooter?.split(':'); + const parent = el.parentElement?.closest('[data-audit-id]'); + const interactive = el.matches('button, a[href], input, [role="button"]'); + const isText = Object.hasOwn(el.dataset, 'auditText'); + return { + id: el.dataset.auditId, + parent_id: parent?.dataset.auditId ?? null, + callsite: `frame-audit.stories.tsx#${el.dataset.auditId}`, + bounds: rectOf(el.getBoundingClientRect()), + content_mask: contentMask(el, viewport), + opacity: effectiveOpacity(el), + interactive, + focused: document.activeElement === el, + corner_radius: Number.parseFloat(style.borderTopLeftRadius) || 0, + padding: Number.parseFloat(style.paddingLeft) || 0, + text: isText ? el.textContent : null, + role: el.dataset.auditRole ?? 'generic', + cursor: CURSORS[style.cursor] ?? null, + selectable: isText && style.userSelect !== 'none', + text_metrics: isText ? textMetrics(el) : null, + baseline_group: el.dataset.auditBaseline ?? null, + footer: footer ? { group: footer[0], priority: Number(footer[1]) } : null, + }; +} + +/** The element receiving pointer events at a point, as an audited id. */ +function hitProbe(x: number, y: number) { + const receiver = document + .elementFromPoint(x, y) + ?.closest('[data-audit-id]'); + return { x, y, receiver: receiver?.dataset.auditId ?? null }; +} + +function snapshotFrame(host: HTMLElement) { + const viewport = { + x: 0, + y: 0, + width: window.innerWidth, + height: window.innerHeight, + }; + const nodes = [...host.querySelectorAll('[data-audit-id]')]; + const elements = Object.fromEntries( + nodes.map(el => [el.dataset.auditId, snapshotElement(el, viewport)]) + ); + const hit_probes = nodes + .filter(el => el.dataset.auditRole === 'overlay' || el.matches('button')) + .map(el => { + const box = el.getBoundingClientRect(); + return hitProbe(box.x + box.width / 2, box.y + box.height / 2); + }); + return { viewport, scale_factor: 1, elements, hit_probes }; +} + +const nextFrame = () => + new Promise(resolve => { + requestAnimationFrame(() => requestAnimationFrame(() => resolve())); + }); + +/** A real style change on one rendered element, captured as its own frame. */ +interface DomCase { + name: string; + story: string; + element: string; + style: Partial; +} + +async function captureStories(domCases: DomCase[]) { + await document.fonts.ready; + const frames: Record> = {}; + const domFrames: typeof frames = {}; + const scenes = Object.entries(stories).filter( + (entry): entry is [string, Story] => typeof entry[1] === 'function' + ); + for (const [name, Story] of scenes) { + const host = document.createElement('div'); + document.body.append(host); + const root = createRoot(host); + flushSync(() => root.render()); + await nextFrame(); + frames[name] = snapshotFrame(host); + for (const domCase of domCases.filter(c => c.story === name)) { + const target = host.querySelector( + `[data-audit-id="${domCase.element}"]` + ); + if (!target) throw new Error(`${name}: no ${domCase.element}`); + const original = target.style.cssText; + Object.assign(target.style, domCase.style); + await nextFrame(); + domFrames[domCase.name] = snapshotFrame(host); + target.style.cssText = original; + } + root.unmount(); + host.remove(); + } + return { frames, domFrames }; +} + +Object.assign(window, { captureFrameAuditStories: captureStories }); diff --git a/packages/frontend/mobile-native/rust-toolchain.toml b/packages/frontend/mobile-native/rust-toolchain.toml new file mode 100644 index 0000000000..30a41bc1f6 --- /dev/null +++ b/packages/frontend/mobile-native/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.97.1" +profile = "default" diff --git a/packages/frontend/mobile-native/rustfmt.toml b/packages/frontend/mobile-native/rustfmt.toml new file mode 100644 index 0000000000..bf7df1cb63 --- /dev/null +++ b/packages/frontend/mobile-native/rustfmt.toml @@ -0,0 +1,13 @@ +edition = "2024" +max_width = 120 +style_edition = "2024" + +hard_tabs = false +tab_spaces = 2 + +format_strings = true +unstable_features = true +wrap_comments = true + +group_imports = "StdExternalCrate" +imports_granularity = "Crate" diff --git a/packages/frontend/native/rust-toolchain.toml b/packages/frontend/native/rust-toolchain.toml new file mode 100644 index 0000000000..30a41bc1f6 --- /dev/null +++ b/packages/frontend/native/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.97.1" +profile = "default" diff --git a/packages/frontend/native/rustfmt.toml b/packages/frontend/native/rustfmt.toml new file mode 100644 index 0000000000..bf7df1cb63 --- /dev/null +++ b/packages/frontend/native/rustfmt.toml @@ -0,0 +1,13 @@ +edition = "2024" +max_width = 120 +style_edition = "2024" + +hard_tabs = false +tab_spaces = 2 + +format_strings = true +unstable_features = true +wrap_comments = true + +group_imports = "StdExternalCrate" +imports_granularity = "Crate" diff --git a/packages/frontend/perf/README.md b/packages/frontend/perf/README.md new file mode 100644 index 0000000000..440ba52e4a --- /dev/null +++ b/packages/frontend/perf/README.md @@ -0,0 +1,85 @@ +# Native Playground CI Performance Guardrail + +Zero-dependency `N-3` regression detector for `darksky/native-playground`. + +## Metrics Schema (`schema.json`) + +Every CI run emits `perf-metrics.json` containing: + +- `schema_version`: integer `1`. +- `commit`: full 40-character lowercase Git SHA. +- `timestamp_utc`: ISO-8601 UTC timestamp. +- `ci_wall_ms`: shared-runner wall-clock durations (`lint_and_wasm`, `headless_linux`, `total_critical_path`). +- `artifacts_bytes`: deterministic build output sizes (`web_wasm_raw`, `web_wasm_gzip`, `headless_bin`). +- `benchmarks`: deterministic engine timings (`{ median, p95 }`, with `p95 >= median`) and work counters: + - `doc_1k_edits_ms` + - `room_sync_1k_ops_ms` + - `layout_10k_blocks_cold_ms` + - `layout_single_keystroke_ms` + - `layout_single_keystroke_blocks_relayout` + - `edgeless_1k_pan_zoom_frame_ms` + - `headless_frame_render_ms` + +Individual sub-keys inside `ci_wall_ms`, `artifacts_bytes`, and `benchmarks` are optional (or `null`) when a benchmark or artifact is not yet produced by CI. Never emit synthetic `0` placeholders for unmeasured metrics: omitted or `null` baseline keys transition cleanly through `BOOTSTRAP` when first introduced instead of triggering false `0 -> positive` (`+inf%`) regressions. + +## Regression Gate vs Advisory Timings + +Current commit metrics are compared against the completed push run from **3 distinct prior commits (`N-3`)** strictly older than the commit under test (`--current-created-at` or the commit's earliest push run on the branch). + +- **Library / seeding mode (default)**: If `N-3` has no valid `perf-metrics.json` artifact, the comparator walks `N-3 -> N-2 -> N-1`; with 0 valid prior baselines (such as the initial seeding runs of a new integration branch like `darksky/np/mobile` before 3 runs exist) it emits `baseline_depth: "bootstrap"`. `--require-baseline` requires at least `N-1` (`baseline !== null`). +- **Strict `N-3` CI mode (`--require-n3`)**: Used on established branches (`native-playground.yml`). Requires `baseline_depth === "N-3"`, a 40-char `baseline_commit`, zero unacknowledged `DROPPED` metrics (`baseline != null && current == null`), and zero unacknowledged `BOOTSTRAP` metrics (`baseline == null && current != null`). If all prior artifacts expire after retention, set `NP_ALLOW_PERF_BOOTSTRAP=1` for 3 seeding runs on the integration branch to re-establish `N-3`. + +1. **Deterministic hard gate (`artifacts_bytes.*`, non-`_ms` work counters under `benchmarks.*`, and unacknowledged `DROPPED` / `--require-n3` `BOOTSTRAP` metrics)**: + - Flagged as `REGRESSED` (`DROPPED` when missing in `current`, `BOOTSTRAP` when missing in `N-3` under `--require-n3`; sets `has_hard_regression: true`) whenever `(current - baseline) / baseline * 100 > 10.0%` (strictly greater than `--threshold-pct`), or when `baseline === 0` and `current > 0`. + - `--fail-on-regression` exits `1` when `has_hard_regression` is `true`. +2. **Shared-runner wall-clock advisories (`benchmarks.*_ms` and `ci_wall_ms.*`)**: + - `benchmarks.*_ms` exceeding `> 10.0%`, and `ci_wall_ms.*` exceeding both `> 10.0%` and `> 15000` ms (`--ci-wall-min-delta-ms`), are reported as `ADVISORY_SLOWDOWN` (`advisory: true`, `regressed: false`, sets `has_advisory_slowdown: true`). + - Advisory timings are surfaced in the Markdown summary and `advisory_metrics` in `perf-verdict.json` for investigation on pinned hardware without failing shared-runner CI. + +## Lifecycle & Regression Acknowledgements (`accepted.json`) + +Intentional increases, newly introduced metrics, and retired metrics are recorded in `perf/accepted.json` (loaded by default, or via `--accepted `): + +```json +[ + { + "metric": "artifacts_bytes.web_wasm_gzip", + "accepted_value": 800000, + "reason": "Bundled new rich-text feature" + }, + { + "metric": "artifacts_bytes.headless_bin", + "action": "bootstrap", + "reason": "Newly introduced metric rolling into N-3" + }, + { + "metric": "benchmarks.layout_single_keystroke_blocks_relayout", + "action": "drop", + "reason": "Retired obsolete counter" + } +] +``` + +- **Value ceiling (`action: "ceiling"`, default)**: When a metric triggers against the rolling baseline and `current <= accepted_value`, the row is marked `ACCEPTED` (`regressed: false`). Once `baseline >= accepted_value`, it is reported in `stale_acceptances`. +- **Intentional new metric (`action: "bootstrap"`)**: Marks `baseline == null && current != null` as `ACCEPTED_BOOTSTRAP` (`regressed: false`) under `--require-n3` for the 3-commit rolling window; once `N-3` includes the metric, it is reported in `stale_acceptances` for pruning. +- **Intentional metric removal (`action: "drop"`)**: Marks `baseline != null && current == null` as `ACCEPTED_DROP` (`regressed: false`); once `N-3` no longer contains the metric, it is reported in `stale_acceptances` for pruning. + +## Usage + +```sh +node packages/frontend/perf/compare-n3.mjs \ + --fetch-github \ + --repo toeverything/AFFiNE \ + --branch darksky/native-playground \ + --workflow native-playground.yml \ + --run-id "$GITHUB_RUN_ID" \ + --current artifacts/perf-metrics.json \ + --json-out artifacts/perf-verdict.json \ + --fail-on-regression +``` + +## Self-Tests + +```sh +node --test packages/frontend/perf/compare-n3.test.mjs +``` diff --git a/packages/frontend/perf/accepted.json b/packages/frontend/perf/accepted.json new file mode 100644 index 0000000000..17ac390e59 --- /dev/null +++ b/packages/frontend/perf/accepted.json @@ -0,0 +1,8 @@ +[ + { + "metric": "artifacts_bytes.headless_bin", + "action": "ceiling", + "accepted_value": 286000000, + "reason": "Native non-wasm32 targets link full blocksuite-preview (RaTeX math, Hayro PDF, Merman Mermaid, and Typst compiler with opt-level=s on dev/test deps) alongside desktop/mobile editing, edgeless spatial blocks, and touch interaction state machines (measured 280,311,728 B); wasm32 main bundle remains isolated via lazy workers." + } +] diff --git a/packages/frontend/perf/compare-n3.mjs b/packages/frontend/perf/compare-n3.mjs new file mode 100644 index 0000000000..4598b254bb --- /dev/null +++ b/packages/frontend/perf/compare-n3.mjs @@ -0,0 +1,1410 @@ +#!/usr/bin/env node +import { execFileSync } from 'node:child_process'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; +import { fileURLToPath, pathToFileURL } from 'node:url'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + +export const DEFAULT_THRESHOLD_PCT = 10; +export const DEFAULT_CI_WALL_MIN_DELTA_MS = 15_000; +export const DEFAULT_ARTIFACT_NAME = 'perf-metrics'; +export const DEFAULT_ACCEPTED_PATH = path.join(__dirname, 'accepted.json'); + +const SHA40_RE = /^[0-9a-f]{40}$/; +const ISO_UTC_RE = + /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/; + +const ALLOWED_TOP_KEYS = new Set([ + 'schema_version', + 'commit', + 'timestamp_utc', + 'ci_wall_ms', + 'artifacts_bytes', + 'benchmarks', +]); + +const BENCHMARK_TIMING_KEYS = new Set([ + 'doc_1k_edits_ms', + 'room_sync_1k_ops_ms', + 'layout_10k_blocks_cold_ms', + 'layout_single_keystroke_ms', + 'edgeless_1k_pan_zoom_frame_ms', + 'headless_frame_render_ms', +]); + +const BENCHMARK_COUNTER_KEYS = new Set([ + 'layout_single_keystroke_blocks_relayout', + 'edgeless_1k_pan_zoom_blocks_relayout', +]); + +const ALL_BENCHMARK_KEYS = [ + 'doc_1k_edits_ms', + 'room_sync_1k_ops_ms', + 'layout_10k_blocks_cold_ms', + 'layout_single_keystroke_ms', + 'layout_single_keystroke_blocks_relayout', + 'edgeless_1k_pan_zoom_frame_ms', + 'edgeless_1k_pan_zoom_blocks_relayout', + 'headless_frame_render_ms', +]; + +const ARTIFACT_SIZE_KEYS = [ + 'web_wasm_raw', + 'web_wasm_gzip', + 'headless_bin', +]; + +const CI_WALL_KEYS = [ + 'lint_and_wasm', + 'headless_linux', + 'total_critical_path', +]; + +const KNOWN_METRIC_KEYS = new Set([ + ...ALL_BENCHMARK_KEYS.map(k => `benchmarks.${k}`), + ...ARTIFACT_SIZE_KEYS.map(k => `artifacts_bytes.${k}`), + ...CI_WALL_KEYS.map(k => `ci_wall_ms.${k}`), +]); + +const INTEGER_METRIC_KEYS = new Set([ + ...ARTIFACT_SIZE_KEYS.map(k => `artifacts_bytes.${k}`), + ...Array.from(BENCHMARK_COUNTER_KEYS, k => `benchmarks.${k}`), +]); + +const ALLOWED_ACCEPTED_KEYS = new Set([ + 'metric', + 'action', + 'accepted_value', + 'reason', +]); +const ALLOWED_ACCEPTED_ACTIONS = new Set(['ceiling', 'bootstrap', 'drop']); + +function isPlainObject(v) { + return v !== null && typeof v === 'object' && !Array.isArray(v); +} + +/** + * Strict zero-dependency validator matching `perf/schema.json`. + * Throws a descriptive Error if any required field is missing, unknown keys + * exist, or numeric/timing invariants are violated. + */ +export function validatePerfMetrics(payload, label = 'perf-metrics') { + if (!isPlainObject(payload)) { + throw new Error(`${label}: expected JSON object`); + } + + for (const key of Object.keys(payload)) { + if (!ALLOWED_TOP_KEYS.has(key)) { + throw new Error(`${label}: unknown top-level key "${key}"`); + } + } + for (const req of ALLOWED_TOP_KEYS) { + if (!(req in payload)) { + throw new Error(`${label}: missing required top-level key "${req}"`); + } + } + + if (payload.schema_version !== 1) { + throw new Error( + `${label}: schema_version must be 1, got ${JSON.stringify(payload.schema_version)}` + ); + } + if (typeof payload.commit !== 'string' || !SHA40_RE.test(payload.commit)) { + throw new Error( + `${label}: commit must be a 40-char lowercase hex SHA, got ${JSON.stringify(payload.commit)}` + ); + } + if ( + typeof payload.timestamp_utc !== 'string' || + !ISO_UTC_RE.test(payload.timestamp_utc) || + Number.isNaN(Date.parse(payload.timestamp_utc)) + ) { + throw new Error( + `${label}: timestamp_utc must be a valid ISO-8601 date-time, got ${JSON.stringify(payload.timestamp_utc)}` + ); + } + + // ci_wall_ms + if (!isPlainObject(payload.ci_wall_ms)) { + throw new Error(`${label}: ci_wall_ms must be an object`); + } + const allowedWall = new Set(CI_WALL_KEYS); + for (const [k, v] of Object.entries(payload.ci_wall_ms)) { + if (!allowedWall.has(k)) { + throw new Error(`${label}: unknown key ci_wall_ms.${k}`); + } + if (v === null) continue; + if (typeof v !== 'number' || !Number.isFinite(v) || v < 0) { + throw new Error(`${label}: ci_wall_ms.${k} must be a non-negative finite number or null`); + } + } + + // artifacts_bytes + if (!isPlainObject(payload.artifacts_bytes)) { + throw new Error(`${label}: artifacts_bytes must be an object`); + } + const allowedArtifacts = new Set(ARTIFACT_SIZE_KEYS); + for (const [k, v] of Object.entries(payload.artifacts_bytes)) { + if (!allowedArtifacts.has(k)) { + throw new Error(`${label}: unknown key artifacts_bytes.${k}`); + } + if (v === null) continue; + if (typeof v !== 'number' || !Number.isInteger(v) || v < 0) { + throw new Error(`${label}: artifacts_bytes.${k} must be a non-negative integer or null`); + } + } + + // benchmarks + if (!isPlainObject(payload.benchmarks)) { + throw new Error(`${label}: benchmarks must be an object`); + } + for (const [k, v] of Object.entries(payload.benchmarks)) { + if (BENCHMARK_TIMING_KEYS.has(k)) { + if (v === null) continue; + if (!isPlainObject(v)) { + throw new Error(`${label}: benchmarks.${k} must be { median, p95 } or null`); + } + const subKeys = Object.keys(v); + for (const sk of subKeys) { + if (sk !== 'median' && sk !== 'p95') { + throw new Error(`${label}: unknown key benchmarks.${k}.${sk}`); + } + } + if ( + typeof v.median !== 'number' || + !Number.isFinite(v.median) || + v.median < 0 + ) { + throw new Error(`${label}: benchmarks.${k}.median must be a non-negative finite number`); + } + if ( + typeof v.p95 !== 'number' || + !Number.isFinite(v.p95) || + v.p95 < 0 + ) { + throw new Error(`${label}: benchmarks.${k}.p95 must be a non-negative finite number`); + } + if (v.p95 < v.median) { + throw new Error( + `${label}: benchmarks.${k}.p95 (${v.p95}) must be >= median (${v.median})` + ); + } + } else if (BENCHMARK_COUNTER_KEYS.has(k)) { + if (v === null) continue; + if (typeof v !== 'number' || !Number.isInteger(v) || v < 0) { + throw new Error(`${label}: benchmarks.${k} must be a non-negative integer or null`); + } + } else { + throw new Error(`${label}: unknown key benchmarks.${k}`); + } + } + + return payload; +} + +/** + * Validate value-ceiling regression acknowledgement entries loaded from `perf/accepted.json`. + */ +export function validateAcceptedEntries(entries, label = 'accepted.json') { + if (!Array.isArray(entries)) { + throw new Error(`${label}: expected a JSON array`); + } + const seenMetrics = new Set(); + return entries.map((entry, idx) => { + if (!isPlainObject(entry)) { + throw new Error(`${label}[${idx}]: expected an object`); + } + for (const k of Object.keys(entry)) { + if (!ALLOWED_ACCEPTED_KEYS.has(k)) { + throw new Error(`${label}[${idx}]: unknown key "${k}"`); + } + } + if (typeof entry.metric !== 'string' || entry.metric.trim() === '') { + throw new Error(`${label}[${idx}].metric must be a non-empty string`); + } + const metric = entry.metric.trim(); + if (!KNOWN_METRIC_KEYS.has(metric)) { + throw new Error(`${label}[${idx}].metric "${metric}" is not a known metric key`); + } + if (seenMetrics.has(metric)) { + throw new Error(`${label}[${idx}]: duplicate metric "${metric}"`); + } + seenMetrics.add(metric); + + const action = entry.action === undefined ? 'ceiling' : entry.action; + if ( + typeof action !== 'string' || + !ALLOWED_ACCEPTED_ACTIONS.has(action) + ) { + throw new Error( + `${label}[${idx}].action must be one of ceiling, bootstrap, drop` + ); + } + + let acceptedValue = null; + if (action === 'ceiling') { + if ( + typeof entry.accepted_value !== 'number' || + !Number.isFinite(entry.accepted_value) || + entry.accepted_value < 0 + ) { + throw new Error( + `${label}[${idx}].accepted_value must be a finite number >= 0` + ); + } + if ( + INTEGER_METRIC_KEYS.has(metric) && + !Number.isInteger(entry.accepted_value) + ) { + throw new Error( + `${label}[${idx}].accepted_value must be an integer for ${metric}` + ); + } + acceptedValue = entry.accepted_value; + } else if ( + entry.accepted_value !== undefined && + entry.accepted_value !== null + ) { + throw new Error( + `${label}[${idx}].accepted_value is only valid for ceiling entries (got action="${action}")` + ); + } + + if (typeof entry.reason !== 'string' || entry.reason.trim() === '') { + throw new Error(`${label}[${idx}].reason must be a non-empty string`); + } + return { + metric, + action, + accepted_value: acceptedValue, + reason: entry.reason.trim(), + }; + }); +} + +/** + * Extract the comparable scalar value from a benchmark entry. + * Timing entries use `{ median, p95 }`; work counters are plain numbers. + */ +export function extractMetricValue(entry) { + if (typeof entry === 'number' && Number.isFinite(entry)) { + return { value: entry, p95: null }; + } + if ( + entry && + typeof entry === 'object' && + typeof entry.median === 'number' && + Number.isFinite(entry.median) + ) { + return { + value: entry.median, + p95: + typeof entry.p95 === 'number' && Number.isFinite(entry.p95) + ? entry.p95 + : null, + }; + } + return null; +} + +function cmpCodeUnit(a, b) { + return a < b ? -1 : a > b ? 1 : 0; +} + +/** + * Select eligible prior completed push runs strictly older than the commit + * under test, deduplicating reruns by `head_sha`. + * + * `options` may be a commit SHA string (legacy signature) or + * `{ currentCommit, currentCreatedAt }`. + */ +export function selectBaselineRun(runs, options = null) { + const currentCommit = + typeof options === 'string' + ? options.toLowerCase() + : options?.currentCommit + ? String(options.currentCommit).toLowerCase() + : null; + const explicitCreatedAt = + typeof options === 'object' && options?.currentCreatedAt + ? options.currentCreatedAt + : null; + const maxCandidates = + typeof options === 'object' && + Number.isInteger(options?.maxCandidates) && + options.maxCandidates > 0 + ? options.maxCandidates + : 3; + + const validRuns = runs.filter( + run => + run && + run.head_sha && + (!run.status || run.status === 'completed') && + (!run.conclusion || run.conclusion === 'success') + ); + + // Determine strict time/position anchor for reruns of older commits. + let anchorTimeMs = explicitCreatedAt ? Date.parse(explicitCreatedAt) : NaN; + let anchorLastIndex = -1; + + if (currentCommit) { + for (let i = 0; i < validRuns.length; i += 1) { + const run = validRuns[i]; + if (String(run.head_sha).toLowerCase() === currentCommit) { + anchorLastIndex = i; + if (run.created_at) { + const ts = Date.parse(run.created_at); + if (!Number.isNaN(ts)) { + anchorTimeMs = Number.isNaN(anchorTimeMs) + ? ts + : Math.min(anchorTimeMs, ts); + } + } + } + } + } + + const seen = new Set(); + if (currentCommit) { + seen.add(currentCommit); + } + + const distinctPrior = []; + for (let i = 0; i < validRuns.length; i += 1) { + const run = validRuns[i]; + const sha = String(run.head_sha).toLowerCase(); + if (seen.has(sha)) continue; + + // Enforce strict "older than current commit" ordering + if (!Number.isNaN(anchorTimeMs) && run.created_at) { + const ts = Date.parse(run.created_at); + if (!Number.isNaN(ts) && ts >= anchorTimeMs) { + continue; + } + } else if (anchorLastIndex >= 0 && i <= anchorLastIndex) { + continue; + } + + seen.add(sha); + distinctPrior.push(run); + if (distinctPrior.length === maxCandidates) break; + } + + if (distinctPrior.length === 0) { + return { + baseline: null, + baselineDepth: 'bootstrap', + eligibleRuns: [], + history: { n1: null, n2: null, n3: null }, + }; + } + + const n1 = distinctPrior[0] ?? null; + const n2 = distinctPrior[1] ?? null; + const n3 = distinctPrior[2] ?? null; + const baseline = n3 ?? n2 ?? n1; + const baselineDepth = n3 ? 'N-3' : n2 ? 'N-2' : 'N-1'; + + return { + baseline, + baselineDepth, + eligibleRuns: distinctPrior, + history: { n1, n2, n3 }, + }; +} + +function roundPct(value) { + if (value === null || !Number.isFinite(value)) return value; + return Math.round(value * 100) / 100; +} + +function exceedsThreshold(curVal, baseVal, { isCiWall, thresholdPct, ciWallMinDeltaMs }) { + const EPS = 1e-9; + const delta = curVal - baseVal; + const deltaPct = + baseVal === 0 + ? curVal > 0 + ? Number.POSITIVE_INFINITY + : 0 + : (delta / baseVal) * 100; + + const pctOver = deltaPct > thresholdPct + EPS; + if (isCiWall) { + return { + delta, + deltaPct, + pctOver, + triggered: pctOver && delta > ciWallMinDeltaMs + EPS, + }; + } + return { + delta, + deltaPct, + pctOver, + triggered: pctOver, + }; +} + +function lookupMetricEntry(payload, category, field) { + if (!payload) return null; + return extractMetricValue(payload[category]?.[field]); +} + +function evaluateSingleMetric({ + key, + category, + field, + unit, + isDeterministicHardGate, + current, + baseline, + n1, + n2, + accepted, + thresholdPct, + ciWallMinDeltaMs, + requireN3 = false, +}) { + const cur = lookupMetricEntry(current, category, field); + const base = lookupMetricEntry(baseline, category, field); + const n1Val = lookupMetricEntry(n1, category, field); + const n2Val = lookupMetricEntry(n2, category, field); + const match = accepted.find(a => a.metric === key) ?? null; + + if (!cur && !base) return null; + + if (!cur) { + const isAcceptedDrop = match?.action === 'drop'; + return { + key, + category, + unit, + deterministic_hard_gate: true, + current: null, + current_p95: null, + baseline: base.value, + baseline_p95: base.p95, + n1: n1Val?.value ?? null, + n2: n2Val?.value ?? null, + delta: null, + delta_pct: null, + delta_pct_infinite: false, + regressed: !isAcceptedDrop, + advisory: false, + accepted: isAcceptedDrop + ? { + accepted: true, + action: 'drop', + accepted_value: null, + reason: match.reason, + } + : null, + stale_acceptance: null, + status: isAcceptedDrop ? 'ACCEPTED_DROP' : 'DROPPED', + }; + } + + if (!base) { + const isAcceptedBootstrap = match?.action === 'bootstrap'; + const unacknowledgedUnderStrictN3 = Boolean( + requireN3 && !isAcceptedBootstrap + ); + return { + key, + category, + unit, + deterministic_hard_gate: isDeterministicHardGate, + current: cur.value, + current_p95: cur.p95, + baseline: null, + baseline_p95: null, + n1: n1Val?.value ?? null, + n2: n2Val?.value ?? null, + delta: null, + delta_pct: null, + delta_pct_infinite: false, + regressed: unacknowledgedUnderStrictN3, + advisory: false, + accepted: isAcceptedBootstrap + ? { + accepted: true, + action: 'bootstrap', + accepted_value: null, + reason: match.reason, + } + : null, + stale_acceptance: null, + status: isAcceptedBootstrap ? 'ACCEPTED_BOOTSTRAP' : 'BOOTSTRAP', + }; + } + + const isCiWall = category === 'ci_wall_ms'; + const EPS = 1e-9; + const check = exceedsThreshold(cur.value, base.value, { + isCiWall, + thresholdPct, + ciWallMinDeltaMs, + }); + + const staleAcceptance = + match?.action === 'ceiling' && base.value >= match.accepted_value - EPS + ? { + key, + unit, + action: 'ceiling', + baseline: base.value, + current: cur.value, + accepted_value: match.accepted_value, + reason: match.reason, + } + : match?.action === 'bootstrap' + ? { + key, + unit, + action: 'bootstrap', + baseline: base.value, + current: cur.value, + accepted_value: null, + reason: match.reason, + } + : null; + + let regressed = false; + let advisory = false; + let status = 'PASS'; + let acceptanceInfo = null; + + if (check.triggered) { + if ( + match?.action === 'ceiling' && + cur.value <= match.accepted_value + EPS + ) { + status = 'ACCEPTED'; + acceptanceInfo = { + accepted: true, + action: 'ceiling', + accepted_value: match.accepted_value, + reason: match.reason, + }; + } else if (isDeterministicHardGate) { + regressed = true; + status = 'REGRESSED'; + } else { + advisory = true; + status = 'ADVISORY_SLOWDOWN'; + } + } else if (isCiWall && check.pctOver) { + status = 'JITTER_IGNORED'; + } else if ( + check.deltaPct <= -thresholdPct + EPS && + (!isCiWall || Math.abs(check.delta) > ciWallMinDeltaMs + EPS) + ) { + status = 'IMPROVED'; + } + + return { + key, + category, + unit, + deterministic_hard_gate: isDeterministicHardGate, + current: cur.value, + current_p95: cur.p95, + baseline: base.value, + baseline_p95: base.p95, + n1: n1Val?.value ?? null, + n2: n2Val?.value ?? null, + delta: Math.round(check.delta * 1000) / 1000, + delta_pct: Number.isFinite(check.deltaPct) + ? roundPct(check.deltaPct) + : null, + delta_pct_infinite: !Number.isFinite(check.deltaPct), + regressed, + advisory, + accepted: acceptanceInfo, + stale_acceptance: staleAcceptance, + status, + }; +} + +/** + * Compare validated current perf-metrics against baseline (N-3 or earliest valid). + */ +export function comparePerfMetrics({ + current, + baseline = null, + n1 = null, + n2 = null, + accepted = [], + baselineDepth = baseline ? 'N-3' : 'bootstrap', + thresholdPct = DEFAULT_THRESHOLD_PCT, + ciWallMinDeltaMs = DEFAULT_CI_WALL_MIN_DELTA_MS, + requireBaseline = false, + requireN3 = false, +}) { + validatePerfMetrics(current, 'current'); + if (baseline !== null) validatePerfMetrics(baseline, 'baseline'); + if (n1 !== null) validatePerfMetrics(n1, 'n1'); + if (n2 !== null) validatePerfMetrics(n2, 'n2'); + const validatedAccepted = validateAcceptedEntries(accepted); + + const metrics = []; + + for (const field of ALL_BENCHMARK_KEYS) { + const isTimingMs = field.endsWith('_ms'); + const row = evaluateSingleMetric({ + key: `benchmarks.${field}`, + category: 'benchmarks', + field, + unit: isTimingMs ? 'ms' : 'count', + isDeterministicHardGate: !isTimingMs, + current, + baseline, + n1, + n2, + accepted: validatedAccepted, + thresholdPct, + ciWallMinDeltaMs, + requireN3, + }); + if (row) metrics.push(row); + } + + for (const field of ARTIFACT_SIZE_KEYS) { + const row = evaluateSingleMetric({ + key: `artifacts_bytes.${field}`, + category: 'artifacts_bytes', + field, + unit: 'bytes', + isDeterministicHardGate: true, + current, + baseline, + n1, + n2, + accepted: validatedAccepted, + thresholdPct, + ciWallMinDeltaMs, + requireN3, + }); + if (row) metrics.push(row); + } + + for (const field of CI_WALL_KEYS) { + const row = evaluateSingleMetric({ + key: `ci_wall_ms.${field}`, + category: 'ci_wall_ms', + field, + unit: 'ms', + isDeterministicHardGate: false, + current, + baseline, + n1, + n2, + accepted: validatedAccepted, + thresholdPct, + ciWallMinDeltaMs, + requireN3, + }); + if (row) metrics.push(row); + } + + const mapSummary = m => ({ + key: m.key, + category: m.category, + current: m.current, + baseline: m.baseline, + delta: m.delta, + delta_pct: m.delta_pct, + delta_pct_infinite: Boolean(m.delta_pct_infinite), + }); + + const regressedMetrics = metrics.filter(m => m.regressed).map(mapSummary); + const advisoryMetrics = metrics.filter(m => m.advisory).map(mapSummary); + const acceptedMetrics = metrics + .filter( + m => + m.status === 'ACCEPTED' || + m.status === 'ACCEPTED_BOOTSTRAP' || + m.status === 'ACCEPTED_DROP' + ) + .map(m => ({ + ...mapSummary(m), + unit: m.unit, + action: m.accepted?.action ?? 'ceiling', + accepted_value: m.accepted?.accepted_value ?? null, + reason: m.accepted?.reason ?? null, + })); + const staleAcceptances = metrics + .filter(m => m.stale_acceptance !== null) + .map(m => m.stale_acceptance); + if (baseline !== null) { + for (const acc of validatedAccepted) { + if (acc.action === 'drop' && !metrics.some(m => m.key === acc.metric)) { + staleAcceptances.push({ + key: acc.metric, + unit: '', + action: 'drop', + baseline: null, + current: null, + accepted_value: null, + reason: acc.reason, + }); + } + } + } + + const resolvedDepth = baseline ? baselineDepth : 'bootstrap'; + const missingRequiredBaseline = Boolean( + (requireBaseline || requireN3) && baseline === null + ); + const invalidN3Depth = Boolean(requireN3 && resolvedDepth !== 'N-3'); + const hasHardRegression = + regressedMetrics.length > 0 || missingRequiredBaseline || invalidN3Depth; + const hasAdvisorySlowdown = advisoryMetrics.length > 0; + + return { + schema_version: 1, + baseline_depth: resolvedDepth, + current_commit: current.commit ?? null, + baseline_commit: baseline?.commit ?? null, + n1_commit: n1?.commit ?? null, + n2_commit: n2?.commit ?? null, + threshold_pct: thresholdPct, + ci_wall_min_delta_ms: ciWallMinDeltaMs, + has_hard_regression: hasHardRegression, + has_advisory_slowdown: hasAdvisorySlowdown, + needs_perf_investigation: hasHardRegression, + regressed_metrics: regressedMetrics, + advisory_metrics: advisoryMetrics, + accepted_metrics: acceptedMetrics, + stale_acceptances: staleAcceptances, + metrics, + }; +} + +function formatValue(value, unit) { + if (value === null || value === undefined) return '—'; + if (unit === 'bytes') { + return `${Math.round(value).toLocaleString('en-US')} B`; + } + if (unit === 'ms') { + return `${Number(value).toFixed(2)} ms`; + } + return String(value); +} + +function formatDeltaPct(metric) { + if ( + metric.status === 'BOOTSTRAP' || + metric.status === 'ACCEPTED_BOOTSTRAP' + ) { + return '—'; + } + if (metric.status === 'DROPPED' || metric.status === 'ACCEPTED_DROP') { + return 'DROPPED'; + } + if (metric.delta_pct_infinite) return '+inf%'; + if (metric.delta_pct === null) return '—'; + const sign = metric.delta_pct > 0 ? '+' : ''; + return `${sign}${metric.delta_pct.toFixed(2)}%`; +} + +function shortSha(sha) { + return sha ? String(sha).slice(0, 10) : 'none'; +} + +export function renderMarkdownSummary(verdict) { + const lines = []; + const label = verdict.baseline_depth; + const statusBadge = verdict.has_hard_regression + ? 'REGRESSION DETECTED (`has_hard_regression: true`)' + : verdict.baseline_depth === 'bootstrap' + ? 'BOOTSTRAP (no prior baseline)' + : verdict.has_advisory_slowdown + ? 'PASS WITH ADVISORY SLOWDOWN (`has_hard_regression: false`, `has_advisory_slowdown: true`)' + : 'PASS (`has_hard_regression: false`)'; + + lines.push(`## Native Playground Performance Guardrail (${label})`); + lines.push(''); + lines.push(`- **Status**: ${statusBadge}`); + lines.push(`- **Current commit**: \`${shortSha(verdict.current_commit)}\``); + lines.push( + `- **Baseline (${label})**: \`${shortSha(verdict.baseline_commit)}\`` + ); + lines.push( + `- **Hard gate**: deterministic byte sizes & work counters \`> ${verdict.threshold_pct}%\` | **Advisory**: \`benchmarks.*_ms\` \`> ${verdict.threshold_pct}%\`, \`ci_wall_ms\` \`> ${verdict.threshold_pct}%\` AND \`> ${verdict.ci_wall_min_delta_ms} ms\`` + ); + lines.push(''); + + if (verdict.has_hard_regression && verdict.baseline_depth !== 'N-3') { + lines.push('### Missing or Incomplete Required Baseline'); + lines.push(''); + lines.push( + `- Prior baseline history check failed (resolved \`baseline_depth: ${verdict.baseline_depth}\`).` + ); + lines.push(''); + } + + if (verdict.regressed_metrics.length > 0) { + lines.push('### Hard Regressions'); + lines.push(''); + for (const item of verdict.regressed_metrics) { + if (item.current === null) { + lines.push( + `- \`${item.key}\`: ${item.baseline} -> missing (DROPPED vs ${label})` + ); + continue; + } + if (item.baseline === null) { + lines.push( + `- \`${item.key}\`: missing -> ${item.current} (UNACKNOWLEDGED BOOTSTRAP vs ${label})` + ); + continue; + } + const pct = item.delta_pct_infinite + ? '+inf%' + : `+${Number(item.delta_pct).toFixed(2)}%`; + lines.push( + `- \`${item.key}\`: ${item.baseline} -> ${item.current} (${pct} vs ${label})` + ); + } + lines.push(''); + } + + if (verdict.advisory_metrics.length > 0) { + lines.push('### Advisory Shared-Runner Slowdowns (Report-Only)'); + lines.push(''); + for (const item of verdict.advisory_metrics) { + const pct = item.delta_pct_infinite + ? '+inf%' + : `+${Number(item.delta_pct).toFixed(2)}%`; + lines.push( + `- \`${item.key}\`: ${item.baseline} -> ${item.current} (${pct} vs ${label})` + ); + } + lines.push(''); + } + + if (verdict.accepted_metrics.length > 0) { + lines.push('### Accepted Changes (`perf/accepted.json`)'); + lines.push(''); + for (const item of verdict.accepted_metrics) { + if (item.action === 'bootstrap') { + lines.push( + `- \`${item.key}\`: missing -> ${item.current} (acknowledged bootstrap: ${item.reason})` + ); + continue; + } + if (item.action === 'drop') { + lines.push( + `- \`${item.key}\`: ${item.baseline} -> missing (acknowledged drop: ${item.reason})` + ); + continue; + } + const pct = item.delta_pct_infinite + ? '+inf%' + : `+${Number(item.delta_pct).toFixed(2)}%`; + lines.push( + `- \`${item.key}\`: ${item.baseline} -> ${item.current} (${pct} vs ${label}, accepted ceiling ${formatValue(item.accepted_value, item.unit)}: ${item.reason})` + ); + } + lines.push(''); + } + + if (verdict.stale_acceptances && verdict.stale_acceptances.length > 0) { + lines.push('### Stale Acceptances (`perf/accepted.json`)'); + lines.push(''); + for (const item of verdict.stale_acceptances) { + if (item.action === 'bootstrap') { + lines.push( + `- \`${item.key}\`: baseline ${formatValue(item.baseline, item.unit)} is now present in ${label} (safe to prune bootstrap entry: ${item.reason})` + ); + } else if (item.action === 'drop') { + lines.push( + `- \`${item.key}\`: metric is no longer present in ${label} (safe to prune drop entry: ${item.reason})` + ); + } else { + lines.push( + `- \`${item.key}\`: baseline ${formatValue(item.baseline, item.unit)} has reached accepted ceiling ${formatValue(item.accepted_value, item.unit)} (safe to prune: ${item.reason})` + ); + } + } + lines.push(''); + } + + const hasHistory = verdict.metrics.some(m => m.n1 !== null || m.n2 !== null); + const headerCols = [ + 'Metric', + `Baseline (${label})`, + ...(hasHistory ? ['N-2', 'N-1'] : []), + 'Current', + `Delta vs ${label}`, + 'Status', + ]; + lines.push(`| ${headerCols.join(' | ')} |`); + lines.push(`| ${headerCols.map(() => '---').join(' | ')} |`); + + for (const m of verdict.metrics) { + const row = [ + `\`${m.key}\``, + formatValue(m.baseline, m.unit), + ...(hasHistory + ? [formatValue(m.n2, m.unit), formatValue(m.n1, m.unit)] + : []), + formatValue(m.current, m.unit), + formatDeltaPct(m), + m.status, + ]; + lines.push(`| ${row.join(' | ')} |`); + } + + lines.push(''); + return `${lines.join('\n')}`; +} + +function runGhApiJson(endpoint) { + const stdout = execFileSync('gh', ['api', endpoint], { + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'pipe'], + }); + return JSON.parse(stdout); +} + +/** + * Strictly select an entry whose basename is `perf-metrics.json`. + * Never falls back to arbitrary `*.json` files (such as `perf-verdict.json`). + */ +export function selectPerfMetricsZipEntry(entries) { + const normalized = entries + .map(e => String(e).trim()) + .filter(e => e.length > 0 && !e.endsWith('/')) + .map(e => e.replace(/^\.\//, '')); + + const exact = normalized.find(e => e === 'perf-metrics.json'); + if (exact) return exact; + + const nested = normalized + .filter(e => e.endsWith('/perf-metrics.json')) + .sort(cmpCodeUnit); + return nested.length > 0 ? nested[0] : null; +} + +/** + * Extract, parse, and strictly validate `perf-metrics.json` from a zip archive. + */ +export function extractPerfMetricsFromZip(zipPath) { + let selectedEntry = null; + try { + const listing = execFileSync('unzip', ['-Z1', zipPath], { + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'pipe'], + }); + selectedEntry = selectPerfMetricsZipEntry(listing.split(/\r?\n/)); + } catch { + selectedEntry = null; + } + + if (selectedEntry) { + const extracted = execFileSync('unzip', ['-p', zipPath, selectedEntry], { + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'pipe'], + }); + return validatePerfMetrics(JSON.parse(extracted), `${zipPath}:${selectedEntry}`); + } + + // Fallback when `unzip -Z1` is unavailable: try only exact and nested perf-metrics.json + for (const pattern of ['perf-metrics.json', '*/perf-metrics.json']) { + try { + const extracted = execFileSync('unzip', ['-p', zipPath, pattern], { + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'pipe'], + }); + if (extracted.trim().length > 0) { + return validatePerfMetrics(JSON.parse(extracted), `${zipPath}:${pattern}`); + } + } catch { + // try next candidate pattern + } + } + + throw new Error(`No valid perf-metrics.json entry found in zip: ${zipPath}`); +} + +function downloadArtifactMetricsJson(repo, runId, artifactName) { + const artifactsResp = runGhApiJson( + `repos/${repo}/actions/runs/${runId}/artifacts?per_page=100` + ); + const artifact = (artifactsResp.artifacts ?? []).find( + a => !a.expired && a.name === artifactName + ); + if (!artifact) { + return null; + } + + const tmpZip = path.join( + os.tmpdir(), + `np-perf-${runId}-${process.pid}-${Date.now()}.zip` + ); + try { + const zipBytes = execFileSync( + 'gh', + ['api', `repos/${repo}/actions/artifacts/${artifact.id}/zip`], + { maxBuffer: 50 * 1024 * 1024 } + ); + fs.writeFileSync(tmpZip, zipBytes); + return extractPerfMetricsFromZip(tmpZip); + } catch { + return null; + } finally { + fs.rmSync(tmpZip, { force: true }); + } +} + +/** + * Walk eligible prior runs from newest to oldest, skipping runs that produced + * no valid perf-metrics artifact (e.g. backend-only or docs-only pushes whose + * native-ui lane was path-filtered), and collect up to 3 valid prior commits + * (`N-1`, `N-2`, `N-3`), using the 3rd valid commit as the `N-3` baseline. + */ +export function resolveWindowFromEligibleRuns(eligibleRuns, loadRun) { + const validPayloads = []; + for (let i = 0; i < eligibleRuns.length; i += 1) { + const payload = loadRun(eligibleRuns[i]); + if (!payload) continue; + try { + validatePerfMetrics(payload, `run:${eligibleRuns[i].id ?? i}`); + validPayloads.push(payload); + if (validPayloads.length === 3) break; + } catch { + // invalid artifact payload; skip and continue searching older runs + } + } + + if (validPayloads.length === 0) { + return { + baseline: null, + n1: null, + n2: null, + baselineDepth: 'bootstrap', + }; + } + + const baselineIdx = validPayloads.length - 1; + const baseline = validPayloads[baselineIdx]; + const baselineDepth = `N-${baselineIdx + 1}`; + const n1 = baselineIdx > 0 ? validPayloads[0] : null; + const n2 = baselineIdx > 1 ? validPayloads[1] : null; + + return { baseline, n1, n2, baselineDepth }; +} + +function fetchGithubHistory({ + repo, + branch, + workflow, + currentCommit, + currentCreatedAt, + runId, + artifactName, +}) { + const encodedBranch = encodeURIComponent(branch); + const encodedWorkflow = encodeURIComponent(workflow); + + let anchorCreatedAt = currentCreatedAt ?? null; + if (!anchorCreatedAt && runId) { + const runResp = runGhApiJson( + `repos/${repo}/actions/runs/${encodeURIComponent(runId)}` + ); + anchorCreatedAt = runResp.created_at ?? null; + } else if (!anchorCreatedAt && currentCommit) { + try { + const shaRunsResp = runGhApiJson( + `repos/${repo}/actions/workflows/${encodedWorkflow}/runs?branch=${encodedBranch}&event=push&head_sha=${encodeURIComponent( + currentCommit + )}&per_page=10` + ); + const shaRuns = (shaRunsResp.workflow_runs ?? []) + .map(r => r.created_at) + .filter(Boolean) + .sort(cmpCodeUnit); + if (shaRuns.length > 0) { + anchorCreatedAt = shaRuns[0]; + } + } catch { + // best-effort anchor lookup + } + } + + const createdFilter = anchorCreatedAt + ? `&created=${encodeURIComponent(`<=${anchorCreatedAt}`)}` + : ''; + const baseEndpoint = `repos/${repo}/actions/workflows/${encodedWorkflow}/runs?branch=${encodedBranch}&event=push&status=completed&per_page=30${createdFilter}`; + + const artifactCache = new Map(); + const loadCachedRun = run => { + if (!artifactCache.has(run.id)) { + artifactCache.set( + run.id, + downloadArtifactMetricsJson(repo, run.id, artifactName) + ); + } + return artifactCache.get(run.id); + }; + + const collectedRuns = []; + let resolved = { + baseline: null, + n1: null, + n2: null, + baselineDepth: 'bootstrap', + }; + for (let page = 1; page <= 3; page += 1) { + const resp = runGhApiJson(`${baseEndpoint}&page=${page}`); + const pageRuns = resp.workflow_runs ?? []; + collectedRuns.push(...pageRuns); + const selection = selectBaselineRun(collectedRuns, { + currentCommit, + currentCreatedAt: anchorCreatedAt, + maxCandidates: 90, + }); + resolved = resolveWindowFromEligibleRuns( + selection.eligibleRuns, + loadCachedRun + ); + if (resolved.baselineDepth === 'N-3' || pageRuns.length < 30) { + break; + } + } + + return resolved; +} + +export function parseArgs(argv) { + const opts = { + current: null, + currentCreatedAt: null, + runId: null, + baseline: null, + n1: null, + n2: null, + accepted: null, + fetchGithub: false, + repo: null, + branch: null, + workflow: null, + artifactName: DEFAULT_ARTIFACT_NAME, + thresholdPct: DEFAULT_THRESHOLD_PCT, + ciWallMinDeltaMs: DEFAULT_CI_WALL_MIN_DELTA_MS, + markdownOut: null, + jsonOut: null, + failOnRegression: false, + requireBaseline: false, + requireN3: false, + }; + + for (let i = 0; i < argv.length; i += 1) { + const arg = argv[i]; + const next = () => { + if (i + 1 >= argv.length) { + throw new Error(`Missing value for ${arg}`); + } + i += 1; + return argv[i]; + }; + + switch (arg) { + case '--current': + opts.current = next(); + break; + case '--current-created-at': + opts.currentCreatedAt = next(); + break; + case '--run-id': + opts.runId = next(); + break; + case '--baseline': + opts.baseline = next(); + break; + case '--n1': + opts.n1 = next(); + break; + case '--n2': + opts.n2 = next(); + break; + case '--accepted': + opts.accepted = next(); + break; + case '--fetch-github': + opts.fetchGithub = true; + break; + case '--repo': + opts.repo = next(); + break; + case '--branch': + opts.branch = next(); + break; + case '--workflow': + opts.workflow = next(); + break; + case '--artifact-name': + opts.artifactName = next(); + break; + case '--threshold-pct': + opts.thresholdPct = Number(next()); + break; + case '--ci-wall-min-delta-ms': + opts.ciWallMinDeltaMs = Number(next()); + break; + case '--markdown-out': + opts.markdownOut = next(); + break; + case '--json-out': + opts.jsonOut = next(); + break; + case '--fail-on-regression': + opts.failOnRegression = true; + break; + case '--require-baseline': + opts.requireBaseline = true; + break; + case '--require-n3': + opts.requireN3 = true; + break; + case '--help': + case '-h': + opts.help = true; + break; + default: + throw new Error(`Unknown argument: ${arg}`); + } + } + + return opts; +} + +function readJsonFile(filePath) { + return JSON.parse(fs.readFileSync(filePath, 'utf8')); +} + +export function main(argv = process.argv.slice(2)) { + const opts = parseArgs(argv); + if (opts.help) { + console.log( + 'Usage: compare-n3.mjs --current [--current-created-at ] [--baseline | --fetch-github --repo --branch --workflow ] [--n1 ] [--n2 ] [--accepted ] [--threshold-pct 10] [--ci-wall-min-delta-ms 15000] [--markdown-out ] [--json-out ] [--require-baseline] [--require-n3] [--fail-on-regression]' + ); + return 0; + } + + if (!opts.current) { + throw new Error('--current is required'); + } + if (!Number.isFinite(opts.thresholdPct) || opts.thresholdPct < 0) { + throw new Error('--threshold-pct must be a non-negative number'); + } + if (!Number.isFinite(opts.ciWallMinDeltaMs) || opts.ciWallMinDeltaMs < 0) { + throw new Error('--ci-wall-min-delta-ms must be a non-negative number'); + } + + const current = validatePerfMetrics(readJsonFile(opts.current), opts.current); + let baseline = null; + let n1 = opts.n1 ? validatePerfMetrics(readJsonFile(opts.n1), opts.n1) : null; + let n2 = opts.n2 ? validatePerfMetrics(readJsonFile(opts.n2), opts.n2) : null; + let baselineDepth = 'N-3'; + + let accepted = []; + if (opts.accepted) { + accepted = validateAcceptedEntries(readJsonFile(opts.accepted), opts.accepted); + } else if (fs.existsSync(DEFAULT_ACCEPTED_PATH)) { + accepted = validateAcceptedEntries( + readJsonFile(DEFAULT_ACCEPTED_PATH), + DEFAULT_ACCEPTED_PATH + ); + } + + if (opts.fetchGithub) { + if (!opts.repo || !opts.branch || !opts.workflow) { + throw new Error( + '--fetch-github requires --repo, --branch, and --workflow' + ); + } + const fetched = fetchGithubHistory({ + repo: opts.repo, + branch: opts.branch, + workflow: opts.workflow, + currentCommit: current.commit ?? null, + currentCreatedAt: opts.currentCreatedAt, + runId: opts.runId, + artifactName: opts.artifactName, + }); + baseline = fetched.baseline; + n1 = n1 ?? fetched.n1; + n2 = n2 ?? fetched.n2; + baselineDepth = fetched.baselineDepth; + } else if (opts.baseline) { + baseline = validatePerfMetrics(readJsonFile(opts.baseline), opts.baseline); + baselineDepth = 'N-3'; + } else { + baselineDepth = 'bootstrap'; + } + + const verdict = comparePerfMetrics({ + current, + baseline, + n1, + n2, + accepted, + baselineDepth, + thresholdPct: opts.thresholdPct, + ciWallMinDeltaMs: opts.ciWallMinDeltaMs, + requireBaseline: opts.requireBaseline, + requireN3: opts.requireN3, + }); + + const markdown = renderMarkdownSummary(verdict); + + if (opts.markdownOut) { + fs.mkdirSync(path.dirname(path.resolve(opts.markdownOut)), { + recursive: true, + }); + fs.writeFileSync(opts.markdownOut, markdown, 'utf8'); + } + + if (opts.jsonOut) { + fs.mkdirSync(path.dirname(path.resolve(opts.jsonOut)), { + recursive: true, + }); + fs.writeFileSync( + opts.jsonOut, + `${JSON.stringify(verdict, null, 2)}\n`, + 'utf8' + ); + } + + if (!opts.markdownOut) { + process.stdout.write(markdown); + } + + if ( + (opts.failOnRegression && verdict.has_hard_regression) || + (opts.requireBaseline && baseline === null) || + (opts.requireN3 && (baseline === null || verdict.baseline_depth !== 'N-3')) + ) { + return 1; + } + return 0; +} + +if ( + process.argv[1] && + import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href +) { + try { + const code = main(process.argv.slice(2)); + process.exitCode = code; + } catch (error) { + console.error(error instanceof Error ? error.message : String(error)); + process.exitCode = 2; + } +} diff --git a/packages/frontend/perf/compare-n3.test.mjs b/packages/frontend/perf/compare-n3.test.mjs new file mode 100644 index 0000000000..d4a2852e34 --- /dev/null +++ b/packages/frontend/perf/compare-n3.test.mjs @@ -0,0 +1,1000 @@ +import assert from 'node:assert/strict'; +import { execFileSync } from 'node:child_process'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; +import test from 'node:test'; +import { fileURLToPath } from 'node:url'; + +import { + comparePerfMetrics, + extractPerfMetricsFromZip, + renderMarkdownSummary, + resolveWindowFromEligibleRuns, + selectBaselineRun, + selectPerfMetricsZipEntry, + validateAcceptedEntries, + validatePerfMetrics, +} from './compare-n3.mjs'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const CLI_PATH = path.join(__dirname, 'compare-n3.mjs'); + +function makeMetrics(commit, overrides = {}) { + return { + schema_version: 1, + commit, + timestamp_utc: '2026-11-21T18:00:00Z', + ci_wall_ms: { + lint_and_wasm: 40_000, + headless_linux: 60_000, + total_critical_path: 80_000, + ...(overrides.ci_wall_ms ?? {}), + }, + artifacts_bytes: { + web_wasm_raw: 2_000_000, + web_wasm_gzip: 700_000, + headless_bin: 15_000_000, + ...(overrides.artifacts_bytes ?? {}), + }, + benchmarks: { + doc_1k_edits_ms: { median: 10.0, p95: 12.0 }, + room_sync_1k_ops_ms: { median: 20.0, p95: 25.0 }, + layout_10k_blocks_cold_ms: { median: 100.0, p95: 112.0 }, + layout_single_keystroke_ms: { median: 0.5, p95: 0.8 }, + layout_single_keystroke_blocks_relayout: 1, + edgeless_1k_pan_zoom_frame_ms: { median: 4.0, p95: 5.0 }, + headless_frame_render_ms: { median: 8.0, p95: 9.5 }, + ...(overrides.benchmarks ?? {}), + }, + }; +} + +function crc32(buf) { + let crc = 0xffffffff; + for (let i = 0; i < buf.length; i += 1) { + crc ^= buf[i]; + for (let j = 0; j < 8; j += 1) { + crc = (crc >>> 1) ^ (crc & 1 ? 0xedb88320 : 0); + } + } + return (crc ^ 0xffffffff) >>> 0; +} + +function buildStoredZip(files) { + const localParts = []; + const centralParts = []; + let offset = 0; + + for (const [name, content] of files) { + const nameBuf = Buffer.from(name, 'utf8'); + const dataBuf = Buffer.from(content, 'utf8'); + const checksum = crc32(dataBuf); + + const local = Buffer.alloc(30); + local.writeUInt32LE(0x04034b50, 0); + local.writeUInt16LE(20, 4); + local.writeUInt16LE(0, 6); + local.writeUInt16LE(0, 8); + local.writeUInt16LE(0, 10); + local.writeUInt16LE(0, 12); + local.writeUInt32LE(checksum, 14); + local.writeUInt32LE(dataBuf.length, 18); + local.writeUInt32LE(dataBuf.length, 22); + local.writeUInt16LE(nameBuf.length, 26); + local.writeUInt16LE(0, 28); + localParts.push(local, nameBuf, dataBuf); + + const central = Buffer.alloc(46); + central.writeUInt32LE(0x02014b50, 0); + central.writeUInt16LE(20, 4); + central.writeUInt16LE(20, 6); + central.writeUInt16LE(0, 8); + central.writeUInt16LE(0, 10); + central.writeUInt16LE(0, 12); + central.writeUInt16LE(0, 14); + central.writeUInt32LE(checksum, 16); + central.writeUInt32LE(dataBuf.length, 20); + central.writeUInt32LE(dataBuf.length, 24); + central.writeUInt16LE(nameBuf.length, 28); + central.writeUInt16LE(0, 30); + central.writeUInt16LE(0, 32); + central.writeUInt16LE(0, 34); + central.writeUInt16LE(0, 36); + central.writeUInt32LE(0, 38); + central.writeUInt32LE(offset, 42); + centralParts.push(central, nameBuf); + + offset += local.length + nameBuf.length + dataBuf.length; + } + + const centralSize = centralParts.reduce((acc, b) => acc + b.length, 0); + const eocd = Buffer.alloc(22); + eocd.writeUInt32LE(0x06054b50, 0); + eocd.writeUInt16LE(0, 4); + eocd.writeUInt16LE(0, 6); + eocd.writeUInt16LE(files.length, 8); + eocd.writeUInt16LE(files.length, 10); + eocd.writeUInt32LE(centralSize, 12); + eocd.writeUInt32LE(offset, 16); + eocd.writeUInt16LE(0, 20); + + return Buffer.concat([...localParts, ...centralParts, eocd]); +} + +test('validatePerfMetrics rejects empty objects, verdict files, unknown keys, and p95 < median', () => { + assert.throws(() => validatePerfMetrics({}), /missing required/); + assert.throws( + () => + validatePerfMetrics({ + schema_version: 1, + has_hard_regression: false, + }), + /unknown top-level key/ + ); + assert.throws( + () => + validatePerfMetrics({ + ...makeMetrics('1'.repeat(40)), + extra_field: 42, + }), + /unknown top-level key/ + ); + assert.throws( + () => + validatePerfMetrics( + makeMetrics('1'.repeat(40), { + benchmarks: { doc_1k_edits_ms: { median: 15.0, p95: 10.0 } }, + }) + ), + /p95 .* must be >= median/ + ); + assert.throws( + () => + validatePerfMetrics({ + ...makeMetrics('1'.repeat(40)), + commit: 'not-a-sha', + }), + /40-char lowercase hex SHA/ + ); +}); + +test('selectBaselineRun handles bootstrap, rerun deduplication, and strict older anchoring', () => { + const s = n => String(n).repeat(40); + const runs = [ + { id: 7, head_sha: s(7), status: 'completed', conclusion: 'success', created_at: '2026-11-21T07:00:00Z' }, + { id: 6, head_sha: s(6), status: 'completed', conclusion: 'success', created_at: '2026-11-21T06:00:00Z' }, + { id: 5, head_sha: s(5), status: 'completed', conclusion: 'success', created_at: '2026-11-21T05:00:00Z' }, + { id: 4, head_sha: s(4), status: 'completed', conclusion: 'success', created_at: '2026-11-21T04:00:00Z' }, + { id: 3, head_sha: s(3), status: 'completed', conclusion: 'success', created_at: '2026-11-21T03:00:00Z' }, + { id: 2, head_sha: s(2), status: 'completed', conclusion: 'success', created_at: '2026-11-21T02:00:00Z' }, + { id: 1, head_sha: s(1), status: 'completed', conclusion: 'success', created_at: '2026-11-21T01:00:00Z' }, + ]; + + // Rerun of commit #4 in [7..1] must consider only [3, 2, 1] and select #1 + const rerun4 = selectBaselineRun(runs, { currentCommit: s(4) }); + assert.equal(rerun4.baseline?.id, 1); + assert.equal(rerun4.baselineDepth, 'N-3'); + assert.deepEqual( + rerun4.eligibleRuns.map(r => r.id), + [3, 2, 1] + ); + + // When SHA #4 is outside the page, --current-created-at still anchors strictly older runs + const pageWithout4 = runs.filter(r => r.id !== 4); + const anchoredByTime = selectBaselineRun(pageWithout4, { + currentCommit: s(4), + currentCreatedAt: '2026-11-21T04:00:00Z', + }); + assert.equal(anchoredByTime.baseline?.id, 1); + assert.deepEqual( + anchoredByTime.eligibleRuns.map(r => r.id), + [3, 2, 1] + ); + + // Bootstrap with 0 prior runs + const empty = selectBaselineRun([], { currentCommit: s(1) }); + assert.equal(empty.baseline, null); + assert.equal(empty.baselineDepth, 'bootstrap'); +}); + +test( + 'resolveWindowFromEligibleRuns falls back to N-2 and skips artifact-less runs', + () => { + const s = n => String(n).repeat(40); + const eligible = [ + { id: 30, head_sha: s(3) }, // N-1 + { id: 20, head_sha: s(2) }, // N-2 + { id: 10, head_sha: s(1) }, // N-3 (missing artifact!) + ]; + const payloads = new Map([ + [30, makeMetrics(s(3))], + [20, makeMetrics(s(2))], + [10, null], + ]); + + const resolved = resolveWindowFromEligibleRuns(eligible, r => + payloads.get(r.id) + ); + assert.equal(resolved.baselineDepth, 'N-2'); + assert.equal(resolved.baseline?.commit, s(2)); + assert.equal(resolved.n1?.commit, s(3)); + assert.equal(resolved.n2, null); + + // Path-filtered backend/docs runs with no perf-metrics artifact must not + // push valid UI runs out of the N-3 window. + const mkRun = n => ({ + id: n * 10, + head_sha: s(n), + status: 'completed', + conclusion: 'success', + created_at: `2026-11-21T0${n}:00:00Z`, + }); + const mixedRuns = [8, 7, 6, 5, 4, 3, 2, 1].map(mkRun); + const sel = selectBaselineRun(mixedRuns, { + currentCommit: s(8), + maxCandidates: 90, + }); + const mixedPayloads = new Map([ + [70, null], + [60, null], + [50, null], + [40, makeMetrics(s(4))], + [30, makeMetrics(s(3))], + [20, makeMetrics(s(2))], + [10, makeMetrics(s(1))], + ]); + const visited = []; + const mixedResolved = resolveWindowFromEligibleRuns(sel.eligibleRuns, r => { + visited.push(r.id); + return mixedPayloads.get(r.id); + }); + assert.equal(mixedResolved.baselineDepth, 'N-3'); + assert.equal(mixedResolved.baseline?.commit, s(2)); + assert.equal(mixedResolved.n1?.commit, s(4)); + assert.equal(mixedResolved.n2?.commit, s(3)); + assert.deepEqual(visited, [70, 60, 50, 40, 30, 20]); +}); + +test('selectPerfMetricsZipEntry rejects verdict-only zips and never falls back to arbitrary json', () => { + assert.equal( + selectPerfMetricsZipEntry(['perf-verdict.json', 'linux-run1.json']), + null + ); + assert.equal( + selectPerfMetricsZipEntry([ + 'linux-run1.json', + 'artifacts/perf-metrics.json', + 'perf-verdict.json', + ]), + 'artifacts/perf-metrics.json' + ); + assert.equal( + selectPerfMetricsZipEntry([ + 'artifacts/perf-metrics.json', + 'perf-metrics.json', + ]), + 'perf-metrics.json' + ); + + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'np-perf-zip-')); + try { + const verdictOnlyZip = path.join(dir, 'verdict-only.zip'); + fs.writeFileSync( + verdictOnlyZip, + buildStoredZip([['perf-verdict.json', JSON.stringify({ has_hard_regression: false })]]) + ); + assert.throws(() => extractPerfMetricsFromZip(verdictOnlyZip), /No valid perf-metrics\.json/); + + const validNestedZip = path.join(dir, 'nested.zip'); + const expected = makeMetrics('9'.repeat(40)); + fs.writeFileSync( + validNestedZip, + buildStoredZip([ + ['perf-verdict.json', JSON.stringify({ noise: true })], + ['artifacts/perf-metrics.json', JSON.stringify(expected)], + ]) + ); + const parsed = extractPerfMetricsFromZip(validNestedZip); + assert.equal(parsed.commit, expected.commit); + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +}); + +test('deterministic hard gate vs advisory shared-runner timings and --fail-on-regression exit codes', () => { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'np-perf-advisory-')); + try { + const basePath = path.join(dir, 'base.json'); + const timingOnlyPath = path.join(dir, 'timing-only.json'); + const bytesRegPath = path.join(dir, 'bytes-reg.json'); + const jsonOut = path.join(dir, 'verdict.json'); + // The gate itself is under test: no ceiling from the repository's perf/accepted.json applies. + const noAcceptedPath = path.join(dir, 'accepted.json'); + fs.writeFileSync(noAcceptedPath, '[]'); + + fs.writeFileSync(basePath, JSON.stringify(makeMetrics('1'.repeat(40)))); + // Only *_ms timings slowed down (>10%) -> ADVISORY_SLOWDOWN, must exit 0 under --fail-on-regression + fs.writeFileSync( + timingOnlyPath, + JSON.stringify( + makeMetrics('2'.repeat(40), { + ci_wall_ms: { + lint_and_wasm: 40_000, + headless_linux: 60_000, + total_critical_path: 100_000, // +25% and +20s -> ADVISORY_SLOWDOWN + }, + benchmarks: { + doc_1k_edits_ms: { median: 15.0, p95: 18.0 }, // +50% -> ADVISORY_SLOWDOWN + }, + }) + ) + ); + // Deterministic byte size grew +12% -> REGRESSED, must exit 1 under --fail-on-regression + fs.writeFileSync( + bytesRegPath, + JSON.stringify( + makeMetrics('3'.repeat(40), { + artifacts_bytes: { + web_wasm_raw: 2_000_000, + web_wasm_gzip: 784_000, // +12% -> REGRESSED + headless_bin: 15_000_000, + }, + }) + ) + ); + + const advStdout = execFileSync( + process.execPath, + [ + CLI_PATH, + '--current', + timingOnlyPath, + '--baseline', + basePath, + '--accepted', + noAcceptedPath, + '--json-out', + jsonOut, + '--fail-on-regression', + ], + { encoding: 'utf8' } + ); + assert.match(advStdout, /ADVISORY_SLOWDOWN/); + const advVerdict = JSON.parse(fs.readFileSync(jsonOut, 'utf8')); + assert.equal(advVerdict.has_hard_regression, false); + assert.equal(advVerdict.has_advisory_slowdown, true); + assert.equal(advVerdict.needs_perf_investigation, false); + assert.deepEqual( + advVerdict.advisory_metrics.map(m => m.key).sort(), + ['benchmarks.doc_1k_edits_ms', 'ci_wall_ms.total_critical_path'] + ); + + let exitCode = 0; + let regStdout = ''; + try { + execFileSync( + process.execPath, + [ + CLI_PATH, + '--current', + bytesRegPath, + '--baseline', + basePath, + '--accepted', + noAcceptedPath, + '--json-out', + jsonOut, + '--fail-on-regression', + ], + { encoding: 'utf8' } + ); + } catch (err) { + exitCode = err.status; + regStdout = String(err.stdout ?? ''); + } + assert.equal(exitCode, 1); + assert.match(regStdout, /REGRESSION DETECTED/); + const regVerdict = JSON.parse(fs.readFileSync(jsonOut, 'utf8')); + assert.equal(regVerdict.has_hard_regression, true); + assert.equal(regVerdict.regressed_metrics[0].key, 'artifacts_bytes.web_wasm_gzip'); + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +}); + +test('perf/accepted.json value-ceiling accepts <= ceiling, rejects > ceiling, and reports stale_acceptances without failing CI', () => { + // Validation rejects unknown keys, unknown metrics, duplicate metrics, and non-integer ceilings on integer metrics + assert.throws( + () => + validateAcceptedEntries([ + { + metric: 'artifacts_bytes.web_wasm_gzip', + accepted_value: 125, + reason: 'ok', + commit: '1'.repeat(40), + }, + ]), + /unknown key/ + ); + assert.throws( + () => + validateAcceptedEntries([ + { metric: 'artifacts_bytes.not_a_metric', accepted_value: 125, reason: 'ok' }, + ]), + /not a known metric key/ + ); + assert.throws( + () => + validateAcceptedEntries([ + { metric: 'artifacts_bytes.web_wasm_gzip', accepted_value: 125, reason: 'a' }, + { metric: 'artifacts_bytes.web_wasm_gzip', accepted_value: 130, reason: 'b' }, + ]), + /duplicate metric/ + ); + assert.throws( + () => + validateAcceptedEntries([ + { metric: 'artifacts_bytes.web_wasm_gzip', accepted_value: 125.5, reason: 'float' }, + ]), + /must be an integer/ + ); + + const s = n => String(n).repeat(40); + const runs = [ + { id: 4, head_sha: s(4), status: 'completed', conclusion: 'success', created_at: '2026-11-21T04:00:00Z' }, + { id: 3, head_sha: s(3), status: 'completed', conclusion: 'success', created_at: '2026-11-21T03:00:00Z' }, + { id: 2, head_sha: s(2), status: 'completed', conclusion: 'success', created_at: '2026-11-21T02:00:00Z' }, + { id: 1, head_sha: s(1), status: 'completed', conclusion: 'success', created_at: '2026-11-21T01:00:00Z' }, + ]; + const sel = selectBaselineRun(runs, { currentCommit: s(4) }); + assert.equal(sel.baseline?.head_sha, s(1)); + + const baseline100 = makeMetrics(s(1), { + artifacts_bytes: { + web_wasm_raw: 2_000_000, + web_wasm_gzip: 100, + headless_bin: 15_000_000, + }, + }); + const accepted = [ + { + metric: 'artifacts_bytes.web_wasm_gzip', + accepted_value: 125, + reason: 'Added rich-text shaping tables', + }, + ]; + + // current = 125 (within ceiling 125) -> ACCEPTED, no hard regression, no stale acceptances + const cur125 = makeMetrics(s(4), { + artifacts_bytes: { + web_wasm_raw: 2_000_000, + web_wasm_gzip: 125, + headless_bin: 15_000_000, + }, + }); + const vAccepted = comparePerfMetrics({ + current: cur125, + baseline: baseline100, + accepted, + }); + assert.equal(vAccepted.has_hard_regression, false); + assert.equal(vAccepted.stale_acceptances.length, 0); + const accRow = vAccepted.metrics.find(m => m.key === 'artifacts_bytes.web_wasm_gzip'); + assert.equal(accRow?.status, 'ACCEPTED'); + assert.equal(accRow?.baseline, 100); + assert.equal(accRow?.current, 125); + assert.match(renderMarkdownSummary(vAccepted), /accepted ceiling 125 B/); + + // current = 138 (above ceiling 125) -> REGRESSED + const cur138 = makeMetrics(s(4), { + artifacts_bytes: { + web_wasm_raw: 2_000_000, + web_wasm_gzip: 138, + headless_bin: 15_000_000, + }, + }); + const vReg = comparePerfMetrics({ + current: cur138, + baseline: baseline100, + accepted, + }); + assert.equal(vReg.has_hard_regression, true); + assert.equal( + vReg.metrics.find(m => m.key === 'artifacts_bytes.web_wasm_gzip')?.status, + 'REGRESSED' + ); + + // Baseline catches up to 125, current = 125 -> PASS + stale_acceptances reported, CLI exits 0 + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'np-perf-stale-')); + try { + const basePath = path.join(dir, 'base125.json'); + const curPath = path.join(dir, 'cur125.json'); + const accPath = path.join(dir, 'accepted.json'); + const jsonOut = path.join(dir, 'verdict.json'); + + fs.writeFileSync( + basePath, + JSON.stringify( + makeMetrics(s(1), { + artifacts_bytes: { + web_wasm_raw: 2_000_000, + web_wasm_gzip: 125, + headless_bin: 15_000_000, + }, + }) + ) + ); + fs.writeFileSync(curPath, JSON.stringify(cur125)); + fs.writeFileSync(accPath, JSON.stringify(accepted)); + + const stdout = execFileSync( + process.execPath, + [ + CLI_PATH, + '--current', + curPath, + '--baseline', + basePath, + '--accepted', + accPath, + '--json-out', + jsonOut, + '--fail-on-regression', + ], + { encoding: 'utf8' } + ); + assert.match(stdout, /### Stale Acceptances/); + const verdict = JSON.parse(fs.readFileSync(jsonOut, 'utf8')); + assert.equal(verdict.has_hard_regression, false); + assert.equal(verdict.stale_acceptances.length, 1); + assert.equal(verdict.stale_acceptances[0].key, 'artifacts_bytes.web_wasm_gzip'); + assert.equal( + verdict.metrics.find(m => m.key === 'artifacts_bytes.web_wasm_gzip')?.status, + 'PASS' + ); + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +}); + +test('CLI --fetch-github --run-id uses immutable created_at cutoff and paginates across pages to locate N-3', () => { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'np-perf-gh-')); + try { + const binDir = path.join(dir, 'bin'); + fs.mkdirSync(binDir, { recursive: true }); + const logPath = path.join(dir, 'gh-calls.log'); + const zip1Path = path.join(dir, 'run-1.zip'); + const zip2Path = path.join(dir, 'run-2.zip'); + const zip3Path = path.join(dir, 'run-3.zip'); + const curPath = path.join(dir, 'current.json'); + const jsonOut = path.join(dir, 'verdict.json'); + + const s = n => String(n).repeat(40); + fs.writeFileSync(curPath, JSON.stringify(makeMetrics(s(4)))); + fs.writeFileSync( + zip1Path, + buildStoredZip([['perf-metrics.json', JSON.stringify(makeMetrics(s(1)))]]) + ); + fs.writeFileSync( + zip2Path, + buildStoredZip([['perf-metrics.json', JSON.stringify(makeMetrics(s(2)))]]) + ); + fs.writeFileSync( + zip3Path, + buildStoredZip([['perf-metrics.json', JSON.stringify(makeMetrics(s(3)))]]) + ); + + // Fake `gh` script that logs every `gh api ` call and serves paginated runs + const fakeGhPath = path.join(binDir, 'gh'); + const fakeGhSource = `#!/usr/bin/env node +const fs = require('node:fs'); +const endpoint = process.argv[3] || ''; +fs.appendFileSync(${JSON.stringify(logPath)}, endpoint + '\\n'); + +const s = n => String(n).repeat(40); + +if (endpoint === 'repos/toeverything/AFFiNE/actions/runs/400') { + process.stdout.write(JSON.stringify({ + id: 400, + head_sha: s(4), + created_at: '2026-11-21T04:00:00Z', + })); + process.exit(0); +} + +if (endpoint.startsWith('repos/toeverything/AFFiNE/actions/workflows/native-playground.yml/runs?')) { + if (endpoint.includes('page=1')) { + // 30 runs containing reruns of sha(4), sha(3), sha(2) -> only 2 distinct prior SHAs, forcing page=2! + const page1 = []; + for (let i = 0; i < 10; i += 1) { + page1.push({ id: 400 - i, head_sha: s(4), status: 'completed', conclusion: 'success', created_at: '2026-11-21T04:00:00Z' }); + } + for (let i = 0; i < 10; i += 1) { + page1.push({ id: 300 - i, head_sha: s(3), status: 'completed', conclusion: 'success', created_at: '2026-11-21T03:00:00Z' }); + } + for (let i = 0; i < 10; i += 1) { + page1.push({ id: 200 - i, head_sha: s(2), status: 'completed', conclusion: 'success', created_at: '2026-11-21T02:00:00Z' }); + } + process.stdout.write(JSON.stringify({ workflow_runs: page1 })); + process.exit(0); + } + if (endpoint.includes('page=2')) { + process.stdout.write(JSON.stringify({ + workflow_runs: [ + { id: 1, head_sha: s(1), status: 'completed', conclusion: 'success', created_at: '2026-11-21T01:00:00Z' }, + ], + })); + process.exit(0); + } +} + +if (endpoint === 'repos/toeverything/AFFiNE/actions/runs/1/artifacts?per_page=100') { + process.stdout.write(JSON.stringify({ artifacts: [{ id: 1001, name: 'perf-metrics', expired: false }] })); + process.exit(0); +} +if (endpoint === 'repos/toeverything/AFFiNE/actions/runs/200/artifacts?per_page=100') { + process.stdout.write(JSON.stringify({ artifacts: [{ id: 1002, name: 'perf-metrics', expired: false }] })); + process.exit(0); +} +if (endpoint === 'repos/toeverything/AFFiNE/actions/runs/300/artifacts?per_page=100') { + process.stdout.write(JSON.stringify({ artifacts: [{ id: 1003, name: 'perf-metrics', expired: false }] })); + process.exit(0); +} + +if (endpoint === 'repos/toeverything/AFFiNE/actions/artifacts/1001/zip') { + process.stdout.write(fs.readFileSync(${JSON.stringify(zip1Path)})); + process.exit(0); +} +if (endpoint === 'repos/toeverything/AFFiNE/actions/artifacts/1002/zip') { + process.stdout.write(fs.readFileSync(${JSON.stringify(zip2Path)})); + process.exit(0); +} +if (endpoint === 'repos/toeverything/AFFiNE/actions/artifacts/1003/zip') { + process.stdout.write(fs.readFileSync(${JSON.stringify(zip3Path)})); + process.exit(0); +} + +console.error('Unexpected gh api endpoint:', endpoint); +process.exit(1); +`; + fs.writeFileSync(fakeGhPath, fakeGhSource, { mode: 0o755 }); + + const stdout = execFileSync( + process.execPath, + [ + CLI_PATH, + '--fetch-github', + '--repo', + 'toeverything/AFFiNE', + '--branch', + 'darksky/native-playground', + '--workflow', + 'native-playground.yml', + '--run-id', + '400', + '--current', + curPath, + '--json-out', + jsonOut, + '--fail-on-regression', + ], + { + encoding: 'utf8', + env: { ...process.env, PATH: `${binDir}:${process.env.PATH}` }, + } + ); + + assert.match(stdout, /## Native Playground Performance Guardrail \(N-3\)/); + const verdict = JSON.parse(fs.readFileSync(jsonOut, 'utf8')); + assert.equal(verdict.baseline_depth, 'N-3'); + assert.equal(verdict.baseline_commit, s(1)); + assert.equal(verdict.n2_commit, s(2)); + assert.equal(verdict.n1_commit, s(3)); + assert.equal(verdict.has_hard_regression, false); + + const calls = fs.readFileSync(logPath, 'utf8').trim().split('\n'); + assert.ok( + calls.some(c => c === 'repos/toeverything/AFFiNE/actions/runs/400'), + 'must query run 400 for immutable created_at' + ); + assert.ok( + calls.some( + c => + c.includes('created=%3C%3D2026-11-21T04%3A00%3A00Z') && + c.includes('page=1') + ), + 'must filter by created<=anchor on page=1' + ); + assert.ok( + calls.some( + c => + c.includes('created=%3C%3D2026-11-21T04%3A00%3A00Z') && + c.includes('page=2') + ), + 'must paginate to page=2 when page=1 has < 3 distinct prior SHAs' + ); + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +}); + +test('partial-metrics baseline to expanded-metrics current yields BOOTSTRAP on newly introduced keys', () => { + const baseline = { + schema_version: 1, + commit: '1'.repeat(40), + timestamp_utc: '2026-11-21T18:00:00Z', + ci_wall_ms: { headless_linux: 50_000, lint_and_wasm: null }, + artifacts_bytes: { headless_bin: 14_000_000 }, + benchmarks: { + headless_frame_render_ms: { median: 8.0, p95: 9.5 }, + doc_1k_edits_ms: null, + }, + }; + const current = { + schema_version: 1, + commit: '2'.repeat(40), + timestamp_utc: '2026-11-21T19:00:00Z', + ci_wall_ms: { + headless_linux: 52_000, + lint_and_wasm: 35_000, + total_critical_path: 52_000, + }, + artifacts_bytes: { + headless_bin: 14_500_000, + web_wasm_raw: 1_800_000, + web_wasm_gzip: 620_000, + }, + benchmarks: { + headless_frame_render_ms: { median: 8.4, p95: 9.8 }, + doc_1k_edits_ms: { median: 10.2, p95: 12.1 }, + room_sync_1k_ops_ms: { median: 18.5, p95: 22.0 }, + }, + }; + + const verdict = comparePerfMetrics({ current, baseline }); + assert.equal(verdict.has_hard_regression, false); + const byKey = new Map(verdict.metrics.map(m => [m.key, m])); + assert.equal(byKey.get('benchmarks.headless_frame_render_ms')?.status, 'PASS'); + assert.equal(byKey.get('benchmarks.doc_1k_edits_ms')?.status, 'BOOTSTRAP'); + assert.equal(byKey.get('artifacts_bytes.web_wasm_raw')?.status, 'BOOTSTRAP'); +}); + +test('edgeless_1k_pan_zoom_blocks_relayout: 0->0 passes and 0->1 flags deterministic hard regression', () => { + const mkPayload = (commitChar, relayouts) => ({ + schema_version: 1, + commit: commitChar.repeat(40), + timestamp_utc: '2026-11-22T06:00:00Z', + ci_wall_ms: { + headless_linux: 50_000, + lint_and_wasm: 35_000, + total_critical_path: 50_000, + }, + artifacts_bytes: { + headless_bin: 14_500_000, + web_wasm_raw: 1_800_000, + web_wasm_gzip: 620_000, + }, + benchmarks: { + doc_1k_edits_ms: { median: 10.0, p95: 12.0 }, + room_sync_1k_ops_ms: { median: 18.0, p95: 21.0 }, + layout_10k_blocks_cold_ms: { median: 120.0, p95: 135.0 }, + layout_single_keystroke_ms: { median: 0.5, p95: 0.7 }, + layout_single_keystroke_blocks_relayout: 1, + edgeless_1k_pan_zoom_frame_ms: { median: 2.5, p95: 3.1 }, + edgeless_1k_pan_zoom_blocks_relayout: relayouts, + headless_frame_render_ms: { median: 8.0, p95: 9.5 }, + }, + }); + + const baseline = mkPayload('a', 0); + const currentPass = mkPayload('b', 0); + const passVerdict = comparePerfMetrics({ current: currentPass, baseline }); + assert.equal(passVerdict.has_hard_regression, false); + const passMetric = passVerdict.metrics.find( + m => m.key === 'benchmarks.edgeless_1k_pan_zoom_blocks_relayout' + ); + assert.equal(passMetric?.status, 'PASS'); + assert.equal(passMetric?.regressed, false); + + const currentRegressed = mkPayload('c', 1); + const failVerdict = comparePerfMetrics({ current: currentRegressed, baseline }); + assert.equal(failVerdict.has_hard_regression, true); + const failMetric = failVerdict.metrics.find( + m => m.key === 'benchmarks.edgeless_1k_pan_zoom_blocks_relayout' + ); + assert.equal(failMetric?.status, 'REGRESSED'); + assert.equal(failMetric?.regressed, true); + + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'compare-n3-edgeless-')); + try { + const basePath = path.join(dir, 'baseline.json'); + const passPath = path.join(dir, 'pass.json'); + const failPath = path.join(dir, 'fail.json'); + fs.writeFileSync(basePath, JSON.stringify(baseline)); + fs.writeFileSync(passPath, JSON.stringify(currentPass)); + fs.writeFileSync(failPath, JSON.stringify(currentRegressed)); + + execFileSync( + process.execPath, + [CLI_PATH, '--current', passPath, '--baseline', basePath, '--fail-on-regression'], + { encoding: 'utf8' } + ); + + let failedExit = 0; + try { + execFileSync( + process.execPath, + [CLI_PATH, '--current', failPath, '--baseline', basePath, '--fail-on-regression'], + { encoding: 'utf8' } + ); + } catch (err) { + failedExit = err.status ?? 0; + } + assert.equal(failedExit, 1); + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +}); + +test('missing baseline metric in current flags DROPPED hard regression and --require-baseline rejects missing history', () => { + const baseline = makeMetrics('a'.repeat(40)); + const droppedCurrent = makeMetrics('b'.repeat(40)); + delete droppedCurrent.artifacts_bytes.headless_bin; + + const droppedVerdict = comparePerfMetrics({ + current: droppedCurrent, + baseline, + }); + assert.equal(droppedVerdict.has_hard_regression, true); + assert.equal(droppedVerdict.regressed_metrics.length, 1); + assert.equal( + droppedVerdict.regressed_metrics[0].key, + 'artifacts_bytes.headless_bin' + ); + const droppedRow = droppedVerdict.metrics.find( + m => m.key === 'artifacts_bytes.headless_bin' + ); + assert.equal(droppedRow?.status, 'DROPPED'); + assert.equal(droppedRow?.regressed, true); + assert.equal(droppedRow?.current, null); + assert.equal(droppedRow?.baseline, 15_000_000); + assert.match(renderMarkdownSummary(droppedVerdict), /DROPPED/); + + const missingHistoryVerdict = comparePerfMetrics({ + current: makeMetrics('c'.repeat(40)), + baseline: null, + requireBaseline: true, + }); + assert.equal(missingHistoryVerdict.baseline_depth, 'bootstrap'); + assert.equal(missingHistoryVerdict.has_hard_regression, true); + assert.match( + renderMarkdownSummary(missingHistoryVerdict), + /Missing or Incomplete Required Baseline/ + ); + + // Strict --require-n3 rejects N-2 / N-1 fallback and unacknowledged BOOTSTRAP, + // while perf/accepted.json action="bootstrap" and action="drop" allow intentional + // metric additions and removals cleanly until N-3 catches up. + const n2FallbackVerdict = comparePerfMetrics({ + current: makeMetrics('d'.repeat(40)), + baseline: makeMetrics('1'.repeat(40)), + baselineDepth: 'N-2', + requireN3: true, + }); + assert.equal(n2FallbackVerdict.baseline_depth, 'N-2'); + assert.equal(n2FallbackVerdict.has_hard_regression, true); + + const missingInN3Baseline = makeMetrics('1'.repeat(40)); + delete missingInN3Baseline.artifacts_bytes.headless_bin; + const unackBootstrapVerdict = comparePerfMetrics({ + current: makeMetrics('d'.repeat(40)), + baseline: missingInN3Baseline, + baselineDepth: 'N-3', + requireN3: true, + }); + assert.equal(unackBootstrapVerdict.has_hard_regression, true); + assert.equal( + unackBootstrapVerdict.metrics.find( + m => m.key === 'artifacts_bytes.headless_bin' + )?.status, + 'BOOTSTRAP' + ); + + const ackBootstrapVerdict = comparePerfMetrics({ + current: makeMetrics('d'.repeat(40)), + baseline: missingInN3Baseline, + baselineDepth: 'N-3', + requireN3: true, + accepted: [ + { + metric: 'artifacts_bytes.headless_bin', + action: 'bootstrap', + reason: 'Newly introduced binary size metric', + }, + ], + }); + assert.equal(ackBootstrapVerdict.has_hard_regression, false); + assert.equal( + ackBootstrapVerdict.metrics.find( + m => m.key === 'artifacts_bytes.headless_bin' + )?.status, + 'ACCEPTED_BOOTSTRAP' + ); + + const ackDropVerdict = comparePerfMetrics({ + current: droppedCurrent, + baseline, + baselineDepth: 'N-3', + requireN3: true, + accepted: [ + { + metric: 'artifacts_bytes.headless_bin', + action: 'drop', + reason: 'Retired legacy binary target', + }, + ], + }); + assert.equal(ackDropVerdict.has_hard_regression, false); + assert.equal( + ackDropVerdict.metrics.find( + m => m.key === 'artifacts_bytes.headless_bin' + )?.status, + 'ACCEPTED_DROP' + ); + + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'compare-n3-dropped-')); + try { + const basePath = path.join(dir, 'baseline.json'); + const droppedPath = path.join(dir, 'dropped.json'); + const fullPath = path.join(dir, 'full.json'); + const noAcceptedPath = path.join(dir, 'accepted.json'); + fs.writeFileSync(basePath, JSON.stringify(baseline)); + fs.writeFileSync(droppedPath, JSON.stringify(droppedCurrent)); + fs.writeFileSync(fullPath, JSON.stringify(makeMetrics('c'.repeat(40)))); + fs.writeFileSync(noAcceptedPath, '[]'); + + let droppedExit = 0; + try { + execFileSync( + process.execPath, + [ + CLI_PATH, + '--current', + droppedPath, + '--baseline', + basePath, + '--accepted', + noAcceptedPath, + '--fail-on-regression', + ], + { encoding: 'utf8' } + ); + } catch (err) { + droppedExit = err.status ?? 0; + } + assert.equal(droppedExit, 1); + + let noHistoryExit = 0; + try { + execFileSync( + process.execPath, + [ + CLI_PATH, + '--current', + fullPath, + '--accepted', + noAcceptedPath, + '--require-baseline', + '--fail-on-regression', + ], + { encoding: 'utf8' } + ); + } catch (err) { + noHistoryExit = err.status ?? 0; + } + assert.equal(noHistoryExit, 1); + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +}); diff --git a/packages/frontend/perf/schema.json b/packages/frontend/perf/schema.json new file mode 100644 index 0000000000..92a32ea1de --- /dev/null +++ b/packages/frontend/perf/schema.json @@ -0,0 +1,140 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://toeverything.info/schemas/native-playground/perf-metrics.schema.json", + "title": "Native Playground CI Performance Metrics", + "description": "Deterministic benchmark timings, work counters, artifact sizes, and CI wall-clock measurements emitted per commit on darksky/native-playground. Individual sub-keys are optional (or null) when a job or benchmark is not yet active so unmeasured metrics are never padded with synthetic zeros.", + "type": "object", + "additionalProperties": false, + "required": [ + "schema_version", + "commit", + "timestamp_utc", + "ci_wall_ms", + "artifacts_bytes", + "benchmarks" + ], + "properties": { + "schema_version": { + "type": "integer", + "const": 1 + }, + "commit": { + "type": "string", + "pattern": "^[0-9a-f]{40}$", + "description": "Full 40-character lowercase Git commit SHA." + }, + "timestamp_utc": { + "type": "string", + "format": "date-time", + "description": "UTC ISO-8601 timestamp when measurements were recorded." + }, + "ci_wall_ms": { + "type": "object", + "additionalProperties": false, + "properties": { + "lint_and_wasm": { + "type": ["number", "null"], + "minimum": 0 + }, + "headless_linux": { + "type": ["number", "null"], + "minimum": 0 + }, + "total_critical_path": { + "type": ["number", "null"], + "minimum": 0 + } + } + }, + "artifacts_bytes": { + "type": "object", + "additionalProperties": false, + "properties": { + "web_wasm_raw": { + "type": ["integer", "null"], + "minimum": 0 + }, + "web_wasm_gzip": { + "type": ["integer", "null"], + "minimum": 0 + }, + "headless_bin": { + "type": ["integer", "null"], + "minimum": 0 + } + } + }, + "benchmarks": { + "type": "object", + "additionalProperties": false, + "properties": { + "doc_1k_edits_ms": { + "oneOf": [ + { "$ref": "#/$defs/timingSummary" }, + { "type": "null" } + ] + }, + "room_sync_1k_ops_ms": { + "oneOf": [ + { "$ref": "#/$defs/timingSummary" }, + { "type": "null" } + ] + }, + "layout_10k_blocks_cold_ms": { + "oneOf": [ + { "$ref": "#/$defs/timingSummary" }, + { "type": "null" } + ] + }, + "layout_single_keystroke_ms": { + "oneOf": [ + { "$ref": "#/$defs/timingSummary" }, + { "type": "null" } + ] + }, + "layout_single_keystroke_blocks_relayout": { + "type": ["integer", "null"], + "minimum": 0, + "description": "Number of blocks re-laid out during a single keystroke." + }, + "edgeless_1k_pan_zoom_frame_ms": { + "oneOf": [ + { "$ref": "#/$defs/timingSummary" }, + { "type": "null" } + ] + }, + "edgeless_1k_pan_zoom_blocks_relayout": { + "type": ["integer", "null"], + "minimum": 0, + "description": "Number of blocks re-laid out during a 30-step Edgeless pan and zoom sweep." + }, + "headless_frame_render_ms": { + "oneOf": [ + { "$ref": "#/$defs/timingSummary" }, + { "type": "null" } + ] + } + } + } + }, + "$defs": { + "timingSummary": { + "type": "object", + "additionalProperties": false, + "required": [ + "median", + "p95" + ], + "properties": { + "median": { + "type": "number", + "minimum": 0 + }, + "p95": { + "type": "number", + "minimum": 0 + } + } + } + } +} diff --git a/packages/frontend/rust-toolchain.toml b/packages/frontend/rust-toolchain.toml new file mode 100644 index 0000000000..bfd155b5c2 --- /dev/null +++ b/packages/frontend/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.98.1" +components = ["rustfmt", "clippy"] +targets = ["wasm32-unknown-unknown"] diff --git a/packages/frontend/rustfmt.toml b/packages/frontend/rustfmt.toml new file mode 100644 index 0000000000..f216078d96 --- /dev/null +++ b/packages/frontend/rustfmt.toml @@ -0,0 +1 @@ +edition = "2024" diff --git a/packages/frontend/scripts/check-invariants.sh b/packages/frontend/scripts/check-invariants.sh new file mode 100755 index 0000000000..f21c52f545 --- /dev/null +++ b/packages/frontend/scripts/check-invariants.sh @@ -0,0 +1,776 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +REPO_ROOT="$(cd "$ROOT/../.." && pwd)" +cd "$ROOT" + +fail() { + echo "ERROR: $*" >&2 + exit 1 +} + +echo "==> Enumerating client Cargo workspace members via cargo metadata" +WORKSPACE_JSON=$(CARGO_ENCODED_RUSTFLAGS="" cargo metadata --manifest-path "$ROOT/Cargo.toml" --locked --no-deps --format-version 1) + +MEMBER_LINES=$( + WORKSPACE_JSON="$WORKSPACE_JSON" REPO_ROOT="$REPO_ROOT" python3 - <<'PY' +import json +import os +from pathlib import Path + +meta = json.loads(os.environ["WORKSPACE_JSON"]) +repo_root = Path(os.environ["REPO_ROOT"]).resolve() +ws_ids = set(meta["workspace_members"]) +members = {} +for pkg in meta["packages"]: + if pkg["id"] in ws_ids: + manifest = Path(pkg["manifest_path"]).resolve() + members[pkg["name"]] = manifest.parent + +if len(members) < 3: + raise SystemExit(f"Expected at least 3 client workspace members, found {len(members)}: {members}") + +expected_core = { + "ui": (repo_root / "packages/ui/ui").resolve(), + "blocksuite-playground-doc": (repo_root / "blocksuite/crates/doc").resolve(), + "playground": (repo_root / "blocksuite/crates/playground").resolve(), +} +for name, expected_dir in expected_core.items(): + actual_dir = members.get(name) + if actual_dir != expected_dir: + raise SystemExit( + f"Expected core client member {name} at {expected_dir}, found {actual_dir}" + ) + +for name in sorted(members): + print(f"{name}\t{members[name]}") +PY +) + +echo "Client workspace members:" +echo "$MEMBER_LINES" + +echo "==> Checking test targets that require the harness feature" +WORKSPACE_JSON="$WORKSPACE_JSON" REPO_ROOT="$REPO_ROOT" python3 - <<'PY' +import json +import os +import re +from pathlib import Path + +meta = json.loads(os.environ["WORKSPACE_JSON"]) +repo_root = Path(os.environ["REPO_ROOT"]).resolve() +members = set(meta["workspace_members"]) +target_kinds = {"bin", "test", "example", "bench"} +cfg_attribute = re.compile(r"#\s*!?\s*\[\s*cfg\s*\((.*?)\)\s*\]", re.DOTALL) +harness_feature = re.compile(r'\bfeature\s*=\s*"harness"') +test_alternative = re.compile(r"\bany\s*\(\s*test\s*,") + +targets = set() +integration_tests = set() +for pkg in meta["packages"]: + if pkg["id"] not in members: + continue + for target in pkg["targets"]: + if "harness" in target.get("required-features", []): + for kind in target_kinds.intersection(target["kind"]): + targets.add((pkg["name"], kind, target["name"])) + test_dir = Path(pkg["manifest_path"]).parent / "tests" + for path in test_dir.rglob("*.rs"): + if any( + harness_feature.search(cfg) and not test_alternative.search(cfg) + for cfg in cfg_attribute.findall(path.read_text(encoding="utf-8")) + ): + integration_tests.add(path.relative_to(repo_root).as_posix()) + +expected_targets = { + ("playground", "bin", "bs-harness"), + ("affine-desktop", "bin", "desktop-harness"), + ("affine-mobile", "bin", "mobile-harness"), +} +expected_integration_tests = { + "packages/ui/ui/tests/bidi_multiline_controls.rs", + "packages/ui/ui/tests/metal_atlas_fence.rs", + "packages/ui/ui/tests/touch_dispatch.rs", +} +if targets != expected_targets or integration_tests != expected_integration_tests: + for label, actual, expected in ( + ("Cargo targets", targets, expected_targets), + ("integration test files", integration_tests, expected_integration_tests), + ): + for entry in sorted(actual - expected): + print(f"ERROR: Added harness {label}: {entry}") + for entry in sorted(expected - actual): + print(f"ERROR: Removed harness {label}: {entry}") + raise SystemExit("Update the harness test commands in .github/workflows/native-playground.yml and these lists.") +PY + +echo "==> Checking four-domain toolchain, rustfmt, and AGENTS.md alignment and legacy guards" +CLIENT_TREES=( + "$REPO_ROOT/packages/frontend" + "$REPO_ROOT/packages/ui" + "$REPO_ROOT/blocksuite/crates" + "$REPO_ROOT/packages/common/store" +) + +for tree in "${CLIENT_TREES[@]}"; do + [ -d "$tree" ] || fail "Missing client domain directory $tree" + [ -f "$tree/rust-toolchain.toml" ] || fail "Missing $tree/rust-toolchain.toml" + [ -f "$tree/rustfmt.toml" ] || fail "Missing $tree/rustfmt.toml" + [ -f "$tree/AGENTS.md" ] || fail "Missing $tree/AGENTS.md" + [ -f "$tree/CLAUDE.md" ] || fail "Missing $tree/CLAUDE.md" + cmp -s "$ROOT/rust-toolchain.toml" "$tree/rust-toolchain.toml" \ + || fail "$tree/rust-toolchain.toml differs from packages/frontend/rust-toolchain.toml" + cmp -s "$ROOT/rustfmt.toml" "$tree/rustfmt.toml" \ + || fail "$tree/rustfmt.toml differs from packages/frontend/rustfmt.toml" +done + +for legacy_dir in \ + "$REPO_ROOT/packages/frontend/native" \ + "$REPO_ROOT/packages/frontend/mobile-native" \ + "$REPO_ROOT/packages/frontend/apps"; do + [ -f "$legacy_dir/rust-toolchain.toml" ] || fail "Missing legacy guard $legacy_dir/rust-toolchain.toml" + cmp -s "$REPO_ROOT/rust-toolchain.toml" "$legacy_dir/rust-toolchain.toml" \ + || fail "$legacy_dir/rust-toolchain.toml must match root rust-toolchain.toml" +done + +for legacy_fmt_dir in \ + "$REPO_ROOT/packages/frontend/native" \ + "$REPO_ROOT/packages/frontend/mobile-native"; do + [ -f "$legacy_fmt_dir/rustfmt.toml" ] || fail "Missing legacy guard $legacy_fmt_dir/rustfmt.toml" + cmp -s "$REPO_ROOT/rustfmt.toml" "$legacy_fmt_dir/rustfmt.toml" \ + || fail "$legacy_fmt_dir/rustfmt.toml must match root rustfmt.toml" +done + +echo "==> Checking Cargo workspace_root resolution for client and legacy crates" +EXPECTED_CLIENT_ROOT="$(cd "$ROOT" && pwd -P)" +EXPECTED_REPO_ROOT="$(cd "$REPO_ROOT" && pwd -P)" + +while IFS=$'\t' read -r pkg_name member_dir; do + resolved_root=$( + cd "$member_dir" && CARGO_ENCODED_RUSTFLAGS="" cargo metadata --locked --no-deps --format-version 1 \ + | python3 -c "import json, os, sys; print(os.path.realpath(json.load(sys.stdin)['workspace_root']))" + ) + if [ "$resolved_root" != "$EXPECTED_CLIENT_ROOT" ]; then + fail "Client crate $pkg_name ($member_dir) resolved workspace_root=$resolved_root, expected $EXPECTED_CLIENT_ROOT" + fi +done <<< "$MEMBER_LINES" + +for legacy_crate in \ + "$REPO_ROOT" \ + "$REPO_ROOT/packages/frontend/native" \ + "$REPO_ROOT/packages/frontend/mobile-native" \ + "$REPO_ROOT/packages/frontend/native/nbstore" \ + "$REPO_ROOT/packages/frontend/native/schema" \ + "$REPO_ROOT/packages/frontend/native/sqlite_v1"; do + resolved_root=$( + cd "$legacy_crate" && CARGO_ENCODED_RUSTFLAGS="" cargo metadata --locked --no-deps --format-version 1 \ + | python3 -c "import json, os, sys; print(os.path.realpath(json.load(sys.stdin)['workspace_root']))" + ) + if [ "$resolved_root" != "$EXPECTED_REPO_ROOT" ]; then + fail "Legacy crate ($legacy_crate) resolved workspace_root=$resolved_root, expected $EXPECTED_REPO_ROOT" + fi +done + +echo "==> Checking four-domain acyclic dependency rules (default-deny DAG)" +WORKSPACE_JSON="$WORKSPACE_JSON" REPO_ROOT="$REPO_ROOT" python3 - <<'PY' +import json +import os +from pathlib import Path + +UI_ALL = {"packages/ui/tokens", "packages/ui/ui", "packages/ui/kit"} +BS_LOWER = {"blocksuite/crates/doc", "blocksuite/crates/preview", "blocksuite/crates/editor"} + +ALLOWED_DEPS = { + "packages/ui/tokens": set(), + "packages/ui/ui": {"packages/ui/tokens"}, + "packages/ui/kit": {"packages/ui/tokens", "packages/ui/ui"}, + "blocksuite/crates/doc": set(), + "blocksuite/crates/preview": {"packages/ui/tokens", "packages/ui/ui", "blocksuite/crates/doc"}, + "blocksuite/crates/editor": UI_ALL | {"blocksuite/crates/doc", "blocksuite/crates/preview"}, + "blocksuite/crates/playground": UI_ALL | BS_LOWER, + "blocksuite/crates/oracle": UI_ALL | BS_LOWER, + "packages/common/store": {"blocksuite/crates/doc"}, + "packages/frontend/legacy-import": {"blocksuite/crates/doc", "packages/common/store"}, + "packages/frontend/client": UI_ALL | BS_LOWER | { + "packages/common/store", + "packages/frontend/legacy-import", + }, + "packages/frontend/mobile": UI_ALL | BS_LOWER | { + "blocksuite/crates/playground", + "packages/common/store", + "packages/frontend/legacy-import", + "packages/frontend/client", + }, + "packages/frontend/desktop": UI_ALL | BS_LOWER | { + "blocksuite/crates/playground", + "packages/common/store", + "packages/frontend/legacy-import", + "packages/frontend/client", + }, +} + +HOST_ALLOWED = UI_ALL | BS_LOWER | { + "blocksuite/crates/playground", + "packages/common/store", + "packages/frontend/legacy-import", + "packages/frontend/client", + "packages/frontend/mobile", + "packages/frontend/desktop", +} + + +def is_allowed_edge(src_rel: str, dep_rel: str) -> bool: + if src_rel == dep_rel: + return True + if src_rel.startswith("packages/frontend/hosts/"): + parts = src_rel.split("/") + if len(parts) == 4 and parts[3]: + return dep_rel in HOST_ALLOWED + return False + allowed = ALLOWED_DEPS.get(src_rel) + if allowed is None: + return False + return dep_rel in allowed + + +POSITIVE_FIXTURES = [ + ("packages/ui/kit", "packages/ui/ui"), + ("blocksuite/crates/editor", "blocksuite/crates/preview"), + ("blocksuite/crates/playground", "blocksuite/crates/doc"), + ("packages/common/store", "blocksuite/crates/doc"), + ("packages/frontend/mobile", "packages/frontend/client"), + ("packages/frontend/hosts/ios", "packages/frontend/mobile"), +] +NEGATIVE_FIXTURES = [ + ("packages/ui/ui", "packages/ui/kit"), + ("packages/ui/kit", "blocksuite/crates/doc"), + ("blocksuite/crates/doc", "blocksuite/crates/preview"), + ("blocksuite/crates/preview", "blocksuite/crates/editor"), + ("packages/common/store", "blocksuite/crates/editor"), + ("packages/common/store", "packages/ui/ui"), + ("packages/frontend/client", "packages/frontend/mobile"), + ("packages/frontend/mobile", "packages/frontend/hosts/ios"), + ("packages/frontend/mobile", "packages/frontend/desktop"), + ("packages/frontend/hosts/ios", "packages/frontend/hosts/android"), + ("packages/frontend/unregistered", "packages/ui/ui"), +] + +for s_rel, d_rel in POSITIVE_FIXTURES: + if not is_allowed_edge(s_rel, d_rel): + raise SystemExit(f"DAG self-test failed: expected {s_rel} -> {d_rel} to be allowed") +for s_rel, d_rel in NEGATIVE_FIXTURES: + if is_allowed_edge(s_rel, d_rel): + raise SystemExit(f"DAG self-test failed: expected {s_rel} -> {d_rel} to be rejected") + +meta = json.loads(os.environ["WORKSPACE_JSON"]) +repo_root = Path(os.environ["REPO_ROOT"]).resolve() +ws_ids = set(meta["workspace_members"]) + +pkg_rel = {} +for pkg in meta["packages"]: + if pkg["id"] in ws_ids: + rel_dir = Path(pkg["manifest_path"]).resolve().parent.relative_to(repo_root).as_posix() + pkg_rel[pkg["name"]] = rel_dir + +errors = [] +for pkg in meta["packages"]: + if pkg["id"] not in ws_ids: + continue + src_name = pkg["name"] + src_rel = pkg_rel[src_name] + if src_rel not in ALLOWED_DEPS and not ( + src_rel.startswith("packages/frontend/hosts/") and len(src_rel.split("/")) == 4 + ): + errors.append( + f"{src_name} ({src_rel}) is not registered in check-invariants.sh ALLOWED_DEPS" + ) + continue + for dep in pkg.get("dependencies", []): + dep_name = dep["name"] + if dep_name not in pkg_rel: + continue + dep_rel = pkg_rel[dep_name] + if not is_allowed_edge(src_rel, dep_rel): + errors.append(f"{src_name} ({src_rel}) must not depend on {dep_name} ({dep_rel})") + +if errors: + for e in errors: + print(f"ERROR: {e}") + raise SystemExit(1) +print("Four-domain default-deny dependency DAG check (with self-tests) passed.") +PY + +echo "==> Checking active rustup toolchain for legacy (1.97.1) and client (1.98.1) directories" +command -v rustup >/dev/null 2>&1 || fail "rustup is required to verify active toolchains" +ROOT_CHANNEL=$(awk -F'"' '/^channel[[:space:]]*=/{print $2; exit}' "$REPO_ROOT/rust-toolchain.toml") +CLIENT_CHANNEL=$(awk -F'"' '/^channel[[:space:]]*=/{print $2; exit}' "$ROOT/rust-toolchain.toml") +for legacy_tc_dir in \ + "$REPO_ROOT/packages/frontend/native" \ + "$REPO_ROOT/packages/frontend/mobile-native" \ + "$REPO_ROOT/packages/frontend/apps/ios/App" \ + "$REPO_ROOT/packages/frontend/apps/android/App"; do + active_tc=$(cd "$legacy_tc_dir" && env -u RUSTUP_TOOLCHAIN rustup show active-toolchain) \ + || fail "rustup show active-toolchain failed in $legacy_tc_dir" + if [[ "$active_tc" != *"$ROOT_CHANNEL"* ]]; then + fail "Expected active rustup toolchain in $legacy_tc_dir to match $ROOT_CHANNEL, got: $active_tc" + fi +done +for client_tc_dir in "${CLIENT_TREES[@]}"; do + active_tc=$(cd "$client_tc_dir" && env -u RUSTUP_TOOLCHAIN rustup show active-toolchain) \ + || fail "rustup show active-toolchain failed in $client_tc_dir" + if [[ "$active_tc" != *"$CLIENT_CHANNEL"* ]]; then + fail "Expected active rustup toolchain in $client_tc_dir to match $CLIENT_CHANNEL, got: $active_tc" + fi +done + +echo "==> Checking zero internal proc-macro crates" +if grep -rn 'proc-macro\s*=\s*true' "$ROOT/Cargo.toml" 2>/dev/null; then + fail "Internal proc-macro crates are forbidden in the client workspace" +fi +while IFS=$'\t' read -r pkg_name member_dir; do + if grep -rn 'proc-macro\s*=\s*true' "$member_dir/Cargo.toml" 2>/dev/null; then + fail "Internal proc-macro crates are forbidden ($pkg_name)" + fi +done <<< "$MEMBER_LINES" + +UI_DIR="$REPO_ROOT/packages/ui/ui" +UI_KIT_DIR="$REPO_ROOT/packages/ui/kit" +UI_TOKENS_DIR="$REPO_ROOT/packages/ui/tokens" +DOC_DIR="$REPO_ROOT/blocksuite/crates/doc" +EDITOR_DIR="$REPO_ROOT/blocksuite/crates/editor" +PLAYGROUND_DIR="$REPO_ROOT/blocksuite/crates/playground" + +echo "==> Checking packages/ui/tokens self-contained isolation (no frontend/ or blocksuite)" +if grep -rniE 'frontend/|blocksuite' "$UI_TOKENS_DIR/src" 2>/dev/null; then + fail "packages/ui/tokens/src must stay self-contained without frontend/ or blocksuite references" +fi +LEGACY_FONTS_DIR="$REPO_ROOT/packages/frontend/component/src/fonts" +if [ -d "$LEGACY_FONTS_DIR" ]; then + for rel in \ + "inter/Inter-VariableFont_slnt,wght.ttf" \ + "ibm-plex-mono/IBMPlexMono-Regular.ttf" \ + "ibm-plex-mono/IBMPlexMono-Bold.ttf" \ + "ibm-plex-mono/IBMPlexMono-Italic.ttf" \ + "ibm-plex-mono/IBMPlexMono-BoldItalic.ttf"; do + if [ -f "$LEGACY_FONTS_DIR/$rel" ]; then + cmp -s "$UI_TOKENS_DIR/fonts/$rel" "$LEGACY_FONTS_DIR/$rel" \ + || fail "packages/ui/tokens/fonts/$rel drifted from $LEGACY_FONTS_DIR/$rel" + fi + done +fi + +echo "==> Checking packages/ui/ui domain isolation (no blocksuite/affine words)" +if grep -rniE '\b(blocksuite|affine)\b' "$UI_DIR/src" "$UI_DIR/Cargo.toml" 2>/dev/null; then + fail "packages/ui/ui must not reference BlockSuite or AFFiNE domain terms" +fi + +echo "==> Checking packages/ui/kit domain isolation and logical-geometry guard" +if grep -rniE '\b(blocksuite|affine)\b' "$UI_KIT_DIR/src" "$UI_KIT_DIR/Cargo.toml" 2>/dev/null; then + fail "packages/ui/kit must not reference BlockSuite or AFFiNE domain terms" +fi +if grep -rnE '\.(left|right|pl|pr|ml|mr|border_l|border_r)(_[0-9a-z_]+)?\s*\(' "$UI_KIT_DIR/src" --include='*.rs' 2>/dev/null; then + fail "packages/ui/kit/src must use logical inline geometry instead of physical left/right layout helpers" +fi + +echo "==> Checking blocksuite/crates/doc GUI isolation and forbid(unsafe_code)" +if grep -rnE '^\s*(ui|wgpu|objc2|web-sys)\b' "$DOC_DIR/Cargo.toml" 2>/dev/null; then + fail "blocksuite/crates/doc must not depend on GUI/platform crates (ui, wgpu, objc2, web-sys)" +fi +if ! grep -q '#!\[forbid(unsafe_code)\]' "$DOC_DIR/src/lib.rs"; then + fail "blocksuite/crates/doc/src/lib.rs must declare #![forbid(unsafe_code)]" +fi + +echo "==> Checking blocksuite/crates/preview zero host-font scanning" +if grep -rn 'load_system_fonts' "$REPO_ROOT/blocksuite/crates/preview/src" 2>/dev/null; then + fail "load_system_fonts is forbidden in blocksuite/crates/preview/src" +fi + +echo "==> Checking no wall-clock calls outside packages/ui/ui/src/platform" +WALL_CLOCK_HITS="" +while IFS=$'\t' read -r _pkg_name member_dir; do + if [ -d "$member_dir/src" ]; then + hits=$( + grep -rnE '(Instant::now|SystemTime::now|Zoned::now|Timestamp::now)\s*\(' "$member_dir/src" \ + --include='*.rs' \ + | grep -v "^$UI_DIR/src/platform/" \ + || true + ) + if [ -n "$hits" ]; then + WALL_CLOCK_HITS="${WALL_CLOCK_HITS}${hits}"$'\n' + fi + fi +done <<< "$MEMBER_LINES" +if [ -n "$WALL_CLOCK_HITS" ]; then + echo "$WALL_CLOCK_HITS" >&2 + fail "Instant::now() / SystemTime::now() / Zoned::now() / Timestamp::now() is forbidden outside packages/ui/ui/src/platform/" +fi + +echo "==> Checking zero tester branches inside shipping editor, playground, desktop, and mobile view modules" +DESKTOP_DIR="$REPO_ROOT/packages/frontend/desktop" +MOBILE_DIR="$REPO_ROOT/packages/frontend/mobile" +for view_dir in "$EDITOR_DIR" "$PLAYGROUND_DIR" "$DESKTOP_DIR" "$MOBILE_DIR"; do + if [ ! -d "$view_dir/src" ]; then + continue + fi + if grep -rn 'is_headless' "$view_dir/src" 2>/dev/null; then + fail "is_headless branches are forbidden in $view_dir/src" + fi +done +python3 - "$EDITOR_DIR" "$PLAYGROUND_DIR" "$DESKTOP_DIR" "$MOBILE_DIR" <<'PY' +from __future__ import annotations +import re +import sys +from pathlib import Path + +CFG_START = re.compile(r"#\s*(?P!\s*)?\[\s*cfg\s*\(|\bcfg\s*!\s*\(") +HARNESS = re.compile(r'\bfeature\s*=\s*"harness"') +TEST = re.compile(r"\btest\b") +MOD_ITEM = re.compile(r"\s*(?:pub(?:\s*\([^)]*\))?\s+)?mod\s+(?:r#)?\w+\s*([{;])") +ATTR_START = re.compile(r"\s*#\s*\[") +ATTR_END = re.compile(r"\s*\]") +LEXEME = re.compile( + r'//[^\n]*|/\*|(?\#*)"' + r'|"(?:\\[\s\S]|[^"\\])*"' + r"|'(?:\\(?:x[0-9a-fA-F]{2}|u\{[0-9a-fA-F_]+\}|[^\n])|[^'\\\n])'" +) +BLOCK_COMMENT = re.compile(r"/\*|\*/") +MASK = re.compile(r"[^\n]") + +def rust_code(src: str) -> str: + """Mask comments and literals without changing source offsets.""" + parts = [] + pos = 0 + while token := LEXEME.search(src, pos): + start, end = token.span() + parts.append(src[pos:start]) + text = token.group() + replacement = "" + if text == "/*": + depth = 1 + for delimiter in BLOCK_COMMENT.finditer(src, end): + depth += 1 if delimiter.group() == "/*" else -1 + if depth == 0: + end = delimiter.end() + break + else: + end = len(src) + elif not text.startswith("//"): + # Keep the feature name so cfg checks can still see it. + hashes = token.group("hashes") + if hashes is not None: + close = '"' + hashes + close_at = src.find(close, end) + if close_at != -1 and src[end:close_at] == "harness" and text.startswith("r"): + replacement = '"harness"' + end = len(src) if close_at == -1 else close_at + len(close) + elif text == '"harness"': + replacement = text + if not replacement: + replacement = "_" + parts.append(replacement + MASK.sub(" ", src[start + len(replacement):end])) + pos = end + parts.append(src[pos:]) + return "".join(parts) + +def matching_delimiter(code: str, start: int, opening: str, closing: str) -> int: + depth = 0 + for i in range(start, len(code)): + if code[i] == opening: + depth += 1 + elif code[i] == closing: + depth -= 1 + if depth == 0: + return i + return len(code) + +def module_item(code: str, after_attr: int) -> re.Match | None: + while attr := ATTR_START.match(code, after_attr): + after_attr = matching_delimiter(code, attr.end() - 1, "[", "]") + 1 + return MOD_ITEM.match(code, after_attr) + +def tester_branches(src: str, *, playground_lib: bool): + code = rust_code(src) + pos = 0 + while match := CFG_START.search(code, pos): + pos = match.end() + end = matching_delimiter(code, pos - 1, "(", ")") + pred = " ".join(code[pos:end].split()) + is_macro = match.group().startswith("cfg") + if HARNESS.search(pred): + yield match.start(), end + 1 + continue + if not TEST.search(pred): + continue + attr_end = None if is_macro or match.group("inner") else ATTR_END.match(code, end + 1) + mod = module_item(code, attr_end.end()) if attr_end else None + if not is_macro and pred.removesuffix(",").rstrip() == "test": + if mod and mod.group(1) == "{": + pos = matching_delimiter(code, mod.end() - 1, "{", "}") + 1 + continue + # The same PDF module serves Wasm and native unit tests. Scan its source as usual. + if (playground_lib and mod and attr_end and mod.start() == attr_end.end() + and src[pos:end] == 'any(target_family = "wasm", test)' + and code[mod.start():mod.end()].strip() == "mod wasm_pdf_state;"): + continue + if is_macro or re.match(r"any\s*\(", pred) or (mod and mod.group(1) == ";"): + yield match.start(), end + 1 + +src_dirs = [Path(view_dir) / "src" for view_dir in sys.argv[1:]] +for src_dir in src_dirs: + if not src_dir.is_dir(): + sys.exit(f"ERROR: Missing required view source directory: {src_dir}") + +hits = [] +for src_dir in src_dirs: + for path in sorted(src_dir.rglob("*.rs")): + rel = path.relative_to(src_dir).as_posix() + if rel.startswith("bin/"): + continue + src = path.read_text(encoding="utf-8") + playground_lib = src_dir == src_dirs[1] and rel == "lib.rs" + for start, end in tester_branches(src, playground_lib=playground_lib): + # The harness imports this fixture from the editor. + if (src_dir == src_dirs[0] and rel == "rich_text/mod.rs" + and src.startswith('#[cfg(feature = "harness")]\npub fn sample_paragraph(', start)): + continue + line = src.count("\n", 0, start) + 1 + hits.append(f"{path}:{line}: {' '.join(src[start:end].split())}") + +if hits: + print("\n".join(hits), file=sys.stderr) + print("ERROR: Inline harness/test cfg branches are forbidden in shipping view modules", file=sys.stderr) + sys.exit(1) +PY + +echo "==> Checking TOPBAR_HEIGHT single-source check in blocksuite/crates/playground/src" +PLAYGROUND_DIR="$PLAYGROUND_DIR" python3 - <<'PY' +import os +import re +import sys +from pathlib import Path + +root = Path(os.environ["PLAYGROUND_DIR"]) / "src" + +def strip_cfg_test(text: str) -> list[str]: + lines = text.splitlines() + out = [] + i = 0 + n = len(lines) + while i < n: + s = lines[i].strip() + if s == "#[cfg(test)]" and i + 1 < n and re.match(r"^(pub(\([^)]*\))?\s+)?mod\s+\w+\s*\{", lines[i + 1].strip()): + depth = 0 + started = False + out.append("") + i += 1 + while i < n: + line = lines[i] + if "{" in line: + started = True + depth += line.count("{") - line.count("}") + out.append("") + i += 1 + if started and depth <= 0: + break + continue + out.append(lines[i]) + i += 1 + return out + +errors = [] +for p in sorted(root.rglob("*.rs")): + rel = p.relative_to(root).as_posix() + if rel.startswith("bin/") or "test" in p.name: + continue + for lineno, line in enumerate(strip_cfg_test(p.read_text(encoding="utf-8")), 1): + code = line.split("//", 1)[0] + if "TOPBAR_HEIGHT" not in code: + continue + if rel == "lib.rs" and "pub use blocksuite_editor::" in code or (rel == "lib.rs" and lineno <= 12): + continue + if rel == "embedded.rs": + continue + errors.append(f"{rel}:{lineno}: direct TOPBAR_HEIGHT reference outside embedded.rs::topbar_height(): {line.strip()}") + +if errors: + for e in errors: + print(f"ERROR: {e}", file=sys.stderr) + sys.exit(1) +print("Playground TOPBAR_HEIGHT single-source check passed.") +PY + +echo "==> Checking Rust module structure, visibility, orphaned files, and per-file LOC" +MEMBER_LINES="$MEMBER_LINES" python3 - <<'PY' +import os +import re +import sys +from pathlib import Path + +errors = [] +roots = [] +for line in os.environ["MEMBER_LINES"].splitlines(): + if not line.strip(): + continue + name, dir_path = line.split("\t", 1) + if name == "ui": + continue + src_dir = Path(dir_path) / "src" + if src_dir.is_dir(): + roots.append(src_dir) + +if len(roots) < 2: + print(f"ERROR: Expected at least 2 non-vendored client crate src roots, found {roots}", file=sys.stderr) + sys.exit(1) + +def strip_cfg_test_mods(src: str) -> str: + """Remove `#[cfg(test)] mod { ... }` blocks while preserving line numbers.""" + lines = src.splitlines() + out = [] + i = 0 + n = len(lines) + while i < n: + s = lines[i].strip() + if s == "#[cfg(test)]" and i + 1 < n and re.match(r"^(pub(\([^)]*\))?\s+)?mod\s+\w+\s*\{", lines[i + 1].strip()): + depth = 0 + started = False + out.append("") + i += 1 + while i < n: + line = lines[i] + if "{" in line: + started = True + depth += line.count("{") - line.count("}") + out.append("") + i += 1 + if started and depth <= 0: + break + continue + out.append(lines[i]) + i += 1 + return "\n".join(out) + +for src_root in roots: + rs_files = sorted(src_root.rglob("*.rs")) + declared_modules = set() + for entry in ("lib.rs", "main.rs"): + if (src_root / entry).exists(): + declared_modules.add((src_root / entry).resolve()) + for bin_file in (src_root / "bin").glob("*.rs") if (src_root / "bin").exists() else []: + declared_modules.add(bin_file.resolve()) + for bin_main in (src_root / "bin").glob("*/main.rs") if (src_root / "bin").exists() else []: + declared_modules.add(bin_main.resolve()) + + mod_decl_re = re.compile(r"^\s*(?:pub(?:\([^)]*\))?\s+)?mod\s+([A-Za-z_][A-Za-z0-9_]*)\s*;") + for p in rs_files: + text = p.read_text(encoding="utf-8") + parent = p.parent + for line in text.splitlines(): + m = mod_decl_re.match(line) + if m: + mod_name = m.group(1) + base_dir = parent if p.name in ("lib.rs", "main.rs", "mod.rs") else parent / p.stem + cand_file = base_dir / f"{mod_name}.rs" + cand_mod = base_dir / mod_name / "mod.rs" + if cand_file.exists(): + declared_modules.add(cand_file.resolve()) + if cand_mod.exists(): + declared_modules.add(cand_mod.resolve()) + + if p.name not in ("lib.rs", "main.rs", "mod.rs") and (parent / p.stem).is_dir(): + errors.append(f"{p}: coexists beside directory {parent / p.stem}/; move into {parent / p.stem}/mod.rs") + + non_test = strip_cfg_test_mods(text) + non_test_lines = non_test.splitlines() + + for lineno, line in enumerate(non_test_lines, 1): + if "super::super::" in line: + errors.append(f"{p}:{lineno}: forbidden `super::super::` outside `mod tests`") + + rel = p.relative_to(src_root) + if len(rel.parts) >= 2 and p.name != "mod.rs" and rel.parts[0] != "bin": + parent_mod = rel.parts[0] + pat = f"crate::{parent_mod}::" + for lineno, line in enumerate(non_test_lines, 1): + if pat in line: + errors.append(f"{p}:{lineno}: use `super::` instead of `{pat}` inside submodule") + + actual_non_test = len([1 for orig, stripped in zip(text.splitlines(), non_test_lines) if orig == stripped]) + if actual_non_test > 800: + errors.append(f"{p}: {actual_non_test} non-test lines exceeds ceiling of 800") + + for p in rs_files: + if p.resolve() not in declared_modules: + errors.append(f"{p}: orphaned .rs file not declared by any `mod ;`") + +if errors: + for e in errors: + print(f"ERROR: {e}", file=sys.stderr) + sys.exit(1) +print("Rust module structure & LOC checks passed.") +PY + +echo "==> Checking packages/ui/ui SLOC ceiling" +UI_SLOC_CEILING=74268 +read -r UI_RAW_LOC UI_SLOC < <(UI_DIR="$UI_DIR" python3 - <<'PY' +import os +from pathlib import Path +raw = sloc = 0 +for p in Path(os.environ["UI_DIR"], "src").rglob("*.rs"): + for line in p.read_text(encoding="utf-8", errors="replace").splitlines(): + raw += 1 + s = line.strip() + if s and not s.startswith("//"): + sloc += 1 +print(f"{raw} {sloc}") +PY +) +echo "packages/ui/ui/src raw lines: $UI_RAW_LOC, code lines (non-blank, non-comment): $UI_SLOC (ceiling: $UI_SLOC_CEILING)" +if [ "$UI_SLOC" -gt "$UI_SLOC_CEILING" ]; then + fail "packages/ui/ui/src SLOC ($UI_SLOC) exceeds ceiling ($UI_SLOC_CEILING)" +fi + +echo "==> Checking the playground Wasm font dependencies" +SKRIFA_VERSIONS=$(cargo tree --locked --target wasm32-unknown-unknown -p playground -e normal --prefix none \ + | awk '$1 == "skrifa" { print $2 }' | sort -u) +[[ -n "$SKRIFA_VERSIONS" && "$SKRIFA_VERSIONS" != *$'\n'* ]] \ + || fail "Expected one skrifa version in the playground Wasm dependencies, found: $SKRIFA_VERSIONS" + +echo "==> Checking workflow YAML validity" +if [ -f "$REPO_ROOT/.github/workflows/native-playground.yml" ] && [ -f "$REPO_ROOT/.github/workflows/build-test.yml" ]; then + if python3 -c "import yaml" 2>/dev/null; then + python3 -c " +import yaml, sys +for p in sys.argv[1:]: + with open(p) as f: + yaml.safe_load(f) + print('YAML OK:', p) +" "$REPO_ROOT/.github/workflows/build-test.yml" "$REPO_ROOT/.github/workflows/native-playground.yml" + elif command -v ruby >/dev/null 2>&1; then + ruby -ryaml -e 'ARGV.each { |p| YAML.load_file(p); puts "YAML OK: #{p}" }' \ + "$REPO_ROOT/.github/workflows/build-test.yml" "$REPO_ROOT/.github/workflows/native-playground.yml" + else + fail "Neither python3-yaml nor ruby is available to validate workflow YAML files" + fi +fi + +echo "==> Checking CARGO_ENCODED_RUSTFLAGS isolation (no leaked root NAPI linker flags)" +# The dependency-free `ui-tokens` test executable links quickly from a cold cache. +if ! LINK_LOG=$(CARGO_ENCODED_RUSTFLAGS="" cargo rustc -p ui-tokens --lib --profile test -- -C metadata="linkcheck-$$" --print link-args 2>&1); then + echo "$LINK_LOG" >&2 + fail "cargo rustc link-args check failed" +fi +if ! grep -qE '(cc|clang|gcc|ld|lld|"[^"]*ui_tokens|ui_tokens)' <<<"$LINK_LOG"; then + echo "$LINK_LOG" >&2 + fail "cargo rustc did not emit a linker invocation (cache bypass failed)" +fi +if grep -qE '(-all_load|-undefined[ ,]+dynamic_lookup|-z[ ,]+nodelete)' <<<"$LINK_LOG"; then + echo "$LINK_LOG" >&2 + fail "Detected leaked root NAPI linker flags in rustc invocation" +fi + +echo "==> Checking snapshot prefix liveness" +node "$SCRIPT_DIR/check-snapshot-prefixes.mjs" --source-only + +echo "All static invariants passed." diff --git a/packages/frontend/scripts/check-snapshot-prefixes.mjs b/packages/frontend/scripts/check-snapshot-prefixes.mjs new file mode 100644 index 0000000000..2352ee1dfd --- /dev/null +++ b/packages/frontend/scripts/check-snapshot-prefixes.mjs @@ -0,0 +1,856 @@ +#!/usr/bin/env node +// @ts-check + +/** + * Verifies that production Wasm bundles (`playground_bg.wasm`, + * `affine_desktop_bg.wasm`) contain zero harness snapshot ID prefixes in + * WebAssembly Section 11 (Data). + * + * Modes: + * node scripts/check-snapshot-prefixes.mjs --source-only + * node scripts/check-snapshot-prefixes.mjs ... + */ + +import { createHash } from 'node:crypto'; +import { readdirSync, readFileSync, statSync } from 'node:fs'; +import { basename, dirname, join, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const SCRIPT_DIR = fileURLToPath(new URL('.', import.meta.url)); +export const DEFAULT_REPO_ROOT = resolve(SCRIPT_DIR, '../../..'); + +export const ZERO_IN_PRODUCTION = Object.freeze([ + 'edgeless.surface.', + 'edgeless.note.', + 'edgeless.frame.', + 'edgeless.text.', + 'edgeless.block.', + 'page.presence.', + 'page.block.', + 'overlay.slash_menu.item.', + 'overlay.slash_menu.group.', + 'overlay.linked_doc_menu.item.', + 'overlay.linked_doc_menu.group.', + 'overlay.linked_doc_menu.journal.', + 'overlay.pdf_viewer.page.', + 'overlay.pdf_viewer.thumb.', + 'overlay.attachment_toolbar.', + 'overlay.code_more_menu.', + 'overlay.code_lang_picker.item.', + 'overlay.bookmark_toolbar', + 'overlay.embed_toolbar', + 'overlay.format_toolbar.', + 'overlay.image_toolbar.', + 'overlay.link_popup', + 'overlay.callout_toolbar', + 'overlay.callout_icon_picker.', + 'overlay.table_toolbar.axis_menu', + 'overlay.table_col_resize.', + 'overlay.table_hover.', + 'overlay.page_scrollbar', + 'page.table_cell_focus', + 'chrome.edgeless_element_toolbar.', + 'chrome.edgeless_toolbar.', + 'chrome.edgeless_zoom.', + 'edgeless.label_format.', + 'edgeless.mindmap.toggle.', + 'edgeless.handle.rotate_', + 'edgeless.selection_box', + 'edgeless.remote_cursor.', + 'edgeless.remote_selection.', + 'chrome.presence.', + 'overlay.context_menu.', + 'overlay.context_menu', + 'overlay.image_lightbox.', + 'overlay.image_lightbox', + 'overlay.doc_panel.', + 'overlay.doc_panel', + 'overlay.database_record_sheet.', + 'overlay.database_record_sheet', + 'desktop.list.doc.', + 'desktop.trash.row.', + 'desktop.outline.rail.heading.', + 'desktop.inspector.heading.', + 'desktop.qs.doc.', + 'desktop.qs.cmd.', + 'desktop.qs.collection.', + 'desktop.qs.tag.', + 'desktop.sidebar.workspace.', + 'desktop.explorer.doc_menu.', + 'desktop.outline.rail.tick.', + 'desktop.outline.rail.open.', + 'desktop.inspector.backlink.', + 'desktop.trash.restore.', + 'desktop.trash.delete.', + 'desktop.inspector.journal.day.', + 'desktop.app_tabs.tab.', + 'desktop.split.resize.', + 'desktop.explorer.group.', + 'desktop.outline.rail.', + 'desktop.sidebar.sec.', + 'desktop.sidebar.fav.', + 'desktop.sidebar.fdoc.', + 'desktop.sidebar.col_doc.', + 'desktop.sidebar.tag_doc.', + 'desktop.sidebar.folder.', + 'desktop.sidebar.col.', + 'desktop.sidebar.tag.', + 'desktop.trash.open.', + 'desktop.sidebar.resize', + 'desktop.split.resize', + 'desktop.inspector.journal.previous', + 'desktop.inspector.journal.today', + 'desktop.inspector.journal.next', + 'chrome.doc_panel_toggle', + 'chrome.mode_switcher.edgeless', + 'chrome.mode_switcher.indicator', + 'chrome.mode_switcher.page', + 'chrome.nav_back', + 'chrome.theme_toggle', + 'chrome.topbar', + 'desktop.explorer.favorite.', + 'desktop.explorer.heading', + 'desktop.explorer.menu.', + 'desktop.explorer.selected', + 'desktop.explorer.tag_switch.', + 'desktop.header.trash.body', + 'desktop.inspector.frame.item.', + 'desktop.inspector.journal.activity.empty', + 'desktop.inspector.journal.conflict.more', + 'desktop.inspector.journal.conflict.trash.', + 'desktop.inspector.journal.dot.', + 'desktop.inspector.journal.tab.', + 'desktop.pane.0.tab.', + 'desktop.peek.control.tooltip', + 'desktop.settings.font.size.thumb', + 'desktop.sidebar.node.add', + 'desktop.sidebar.node.more', + 'desktop.trash.confirm.body', + 'desktop.trash.confirm.description', + 'desktop.trash_prompt.body', + 'desktop.trash_prompt.description', + 'edgeless.auto_complete.ghost_preview', + 'edgeless.caption_caret', + 'edgeless.caption_focus', + 'edgeless.frame_drop_highlight', + 'edgeless.inline_edit', + 'edgeless.marquee', + 'edgeless.note_slicer', + 'edgeless.snap_guideline', + 'edgeless.transform_hud', + 'overlay.add_block_button', + 'overlay.block_drag_ghost', + 'overlay.calendar_day_hover', + 'overlay.calendar_day_new_row', + 'overlay.calendar_drag_ghost', + 'overlay.calendar_drop_settle', + 'overlay.calendar_event_hover', + 'overlay.calendar_event_resize_', + 'overlay.code_lang_picker.empty', + 'overlay.code_lang_picker.scrollbar', + 'overlay.code_lang_picker.search', + 'overlay.database_popover', + 'overlay.drag_handle', + 'overlay.drop_indicator', + 'overlay.equation_editor.done', + 'overlay.equation_editor.input', + 'overlay.kanban_card_hover', + 'overlay.kanban_drag_ghost', + 'overlay.kanban_drag_placeholder', + 'overlay.kanban_drop_settle', + 'overlay.kanban_lane_footer_add', + 'overlay.keyboard_toolbar.group.', + 'overlay.keyboard_toolbar.panel.', + 'overlay.linked_doc_menu.create', + 'overlay.linked_doc_menu.input_mask', + 'overlay.linked_doc_menu.more', + 'overlay.page_marquee', + 'overlay.pdf_viewer.close', + 'overlay.pdf_viewer.filename', + 'overlay.pdf_viewer.header_title', + 'overlay.pdf_viewer.indicator', + 'overlay.pdf_viewer.status', + 'overlay.pdf_viewer.thumbnails_toggle', + 'overlay.pdf_viewer.zoom_in', + 'overlay.pdf_viewer.zoom_out', + 'overlay.pdf_viewer.zoom_reset', + 'overlay.slash_menu.preview', + 'overlay.slash_menu.query', + 'overlay.table_column_drag_ghost', + 'overlay.table_header_hover', + 'overlay.table_resize_guide', + 'overlay.table_row_drag_ghost', + 'overlay.table_row_drag_handle', + 'overlay.table_toolbar.axis_selection', + 'overlay.table_toolbar.more', + 'overlay.toolbar_tooltip', + 'overlay.touch_selection_menu', + 'page.block_placeholder', + 'page.block_selection', + 'page.caption_caret', + 'page.caption_focus', + 'page.database_cell_focus', + 'page.local_caret', + 'page.selection', + 'page.status', + 'page.table_area_selection', + 'page.table_cell_caret', + '.attachment_card', + '.bookmark_card', + '.builtin.', + '.custom.menu.', + '.embed_activate', + '.embed_card', + '.embed_shield', + '.highlight_menu.background.', + '.hscrollbar', + '.image_card', + '.journal_next', + '.journal_previous', + '.journal_week', + '.links.', + '.tag.attached.', + '.tag.create', + '.tag.option.', + '.toolbar.copy', + '.toolbar.language', + 'desktop.collection_editor.count', + 'desktop.collection_editor.doc.', + 'desktop.collection_editor.filter.remove.', + 'desktop.collection_editor.include.remove.', + 'desktop.collection_editor.menu.item.', + 'desktop.collection_editor.rules.tips', + 'desktop.collection_editor.selected', + 'desktop.header.dialog.close.icon', + 'desktop.header.info.backlink.', + 'desktop.header.info.outgoing.', + 'desktop.header.trash.description', + 'desktop.header.trash.title', + 'desktop.inspector.outgoing.', + 'desktop.settings.appearance.language', + 'desktop.settings.storage.panel', + 'overlay.pdf_viewer.titlebar', + 'overlay.slash_menu.submenu', + 'page.database_cell_caret', + 'root.canvas', + 'desktop.explorer.display.group.', + 'desktop.explorer.group_header.', + 'desktop.explorer.group_select.', + 'desktop.explorer.group_toggle.', + 'desktop.explorer.pinned.add_option.', + 'desktop.explorer.pinned.item.', + 'desktop.explorer.pinned.remove.', + 'desktop.explorer.quick_select.', + 'desktop.explorer.quick_split.', + 'desktop.explorer.quick_tab.', + 'desktop.explorer.quick_trash.', + 'chrome.edgeless_element_toolbar', + 'chrome.edgeless_toolbar', + 'chrome.edgeless_zoom', + 'chrome.mode_switcher', + 'desktop.explorer.display.body', + 'desktop.explorer.display.icon', + 'desktop.inspector.journal.conflict', + 'desktop.trash.confirm.close.icon', + 'desktop.trash.confirm.title', + 'desktop.trash_prompt.close.icon', + 'desktop.trash_prompt.title', + 'overlay.attachment_toolbar', + 'overlay.code_lang_picker', + 'overlay.code_more_menu', + 'overlay.equation_editor', + 'overlay.format_toolbar', + 'overlay.image_toolbar', + 'overlay.keyboard_toolbar', + 'overlay.linked_doc_menu', + 'overlay.pdf_viewer', + 'overlay.slash_menu', + 'overlay.table_toolbar', + 'desktop.explorer.display.prop.', + 'desktop.inspector.frame.title.', + 'desktop.sidebar.linked_doc.', + 'edgeless.link_picker', + 'desktop.settings.about.version.', + 'desktop.settings.delete_workspace_confirm.body', + 'desktop.settings.delete_workspace_confirm.close.icon', + 'desktop.settings.delete_workspace_confirm.description', + 'desktop.settings.delete_workspace_confirm.title', + 'desktop.settings.storage.export', + 'desktop.trash.select.', + 'desktop.sidebar.fav_doc.', + 'desktop.sidebar.fav_folder.', + 'desktop.sidebar.fav_group.', +]); + +const WASM_MAGIC = new Uint8Array([0x00, 0x61, 0x73, 0x6d]); +const WASM_VERSION_1 = new Uint8Array([0x01, 0x00, 0x00, 0x00]); +const DATA_SECTION_ID = 11; + +/** + * Returns whether `dir` exists and is a directory. + * + * @param {string} dir + * @returns {boolean} + */ +function isDirectory(dir) { + try { + return statSync(dir).isDirectory(); + } catch { + return false; + } +} + +/** + * Collects all `.rs` files under `blocksuite/crates//src/**` and + * `packages/frontend/desktop/src/**`. + * + * @param {string} repoRoot + * @returns {string[]} + */ +function collectRustSourceFiles(repoRoot) { + /** @type {string[]} */ + const files = []; + const cratesRoot = join(repoRoot, 'blocksuite', 'crates'); + const desktopSrc = join(repoRoot, 'packages', 'frontend', 'desktop', 'src'); + const hasCrates = isDirectory(cratesRoot); + const hasDesktop = isDirectory(desktopSrc); + + if (!hasCrates && !hasDesktop) { + throw new Error(`Cannot read Rust source directories under ${repoRoot}`); + } + + /** @param {string} dir */ + function walkRs(dir) { + for (const entry of readdirSync(dir, { withFileTypes: true })) { + const full = join(dir, entry.name); + if (entry.isDirectory()) { + walkRs(full); + } else if (entry.isFile() && entry.name.endsWith('.rs')) { + files.push(full); + } + } + } + + if (hasCrates) { + for (const entry of readdirSync(cratesRoot, { withFileTypes: true })) { + if (!entry.isDirectory()) continue; + const srcDir = join(cratesRoot, entry.name, 'src'); + if (isDirectory(srcDir)) { + walkRs(srcDir); + } + } + } + + if (hasDesktop) { + walkRs(desktopSrc); + } + + return files; +} + +const TEST_CFG_LINE = /^\s*#\[cfg\((?:test|all\(\s*test\b.*)\)\]\s*$/; +const MOD_DECL_LINE = + /^(\s*)(?:pub(?:\([^)]*\))?\s+)?mod\s+([A-Za-z_][A-Za-z0-9_]*)\s*([;{])\s*$/; + +/** + * Lists the module declarations of one Rust file. A declaration is test-only + * when a `#[cfg(test)]` or `#[cfg(all(test, ...))]` attribute precedes it. + * Inline test-only modules also report the line of the `}` that closes them, + * which rustfmt places at the indentation of the `mod` line. + * + * @param {string} file + * @param {string[]} lines + * @returns {Array<{ name: string, test: boolean, start: number, end: number }>} + */ +function moduleDeclarations(file, lines) { + const decls = []; + for (let i = 0; i < lines.length; i += 1) { + const match = MOD_DECL_LINE.exec(lines[i]); + if (!match) continue; + let start = i; + let test = false; + while (start > 0 && lines[start - 1].trim().startsWith('#[')) { + start -= 1; + test ||= TEST_CFG_LINE.test(lines[start]); + } + let end = i; + if (test && match[3] === '{') { + const close = match[1] + '}'; + end = lines.indexOf(close, i + 1); + if (end === -1) { + throw new Error( + `${file}:${i + 1}: inline module ${match[2]} has no closing "${close}" line` + ); + } + } + decls.push({ name: match[2], test, start, end }); + } + return decls; +} + +/** + * Returns the directory that holds the child module files of `file`. + * + * @param {string} file + */ +function childModuleDir(file) { + const name = basename(file); + return ['lib.rs', 'main.rs', 'mod.rs'].includes(name) + ? dirname(file) + : join(dirname(file), name.slice(0, -'.rs'.length)); +} + +/** + * Reads the production text of every Rust source file. Files of test-only + * modules are left out: a module declared under `#[cfg(test)]` and every + * module below it. Inline `#[cfg(test)]` modules are cut out of the text that + * remains, so assertions in unit tests never keep a prefix alive. + * + * @param {string[]} files + * @returns {Map} + */ +function readProductionSources(files) { + /** @type {Map} */ + const lines = new Map( + files.map(file => [file, readFileSync(file, 'utf8').split('\n')]) + ); + const decls = new Map( + files.map(file => [ + file, + moduleDeclarations(file, /** @type {string[]} */ (lines.get(file))), + ]) + ); + + /** @type {string[]} */ + const testRoots = []; + const isTestOnly = (/** @type {string} */ file) => + testRoots.some( + root => file === root + '.rs' || file.startsWith(root + '/') + ); + let grew = true; + while (grew) { + grew = false; + for (const file of files) { + const testFile = isTestOnly(file); + for (const decl of decls.get(file) ?? []) { + if (!decl.test && !testFile) continue; + const root = join(childModuleDir(file), decl.name); + if (!testRoots.includes(root)) { + testRoots.push(root); + grew = true; + } + } + } + } + + /** @type {Map} */ + const sources = new Map(); + for (const file of files) { + if (isTestOnly(file)) continue; + const kept = [...(lines.get(file) ?? [])]; + let cutEnd = -1; + const cuts = []; + for (const decl of decls.get(file) ?? []) { + if (decl.test && decl.start > cutEnd) { + cuts.push(decl); + cutEnd = decl.end; + } + } + for (const cut of cuts.reverse()) { + kept.splice(cut.start, cut.end - cut.start + 1); + } + sources.set(file, kept.join('\n')); + } + return sources; +} + +/** + * Checks that every prefix in `prefixes` appears at least once in Rust sources + * under `/blocksuite/crates//src/**` and + * `/packages/frontend/desktop/src/**`. + * + * @param {{ repoRoot?: string, prefixes?: readonly string[] }} [options] + * @returns {{ ok: boolean, missing: string[], counts: Record, scannedFiles: number }} + */ +export function verifySourcePrefixes(options = {}) { + const repoRoot = options.repoRoot ?? DEFAULT_REPO_ROOT; + const prefixes = options.prefixes ?? ZERO_IN_PRODUCTION; + const sources = readProductionSources(collectRustSourceFiles(repoRoot)); + + /** @type {Record} */ + const counts = Object.fromEntries(prefixes.map(prefix => [prefix, 0])); + for (const content of sources.values()) { + for (const prefix of prefixes) { + let from = 0; + while (true) { + const idx = content.indexOf(prefix, from); + if (idx === -1) break; + counts[prefix] += 1; + from = idx + 1; + } + } + } + + const missing = prefixes.filter(prefix => counts[prefix] === 0); + return { + ok: missing.length === 0, + missing, + counts, + scannedFiles: sources.size, + }; +} + +/** + * Reads an unsigned LEB128 u32 from `bytes` within `[offset, end)`. + * + * @param {Uint8Array} bytes + * @param {number} offset + * @param {number} end + * @returns {{ value: number, next: number }} + */ +function readU32Leb(bytes, offset, end) { + let result = 0; + let shift = 0; + let pos = offset; + for (let count = 0; count < 5; count += 1) { + if (pos >= end) { + throw new Error(`Truncated unsigned LEB128 at byte offset ${offset}`); + } + const byte = bytes[pos++]; + if (count === 4 && (byte & 0xf0) !== 0) { + throw new Error(`Unsigned LEB128 u32 overflow at byte offset ${offset}`); + } + result += (byte & 0x7f) * 2 ** shift; + if ((byte & 0x80) === 0) { + return { value: result, next: pos }; + } + shift += 7; + } + throw new Error(`Overlong unsigned LEB128 at byte offset ${offset}`); +} + +/** + * Skips a signed LEB128 integer of at most `maxBytes` within `[offset, end)`. + * + * @param {Uint8Array} bytes + * @param {number} offset + * @param {number} end + * @param {number} maxBytes + * @returns {number} + */ +function skipSignedLeb(bytes, offset, end, maxBytes) { + let pos = offset; + for (let count = 0; count < maxBytes; count += 1) { + if (pos >= end) { + throw new Error(`Truncated signed LEB128 at byte offset ${offset}`); + } + const byte = bytes[pos++]; + if ((byte & 0x80) === 0) { + return pos; + } + } + throw new Error(`Overlong signed LEB128 at byte offset ${offset}`); +} + +/** + * Skips a WebAssembly constant expression through its terminating `0x0b` opcode. + * + * @param {Uint8Array} bytes + * @param {number} offset + * @param {number} end + * @returns {number} + */ +function skipConstExpr(bytes, offset, end) { + let pos = offset; + while (pos < end) { + const opcode = bytes[pos++]; + if (opcode === 0x0b) { + return pos; + } + if (opcode === 0x41) { + // i32.const + pos = skipSignedLeb(bytes, pos, end, 5); + } else if (opcode === 0x42) { + // i64.const + pos = skipSignedLeb(bytes, pos, end, 10); + } else if (opcode === 0x43) { + // f32.const + if (pos + 4 > end) { + throw new Error(`Truncated f32.const at byte offset ${pos - 1}`); + } + pos += 4; + } else if (opcode === 0x44) { + // f64.const + if (pos + 8 > end) { + throw new Error(`Truncated f64.const at byte offset ${pos - 1}`); + } + pos += 8; + } else if (opcode === 0x23 || opcode === 0xd2) { + // global.get / ref.func + pos = readU32Leb(bytes, pos, end).next; + } else if (opcode === 0xd0) { + // ref.null heaptype + pos = skipSignedLeb(bytes, pos, end, 5); + } else if ( + opcode === 0x6a || + opcode === 0x6b || + opcode === 0x6c || + opcode === 0x7c || + opcode === 0x7d || + opcode === 0x7e + ) { + // Extended constant expression arithmetic (i32/i64 add/sub/mul) + } else if (opcode === 0xfd) { + // SIMD v128.const + const sub = readU32Leb(bytes, pos, end); + if (sub.value !== 0x0c) { + throw new Error( + `Unsupported SIMD opcode 0xfd 0x${sub.value.toString(16)} in constant expression` + ); + } + if (sub.next + 16 > end) { + throw new Error(`Truncated v128.const at byte offset ${pos - 1}`); + } + pos = sub.next + 16; + } else { + throw new Error( + `Unsupported opcode 0x${opcode.toString(16)} in Data segment constant expression at byte offset ${pos - 1}` + ); + } + } + throw new Error( + `Unterminated Data segment constant expression starting at byte offset ${offset}` + ); +} + +/** + * Parses Section 11 (Data) from a WebAssembly binary and returns each data + * segment's independent payload slice. + * + * @param {Uint8Array} bytes + * @returns {{ segments: Array<{ index: number, mode: number, payload: Uint8Array }>, totalDataBytes: number }} + */ +export function extractWasmDataSegments(bytes) { + if (!(bytes instanceof Uint8Array) || bytes.length < 8) { + throw new Error('Wasm binary is shorter than the 8-byte header'); + } + for (let i = 0; i < 4; i += 1) { + if (bytes[i] !== WASM_MAGIC[i]) { + throw new Error('Invalid Wasm magic header (expected \\0asm)'); + } + } + for (let i = 0; i < 4; i += 1) { + if (bytes[4 + i] !== WASM_VERSION_1[i]) { + throw new Error('Unsupported Wasm binary version (expected version 1)'); + } + } + + let pos = 8; + /** @type {{ start: number, end: number } | null} */ + let dataSection = null; + + while (pos < bytes.length) { + const sectionId = bytes[pos++]; + const sizeInfo = readU32Leb(bytes, pos, bytes.length); + const payloadStart = sizeInfo.next; + const payloadEnd = payloadStart + sizeInfo.value; + if (payloadEnd > bytes.length) { + throw new Error( + `Section ${sectionId} length ${sizeInfo.value} exceeds binary size ${bytes.length} at byte offset ${payloadStart}` + ); + } + if (sectionId === DATA_SECTION_ID) { + if (dataSection !== null) { + throw new Error('Duplicate Wasm Section 11 (Data)'); + } + dataSection = { start: payloadStart, end: payloadEnd }; + } + pos = payloadEnd; + } + + if (dataSection === null) { + throw new Error('Missing Wasm Section 11 (Data)'); + } + if (dataSection.start === dataSection.end) { + throw new Error('Wasm Section 11 (Data) is empty'); + } + + const countInfo = readU32Leb(bytes, dataSection.start, dataSection.end); + const segmentCount = countInfo.value; + if (segmentCount === 0) { + throw new Error('Wasm Section 11 (Data) declares 0 data segments'); + } + + let segPos = countInfo.next; + /** @type {Array<{ index: number, mode: number, payload: Uint8Array }>} */ + const segments = []; + let totalDataBytes = 0; + + for (let index = 0; index < segmentCount; index += 1) { + const modeInfo = readU32Leb(bytes, segPos, dataSection.end); + const mode = modeInfo.value; + segPos = modeInfo.next; + + if (mode === 0) { + // Active segment targeting memory 0. + segPos = skipConstExpr(bytes, segPos, dataSection.end); + } else if (mode === 1) { + // Passive segment: no memory index or offset expression. + } else if (mode === 2) { + // Active segment with explicit memory index. + const memIdxInfo = readU32Leb(bytes, segPos, dataSection.end); + segPos = skipConstExpr(bytes, memIdxInfo.next, dataSection.end); + } else { + throw new Error( + `Unsupported Wasm Data segment mode ${mode} at segment ${index}` + ); + } + + const lenInfo = readU32Leb(bytes, segPos, dataSection.end); + const dataStart = lenInfo.next; + const dataEnd = dataStart + lenInfo.value; + if (dataEnd > dataSection.end) { + throw new Error( + `Data segment ${index} length ${lenInfo.value} exceeds Section 11 bounds` + ); + } + segments.push({ + index, + mode, + payload: bytes.subarray(dataStart, dataEnd), + }); + totalDataBytes += lenInfo.value; + segPos = dataEnd; + } + + if (segPos !== dataSection.end) { + throw new Error( + `Trailing bytes in Wasm Section 11 (Data): parsed to ${segPos}, section ends at ${dataSection.end}` + ); + } + if (totalDataBytes === 0) { + throw new Error('Wasm Section 11 (Data) contains 0 payload bytes'); + } + + return { segments, totalDataBytes }; +} + +/** + * Searches each Wasm Data segment payload independently for forbidden ASCII + * snapshot prefixes. + * + * @param {Uint8Array} bytes + * @param {readonly string[]} [prefixes] + */ +export function scanWasmDataPrefixes(bytes, prefixes = ZERO_IN_PRODUCTION) { + const sha256 = createHash('sha256').update(bytes).digest('hex'); + const { segments, totalDataBytes } = extractWasmDataSegments(bytes); + + /** @type {Array<{ prefix: string, count: number, firstSegment: number, firstOffset: number }>} */ + const hits = []; + + for (const prefix of prefixes) { + const needle = Buffer.from(prefix, 'ascii'); + let count = 0; + let firstSegment = -1; + let firstOffset = -1; + + for (const seg of segments) { + const hay = Buffer.from( + seg.payload.buffer, + seg.payload.byteOffset, + seg.payload.byteLength + ); + let from = 0; + while (from <= hay.length - needle.length) { + const idx = hay.indexOf(needle, from); + if (idx === -1) break; + if (firstSegment === -1) { + firstSegment = seg.index; + firstOffset = idx; + } + count += 1; + from = idx + 1; + } + } + + if (count > 0) { + hits.push({ prefix, count, firstSegment, firstOffset }); + } + } + + return { + ok: hits.length === 0, + sha256, + segmentCount: segments.length, + totalDataBytes, + hits, + }; +} + +/** + * CLI entrypoint. + * + * @param {string[]} argv + */ +function main(argv) { + if ( + argv.length === 0 || + (argv.includes('--source-only') && argv.length !== 1) + ) { + throw new Error( + 'Usage: node scripts/check-snapshot-prefixes.mjs --source-only | ...' + ); + } + + const sourceResult = verifySourcePrefixes(); + if (!sourceResult.ok) { + throw new Error( + `Snapshot prefix liveness check failed across ${sourceResult.scannedFiles} Rust files. Missing prefixes: ${sourceResult.missing.join(', ')}` + ); + } + + if (argv[0] === '--source-only') { + console.log( + `Snapshot prefix source liveness check passed (${ZERO_IN_PRODUCTION.length}/${ZERO_IN_PRODUCTION.length} prefixes found across ${sourceResult.scannedFiles} Rust files).` + ); + return; + } + + /** @type {string[]} */ + const failures = []; + for (const arg of argv) { + const wasmPath = resolve(arg); + const scan = scanWasmDataPrefixes(readFileSync(wasmPath)); + if (!scan.ok) { + failures.push( + `Forbidden snapshot prefixes found in Wasm Section 11 (Data): ${wasmPath}`, + `SHA-256: ${scan.sha256}`, + ...scan.hits.map( + hit => + ` - ${hit.prefix}: count=${hit.count}, first_segment=${hit.firstSegment}, first_offset=${hit.firstOffset}` + ) + ); + continue; + } + console.log( + `Wasm Section 11 snapshot prefix gate passed for ${wasmPath} (${ZERO_IN_PRODUCTION.length}/${ZERO_IN_PRODUCTION.length} prefixes at 0, ${scan.segmentCount} segments, ${scan.totalDataBytes} data bytes, sha256=${scan.sha256}).` + ); + } + if (failures.length > 0) { + throw new Error(failures.join('\n')); + } +} + +const isMain = + process.argv[1] && + resolve(process.argv[1]) === fileURLToPath(import.meta.url); + +if (isMain) { + try { + main(process.argv.slice(2)); + } catch (err) { + console.error(err instanceof Error ? err.message : String(err)); + process.exitCode = 1; + } +} diff --git a/packages/frontend/scripts/check-snapshot-prefixes.test.mjs b/packages/frontend/scripts/check-snapshot-prefixes.test.mjs new file mode 100644 index 0000000000..1f2e621a07 --- /dev/null +++ b/packages/frontend/scripts/check-snapshot-prefixes.test.mjs @@ -0,0 +1,754 @@ +// @ts-check + +import assert from 'node:assert/strict'; +import { spawnSync } from 'node:child_process'; +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import test from 'node:test'; +import { fileURLToPath } from 'node:url'; + +import { + scanWasmDataPrefixes, + verifySourcePrefixes, + ZERO_IN_PRODUCTION, +} from './check-snapshot-prefixes.mjs'; + +const SCRIPT_PATH = fileURLToPath( + new URL('./check-snapshot-prefixes.mjs', import.meta.url) +); + +const DESKTOP_PREFIXES = [ + 'desktop.list.doc.', + 'desktop.trash.row.', + 'desktop.outline.rail.heading.', + 'desktop.inspector.heading.', + 'desktop.qs.doc.', + 'desktop.qs.cmd.', +]; + +const NEW_DESKTOP_PREFIXES = [ + 'desktop.qs.collection.', + 'desktop.qs.tag.', + 'desktop.sidebar.workspace.', + 'desktop.explorer.doc_menu.', + 'desktop.outline.rail.tick.', + 'desktop.outline.rail.open.', + 'desktop.inspector.backlink.', + 'desktop.trash.restore.', + 'desktop.trash.delete.', + 'desktop.inspector.journal.day.', + 'desktop.app_tabs.tab.', + 'desktop.split.resize.', + 'desktop.explorer.group.', +]; + +const SIDEBAR_AND_PANEL_PREFIXES = [ + 'desktop.outline.rail.', + 'desktop.sidebar.sec.', + 'desktop.sidebar.fav.', + 'desktop.sidebar.fdoc.', + 'desktop.sidebar.col_doc.', + 'desktop.sidebar.tag_doc.', + 'desktop.sidebar.folder.', + 'desktop.sidebar.col.', + 'desktop.sidebar.tag.', + 'desktop.trash.open.', + 'desktop.sidebar.resize', + 'desktop.split.resize', + 'desktop.inspector.journal.previous', + 'desktop.inspector.journal.today', + 'desktop.inspector.journal.next', +]; + +const SNAPSHOT_RATCHET_ADDITIONS = [ + 'chrome.doc_panel_toggle', + 'chrome.mode_switcher.edgeless', + 'chrome.mode_switcher.indicator', + 'chrome.mode_switcher.page', + 'chrome.nav_back', + 'chrome.theme_toggle', + 'chrome.topbar', + 'desktop.explorer.favorite.', + 'desktop.explorer.heading', + 'desktop.explorer.menu.', + 'desktop.explorer.selected', + 'desktop.explorer.tag_switch.', + 'desktop.header.trash.body', + 'desktop.inspector.frame.item.', + 'desktop.inspector.journal.activity.empty', + 'desktop.inspector.journal.conflict.more', + 'desktop.inspector.journal.conflict.trash.', + 'desktop.inspector.journal.dot.', + 'desktop.inspector.journal.tab.', + 'desktop.pane.0.tab.', + 'desktop.peek.control.tooltip', + 'desktop.settings.font.size.thumb', + 'desktop.sidebar.node.add', + 'desktop.sidebar.node.more', + 'desktop.trash.confirm.body', + 'desktop.trash.confirm.description', + 'desktop.trash_prompt.body', + 'desktop.trash_prompt.description', + 'edgeless.auto_complete.ghost_preview', + 'edgeless.caption_caret', + 'edgeless.caption_focus', + 'edgeless.frame_drop_highlight', + 'edgeless.inline_edit', + 'edgeless.marquee', + 'edgeless.note_slicer', + 'edgeless.snap_guideline', + 'edgeless.transform_hud', + 'overlay.add_block_button', + 'overlay.block_drag_ghost', + 'overlay.calendar_day_hover', + 'overlay.calendar_day_new_row', + 'overlay.calendar_drag_ghost', + 'overlay.calendar_drop_settle', + 'overlay.calendar_event_hover', + 'overlay.calendar_event_resize_', + 'overlay.code_lang_picker.empty', + 'overlay.code_lang_picker.scrollbar', + 'overlay.code_lang_picker.search', + 'overlay.database_popover', + 'overlay.drag_handle', + 'overlay.drop_indicator', + 'overlay.equation_editor.done', + 'overlay.equation_editor.input', + 'overlay.kanban_card_hover', + 'overlay.kanban_drag_ghost', + 'overlay.kanban_drag_placeholder', + 'overlay.kanban_drop_settle', + 'overlay.kanban_lane_footer_add', + 'overlay.keyboard_toolbar.group.', + 'overlay.keyboard_toolbar.panel.', + 'overlay.linked_doc_menu.create', + 'overlay.linked_doc_menu.input_mask', + 'overlay.linked_doc_menu.more', + 'overlay.page_marquee', + 'overlay.pdf_viewer.close', + 'overlay.pdf_viewer.filename', + 'overlay.pdf_viewer.header_title', + 'overlay.pdf_viewer.indicator', + 'overlay.pdf_viewer.status', + 'overlay.pdf_viewer.thumbnails_toggle', + 'overlay.pdf_viewer.zoom_in', + 'overlay.pdf_viewer.zoom_out', + 'overlay.pdf_viewer.zoom_reset', + 'overlay.slash_menu.preview', + 'overlay.slash_menu.query', + 'overlay.table_column_drag_ghost', + 'overlay.table_header_hover', + 'overlay.table_resize_guide', + 'overlay.table_row_drag_ghost', + 'overlay.table_row_drag_handle', + 'overlay.table_toolbar.axis_selection', + 'overlay.table_toolbar.more', + 'overlay.toolbar_tooltip', + 'overlay.touch_selection_menu', + 'page.block_placeholder', + 'page.block_selection', + 'page.caption_caret', + 'page.caption_focus', + 'page.database_cell_focus', + 'page.local_caret', + 'page.selection', + 'page.status', + 'page.table_area_selection', + 'page.table_cell_caret', +]; + +const EXTENDED_SNAPSHOT_PREFIXES = [ + '.attachment_card', + '.bookmark_card', + '.builtin.', + '.custom.menu.', + '.embed_activate', + '.embed_card', + '.embed_shield', + '.highlight_menu.background.', + '.hscrollbar', + '.image_card', + '.journal_next', + '.journal_previous', + '.journal_week', + '.links.', + '.tag.attached.', + '.tag.create', + '.tag.option.', + '.toolbar.copy', + '.toolbar.language', + 'desktop.collection_editor.count', + 'desktop.collection_editor.doc.', + 'desktop.collection_editor.filter.remove.', + 'desktop.collection_editor.include.remove.', + 'desktop.collection_editor.menu.item.', + 'desktop.collection_editor.rules.tips', + 'desktop.collection_editor.selected', + 'desktop.header.dialog.close.icon', + 'desktop.header.info.backlink.', + 'desktop.header.info.outgoing.', + 'desktop.header.trash.description', + 'desktop.header.trash.title', + 'desktop.inspector.outgoing.', + 'desktop.settings.appearance.language', + 'desktop.settings.storage.panel', + 'overlay.pdf_viewer.titlebar', + 'overlay.slash_menu.submenu', + 'page.database_cell_caret', + 'root.canvas', +]; + +const EXPLORER_SNAPSHOT_PREFIXES = [ + 'desktop.explorer.display.group.', + 'desktop.explorer.group_header.', + 'desktop.explorer.group_select.', + 'desktop.explorer.group_toggle.', + 'desktop.explorer.pinned.add_option.', + 'desktop.explorer.pinned.item.', + 'desktop.explorer.pinned.remove.', + 'desktop.explorer.quick_select.', + 'desktop.explorer.quick_split.', + 'desktop.explorer.quick_tab.', + 'desktop.explorer.quick_trash.', +]; + +const SHELL_CONTAINER_AND_DIALOG_PREFIXES = [ + 'chrome.edgeless_element_toolbar', + 'chrome.edgeless_toolbar', + 'chrome.edgeless_zoom', + 'chrome.mode_switcher', + 'desktop.explorer.display.body', + 'desktop.explorer.display.icon', + 'desktop.inspector.journal.conflict', + 'desktop.trash.confirm.close.icon', + 'desktop.trash.confirm.title', + 'desktop.trash_prompt.close.icon', + 'desktop.trash_prompt.title', + 'overlay.attachment_toolbar', + 'overlay.code_lang_picker', + 'overlay.code_more_menu', + 'overlay.equation_editor', + 'overlay.format_toolbar', + 'overlay.image_toolbar', + 'overlay.keyboard_toolbar', + 'overlay.linked_doc_menu', + 'overlay.pdf_viewer', + 'overlay.slash_menu', + 'overlay.table_toolbar', +]; + +const DISPLAY_AND_LINK_PICKER_PREFIXES = [ + 'desktop.explorer.display.prop.', + 'desktop.inspector.frame.title.', + 'desktop.sidebar.linked_doc.', + 'edgeless.link_picker', +]; + +const SETTINGS_AND_TRASH_SELECT_PREFIXES = [ + 'desktop.settings.about.version.', + 'desktop.settings.delete_workspace_confirm.body', + 'desktop.settings.delete_workspace_confirm.close.icon', + 'desktop.settings.delete_workspace_confirm.description', + 'desktop.settings.delete_workspace_confirm.title', + 'desktop.settings.storage.export', + 'desktop.trash.select.', +]; + +const FAVORITE_ROW_PREFIXES = [ + 'desktop.sidebar.fav_doc.', + 'desktop.sidebar.fav_folder.', + 'desktop.sidebar.fav_group.', +]; + +const NON_OVERLAPPING_PREFIXES = new Set([ + 'desktop.explorer.display.body', + 'desktop.explorer.display.icon', + 'desktop.trash.confirm.close.icon', + 'desktop.trash.confirm.title', + 'desktop.trash_prompt.close.icon', + 'desktop.trash_prompt.title', + ...DISPLAY_AND_LINK_PICKER_PREFIXES, + ...SETTINGS_AND_TRASH_SELECT_PREFIXES, + ...FAVORITE_ROW_PREFIXES, +]); + +/** + * Encodes an unsigned integer as LEB128. + * + * @param {number} value + * @returns {number[]} + */ +function encodeU32Leb(value) { + const out = []; + let v = value >>> 0; + do { + let byte = v & 0x7f; + v >>>= 7; + if (v !== 0) byte |= 0x80; + out.push(byte); + } while (v !== 0); + return out; +} + +/** + * Builds a Wasm section byte array. + * + * @param {number} id + * @param {number[]} payload + * @returns {number[]} + */ +function buildSection(id, payload) { + return [id, ...encodeU32Leb(payload.length), ...payload]; +} + +/** + * Builds a Wasm custom section (ID 0). + * + * @param {string} name + * @param {string} body + * @returns {number[]} + */ +function buildCustomSection(name, body) { + const nameBytes = Array.from(Buffer.from(name, 'utf8')); + const bodyBytes = Array.from(Buffer.from(body, 'utf8')); + return buildSection(0, [ + ...encodeU32Leb(nameBytes.length), + ...nameBytes, + ...bodyBytes, + ]); +} + +/** + * Builds a Wasm Section 11 (Data) containing passive segments. + * + * @param {string[]} payloads + * @returns {number[]} + */ +function buildPassiveDataSection(payloads) { + const body = [...encodeU32Leb(payloads.length)]; + for (const text of payloads) { + const raw = Array.from(Buffer.from(text, 'utf8')); + body.push(1, ...encodeU32Leb(raw.length), ...raw); + } + return buildSection(11, body); +} + +/** + * Builds a complete Wasm module binary. + * + * @param {number[][]} sections + * @returns {Uint8Array} + */ +function buildWasm(sections) { + return Uint8Array.from([ + 0x00, + 0x61, + 0x73, + 0x6d, + 1, + 0, + 0, + 0, + ...sections.flat(), + ]); +} + +test('rejects bare snapshot container IDs in Wasm Data segments', () => { + for (const root of [ + 'overlay.context_menu', + 'overlay.image_lightbox', + 'overlay.doc_panel', + 'overlay.database_record_sheet', + ]) { + const wasm = buildWasm([buildPassiveDataSection([root])]); + const result = scanWasmDataPrefixes(wasm); + assert.equal(result.ok, false, root); + assert.deepEqual(result.hits, [ + { prefix: root, count: 1, firstSegment: 0, firstOffset: 0 }, + ]); + } +}); + +test('verifies all 260 live prefixes including desktop production sources', () => { + assert.equal(ZERO_IN_PRODUCTION.length, 260); + const firstBatchAdditions = ZERO_IN_PRODUCTION.slice(81, 175); + assert.deepEqual( + firstBatchAdditions, + SNAPSHOT_RATCHET_ADDITIONS, + 'Existing 175 prefixes must keep exact order' + ); + assert.deepEqual( + firstBatchAdditions, + [...firstBatchAdditions].sort(), + 'First ratchet batch must stay sorted lexicographically' + ); + const extendedAdditions = ZERO_IN_PRODUCTION.slice(175, 213); + assert.deepEqual( + extendedAdditions, + EXTENDED_SNAPSHOT_PREFIXES, + 'Extended snapshot prefixes must match appended order' + ); + assert.deepEqual( + extendedAdditions, + [...extendedAdditions].sort(), + 'Extended snapshot prefixes must stay sorted lexicographically' + ); + assert.deepEqual( + ZERO_IN_PRODUCTION.slice(213, 224), + EXPLORER_SNAPSHOT_PREFIXES, + 'Explorer snapshot prefixes must match appended order' + ); + const shellAdditions = ZERO_IN_PRODUCTION.slice(224, 246); + assert.deepEqual( + shellAdditions, + SHELL_CONTAINER_AND_DIALOG_PREFIXES, + 'Shell container and dialog prefixes must match appended order' + ); + assert.deepEqual( + shellAdditions, + [...shellAdditions].sort(), + 'Shell container and dialog prefixes must stay sorted lexicographically' + ); + assert.deepEqual( + ZERO_IN_PRODUCTION.slice(246, 250), + DISPLAY_AND_LINK_PICKER_PREFIXES + ); + const settingsAndTrashAdditions = ZERO_IN_PRODUCTION.slice(250, 257); + assert.deepEqual( + settingsAndTrashAdditions, + SETTINGS_AND_TRASH_SELECT_PREFIXES, + 'Settings and trash select prefixes must match appended order' + ); + assert.deepEqual( + settingsAndTrashAdditions, + [...settingsAndTrashAdditions].sort(), + 'Settings and trash select prefixes must stay sorted lexicographically' + ); + const favoriteRowAdditions = ZERO_IN_PRODUCTION.slice(257); + assert.deepEqual( + favoriteRowAdditions, + FAVORITE_ROW_PREFIXES, + 'Favorite row prefixes must match appended order' + ); + assert.deepEqual( + favoriteRowAdditions, + [...favoriteRowAdditions].sort(), + 'Favorite row prefixes must stay sorted lexicographically' + ); + assert.equal( + new Set(ZERO_IN_PRODUCTION).size, + ZERO_IN_PRODUCTION.length, + 'ZERO_IN_PRODUCTION must not contain duplicate prefixes' + ); + for (let i = 0; i < SIDEBAR_AND_PANEL_PREFIXES.length; i += 1) { + for (let j = 0; j < SIDEBAR_AND_PANEL_PREFIXES.length; j += 1) { + if (i === j) continue; + assert.equal( + SIDEBAR_AND_PANEL_PREFIXES[i].startsWith(SIDEBAR_AND_PANEL_PREFIXES[j]), + false, + `Redundant prefix pair in desktop additions: ${SIDEBAR_AND_PANEL_PREFIXES[j]} covers ${SIDEBAR_AND_PANEL_PREFIXES[i]}` + ); + } + } + const additionSet = new Set(SNAPSHOT_RATCHET_ADDITIONS); + for (const prefix of SNAPSHOT_RATCHET_ADDITIONS) { + for (const existing of ZERO_IN_PRODUCTION.slice(0, 175)) { + if (existing === prefix) continue; + assert.equal( + prefix.startsWith(existing), + false, + `Redundant addition ${prefix} is already covered by ${existing}` + ); + if (!additionSet.has(existing)) { + assert.equal( + existing.startsWith(prefix), + false, + `Addition ${prefix} shadows existing prefix ${existing}` + ); + } + } + } + for (const prefix of [ + ...EXTENDED_SNAPSHOT_PREFIXES, + ...EXPLORER_SNAPSHOT_PREFIXES, + ]) { + for (const existing of ZERO_IN_PRODUCTION.slice(0, 224)) { + if (existing === prefix) continue; + assert.equal( + prefix.startsWith(existing), + false, + `Redundant addition ${prefix} is already covered by ${existing}` + ); + assert.equal( + existing.startsWith(prefix), + false, + `Addition ${prefix} shadows existing prefix ${existing}` + ); + } + } + for (const prefix of [ + ...SHELL_CONTAINER_AND_DIALOG_PREFIXES, + ...DISPLAY_AND_LINK_PICKER_PREFIXES, + ...SETTINGS_AND_TRASH_SELECT_PREFIXES, + ...FAVORITE_ROW_PREFIXES, + ]) { + for (const existing of ZERO_IN_PRODUCTION) { + if (existing === prefix) continue; + assert.equal( + prefix.startsWith(existing), + false, + `Redundant addition ${prefix} is already covered by ${existing}` + ); + if (NON_OVERLAPPING_PREFIXES.has(prefix)) { + assert.equal( + existing.startsWith(prefix), + false, + `Addition ${prefix} shadows existing prefix ${existing}` + ); + } + } + } + const result = verifySourcePrefixes(); + assert.equal( + result.ok, + true, + `Missing prefixes in repo: ${result.missing.join(', ')}` + ); + assert.equal(Object.keys(result.counts).length, 260); + for (const prefix of [ + ...DESKTOP_PREFIXES, + ...NEW_DESKTOP_PREFIXES, + ...SIDEBAR_AND_PANEL_PREFIXES, + ...SNAPSHOT_RATCHET_ADDITIONS, + ...EXTENDED_SNAPSHOT_PREFIXES, + ...EXPLORER_SNAPSHOT_PREFIXES, + ...SHELL_CONTAINER_AND_DIALOG_PREFIXES, + ...DISPLAY_AND_LINK_PICKER_PREFIXES, + ...SETTINGS_AND_TRASH_SELECT_PREFIXES, + ...FAVORITE_ROW_PREFIXES, + ]) { + assert.ok( + result.counts[prefix] >= 1, + `Expected ${prefix} to appear in production Rust sources` + ); + } +}); + +test('ignores desktop prefixes that appear only inside #[cfg(test)] modules', () => { + const dir = mkdtempSync(join(tmpdir(), 'snapshot-prefix-desktop-tests-')); + try { + const desktopSrc = join(dir, 'packages', 'frontend', 'desktop', 'src'); + mkdirSync(join(desktopSrc, 'views_extra'), { recursive: true }); + const files = { + 'lib.rs': [ + 'mod views_extra;', + '#[cfg(test)]', + 'mod tests;', + '#[cfg(all(test, feature = "harness"))]', + 'mod helpers {', + ' const H: &str = "desktop.qs.doc.";', + '}', + "pub fn live_list() -> &'static str {", + ' "desktop.list.doc."', + '}', + ], + 'tests.rs': ['const T: &str = "desktop.qs.cmd.";'], + 'views_extra/mod.rs': ['mod trash;', '#[cfg(test)]', 'mod tests;'], + 'views_extra/trash.rs': [ + 'const T: &str = "desktop.trash.row.";', + '#[cfg(test)]', + 'mod tests {', + ' const FAKE: &str = "desktop.inspector.heading.";', + '}', + ], + 'views_extra/tests.rs': [ + 'const ONLY_TEST: &str = "desktop.outline.rail.heading.";', + ], + }; + for (const [rel, lines] of Object.entries(files)) { + writeFileSync(join(desktopSrc, rel), lines.join('\n') + '\n'); + } + + const result = verifySourcePrefixes({ + repoRoot: dir, + prefixes: DESKTOP_PREFIXES, + }); + assert.equal(result.scannedFiles, 3); + assert.equal(result.ok, false); + assert.deepEqual(result.counts, { + 'desktop.list.doc.': 1, + 'desktop.trash.row.': 1, + 'desktop.outline.rail.heading.': 0, + 'desktop.inspector.heading.': 0, + 'desktop.qs.doc.': 0, + 'desktop.qs.cmd.': 0, + }); + assert.deepEqual(result.missing, [ + 'desktop.outline.rail.heading.', + 'desktop.inspector.heading.', + 'desktop.qs.doc.', + 'desktop.qs.cmd.', + ]); + } finally { + rmSync(dir, { recursive: true, force: true }); + } +}); + +test('fails CLI gate on desktop prefixes in Section 11 and ignores custom/code sections', () => { + for (const prefix of [ + ...DESKTOP_PREFIXES, + ...NEW_DESKTOP_PREFIXES, + ...SIDEBAR_AND_PANEL_PREFIXES, + ...SNAPSHOT_RATCHET_ADDITIONS, + ...EXTENDED_SNAPSHOT_PREFIXES, + ...EXPLORER_SNAPSHOT_PREFIXES, + ...SHELL_CONTAINER_AND_DIALOG_PREFIXES, + ...DISPLAY_AND_LINK_PICKER_PREFIXES, + ...SETTINGS_AND_TRASH_SELECT_PREFIXES, + ]) { + const payload = `${prefix}item-1`; + const wasm = buildWasm([buildPassiveDataSection([payload])]); + const result = scanWasmDataPrefixes(wasm); + const expectedHits = ZERO_IN_PRODUCTION.filter(candidate => + payload.includes(candidate) + ).map(candidate => ({ + prefix: candidate, + count: 1, + firstSegment: 0, + firstOffset: 0, + })); + assert.equal(result.ok, false, prefix); + assert.deepEqual(result.hits, expectedHits); + } + + for (const prefix of [ + ...EXTENDED_SNAPSHOT_PREFIXES, + ...EXPLORER_SNAPSHOT_PREFIXES, + ]) { + const splitAt = Math.floor(prefix.length / 2); + const splitWasm = buildWasm([ + buildPassiveDataSection([ + prefix.slice(0, splitAt), + prefix.slice(splitAt), + ]), + ]); + const splitResult = scanWasmDataPrefixes(splitWasm); + assert.equal(splitResult.ok, true, `split segment: ${prefix}`); + assert.deepEqual(splitResult.hits, []); + } + + const dir = mkdtempSync(join(tmpdir(), 'snapshot-prefix-desktop-wasm-')); + try { + for (const [sample, pattern] of [ + ['desktop.qs.doc.doc-1', /desktop\.qs\.doc\./], + [ + 'desktop.inspector.frame.item.frame-1', + /desktop\.inspector\.frame\.item\./, + ], + ['overlay.equation_editor.input', /overlay\.equation_editor\.input/], + [ + 'desktop.collection_editor.doc.doc-1', + /desktop\.collection_editor\.doc\./, + ], + [ + 'desktop.header.info.outgoing.doc-2', + /desktop\.header\.info\.outgoing\./, + ], + ['desktop.inspector.custom.menu.edit', /\.custom\.menu\./], + ['overlay.pdf_viewer.titlebar', /overlay\.pdf_viewer\.titlebar/], + ['page.database_cell_caret', /page\.database_cell_caret/], + ['root.canvas', /root\.canvas/], + [ + 'desktop.settings.about.version.app', + /desktop\.settings\.about\.version\./, + ], + ['desktop.trash.select.doc-1', /desktop\.trash\.select\./], + ['desktop.settings.storage.export', /desktop\.settings\.storage\.export/], + [ + 'desktop.settings.delete_workspace_confirm.title', + /desktop\.settings\.delete_workspace_confirm\.title/, + ], + ]) { + const badWasm = join(dir, 'bad.wasm'); + writeFileSync(badWasm, buildWasm([buildPassiveDataSection([sample])])); + const failRun = spawnSync(process.execPath, [SCRIPT_PATH, badWasm], { + encoding: 'utf8', + }); + assert.equal(failRun.status, 1); + assert.match(failRun.stderr, pattern); + } + + const nonDataPayload = Buffer.from( + [ + 'desktop.qs.doc.doc-1 desktop.qs.cmd.0 desktop.list.doc.a', + ...EXTENDED_SNAPSHOT_PREFIXES, + ...EXPLORER_SNAPSHOT_PREFIXES, + ...DISPLAY_AND_LINK_PICKER_PREFIXES, + ...SETTINGS_AND_TRASH_SELECT_PREFIXES, + ].join(' '), + 'utf8' + ); + const cleanWasm = join(dir, 'clean.wasm'); + writeFileSync( + cleanWasm, + buildWasm([ + buildCustomSection('name', nonDataPayload.toString('utf8')), + // Code section (ID 10) carrying non-data bytes must not trigger Data scan. + buildSection(10, [ + 1, + nonDataPayload.length + 2, + 0, + ...nonDataPayload, + 0x0b, + ]), + buildPassiveDataSection([ + 'desktop.inspector.outline.empty', + 'desktop.inspector.frame.present', + 'desktop.inspector.frame.empty', + 'desktop.inspector.frame.list', + 'desktop.inspector.tag.list', + 'desktop.explorer.menu', + 'desktop.explorer.display.order.createdAt', + 'desktop.explorer.display.qa.split', + 'desktop.app_tabs.drop_indicator', + ...EXPLORER_SNAPSHOT_PREFIXES.map(prefix => prefix.slice(0, -1)), + 'desktop.sidebar', + 'desktop.sidebar.settings', + 'desktop.trash.restore_selected', + 'desktop.trash.delete_selected', + 'desktop.pane.1.topbar.day.2026-12-01', + 'desktop.settings.appearance.title', + 'desktop.settings.appearance', + 'desktop.collections.add', + 'desktop.collection_editor.filter.method', + 'desktop.collection_editor.include.toggle', + 'desktop.collection_editor.menu.rows', + 'desktop.workbench.topbar', + 'desktop.journals.create', + ]), + ]) + ); + const passRun = spawnSync(process.execPath, [SCRIPT_PATH, cleanWasm], { + encoding: 'utf8', + }); + assert.equal(passRun.status, 0, passRun.stderr); + assert.match(passRun.stdout, /260\/260 prefixes at 0/); + + const desktopOnlyOptWasm = join(dir, 'affine_desktop_bg.opt.wasm'); + writeFileSync( + desktopOnlyOptWasm, + buildWasm([buildPassiveDataSection(['desktop.settings.appearance'])]) + ); + const singleRun = spawnSync( + process.execPath, + [SCRIPT_PATH, desktopOnlyOptWasm], + { encoding: 'utf8' } + ); + assert.equal(singleRun.status, 0, singleRun.stderr); + assert.match(singleRun.stdout, /260\/260 prefixes at 0/); + assert.match(singleRun.stdout, /affine_desktop_bg\.opt\.wasm/); + } finally { + rmSync(dir, { recursive: true, force: true }); + } +}); diff --git a/packages/frontend/scripts/web-smoke.mjs b/packages/frontend/scripts/web-smoke.mjs new file mode 100755 index 0000000000..e73836c581 --- /dev/null +++ b/packages/frontend/scripts/web-smoke.mjs @@ -0,0 +1,788 @@ +#!/usr/bin/env node +/** + * Self-contained headless Chromium WebAssembly smoke test (zero npm dependencies). + * + * Serves `web/` over localhost, launches headless Chromium via CDP with SwiftShader + * WebGL2 enabled, and asserts: + * 1. Zero uncaught JS exceptions / Wasm panics. + * 2. Non-blank rendered `` containing actual dark ink glyph pixels inside + * the title and mode-switcher pill regions. + * 3. Clicking the `"Edgeless"` button on the `` triggers an observable + * visual state transition to Edgeless mode. + * + * `--query ` loads the page with a query string (for example a live room, + * `room=&ws=`), and `--min-title-ink ` raises the amount of ink + * the title/body region must show before the page is captured, so a page that arrives + * over the network is captured after it rendered. + */ + +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import http from 'node:http'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import zlib from 'node:zlib'; + +import { measureSurfaceBaselines } from '../../../blocksuite/crates/oracle/surface-baselines.mjs'; +import { + closeBrowserResources, + createChromiumHarness, + openPageTarget, + SWIFTSHADER_OPTIONS, +} from '../hosts/web/scripts/chromium-harness.mjs'; + +const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url)); +const ROOT = path.resolve(SCRIPT_DIR, '..'); +const REPO_ROOT = path.resolve(ROOT, '../..'); +const WEB_DIR = path.join(REPO_ROOT, 'blocksuite/crates/playground/web'); +const ORACLE_DIR = path.join(REPO_ROOT, 'blocksuite/crates/oracle'); +// `web/index.html` fetches the tracked `ui-tokens` and Source Serif 4 fonts from `assets/fonts/`. +const FONT_DIRS = [ + path.join(REPO_ROOT, 'packages/ui/tokens/fonts'), + path.join(REPO_ROOT, 'packages/frontend/component/src/fonts/source-serif-4'), +]; +const FONT_FILES = new Map( + FONT_DIRS.flatMap(dir => + fs + .readdirSync(dir, { recursive: true }) + .filter(rel => rel.endsWith('.ttf')) + .map(rel => [path.basename(rel), path.join(dir, rel)]) + ) +); + +function parseArgs(argv) { + const args = { + outPage: path.join(ROOT, 'artifacts', 'wasm-chromium.png'), + outEdgeless: path.join(ROOT, 'artifacts', 'wasm-chromium-edgeless.png'), + // Query string appended to the page URL, e.g. `room=&ws=`. + query: '', + // Dark ink pixels required in the title/body region before the page is captured. + minTitleInk: 200, + }; + for (let i = 2; i < argv.length; i += 1) { + if (argv[i] === '--out' && argv[i + 1]) { + args.outPage = path.resolve(argv[++i]); + } else if (argv[i] === '--out-edgeless' && argv[i + 1]) { + args.outEdgeless = path.resolve(argv[++i]); + } else if (argv[i] === '--query' && argv[i + 1]) { + args.query = argv[++i].replace(/^\?/, ''); + } else if (argv[i] === '--min-title-ink' && argv[i + 1]) { + args.minTitleInk = Number(argv[++i]); + if (!Number.isFinite(args.minTitleInk) || args.minTitleInk < 0) { + throw new Error('--min-title-ink requires a non-negative number'); + } + } + } + return args; +} + +function mimeType(filePath) { + if (filePath.endsWith('.html')) return 'text/html; charset=utf-8'; + if (filePath.endsWith('.js') || filePath.endsWith('.mjs')) + return 'application/javascript; charset=utf-8'; + if (filePath.endsWith('.wasm')) return 'application/wasm'; + if (filePath.endsWith('.css')) return 'text/css; charset=utf-8'; + return 'application/octet-stream'; +} + +function createStaticServer(dir) { + return http.createServer((req, res) => { + const urlPath = (req.url || '/').split('?')[0]; + const rel = urlPath === '/' ? 'index.html' : urlPath.replace(/^\/+/, ''); + const fontFile = rel.startsWith('assets/fonts/') + ? FONT_FILES.get(decodeURIComponent(rel.slice('assets/fonts/'.length))) + : undefined; + const abs = fontFile ?? path.resolve(dir, rel); + if ( + (!fontFile && !abs.startsWith(dir)) || + !fs.existsSync(abs) || + fs.statSync(abs).isDirectory() + ) { + res.writeHead(404); + res.end('Not found'); + return; + } + res.writeHead(200, { + 'Content-Type': mimeType(abs), + 'Cache-Control': 'no-store', + }); + fs.createReadStream(abs).pipe(res); + }); +} + +function decodePngRgba(buf) { + const sig = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]); + if (!buf.subarray(0, 8).equals(sig)) throw new Error('Invalid PNG signature'); + let offset = 8; + let width = 0; + let height = 0; + let bitDepth = 0; + let colorType = 0; + const idatChunks = []; + while (offset < buf.length) { + const len = buf.readUInt32BE(offset); + const type = buf.subarray(offset + 4, offset + 8).toString('ascii'); + const data = buf.subarray(offset + 8, offset + 8 + len); + offset += 12 + len; + if (type === 'IHDR') { + width = data.readUInt32BE(0); + height = data.readUInt32BE(4); + bitDepth = data[8]; + colorType = data[9]; + } else if (type === 'IDAT') { + idatChunks.push(data); + } else if (type === 'IEND') { + break; + } + } + if (bitDepth !== 8 || (colorType !== 6 && colorType !== 2)) { + throw new Error( + `Unsupported PNG format: bitDepth=${bitDepth}, colorType=${colorType}` + ); + } + const bpp = colorType === 6 ? 4 : 3; + const raw = zlib.inflateSync(Buffer.concat(idatChunks)); + const stride = width * bpp; + const rgba = new Uint8Array(width * height * 4); + const prevRow = new Uint8Array(stride); + const curRow = new Uint8Array(stride); + + function paeth(a, b, c) { + const p = a + b - c; + const pa = Math.abs(p - a); + const pb = Math.abs(p - b); + const pc = Math.abs(p - c); + return pa <= pb && pa <= pc ? a : pb <= pc ? b : c; + } + + for (let y = 0; y < height; y += 1) { + const filter = raw[y * (stride + 1)]; + const rowStart = y * (stride + 1) + 1; + for (let i = 0; i < stride; i += 1) { + const x = raw[rowStart + i]; + const a = i >= bpp ? curRow[i - bpp] : 0; + const b = prevRow[i]; + const c = i >= bpp ? prevRow[i - bpp] : 0; + let val = x; + if (filter === 1) val = (x + a) & 0xff; + else if (filter === 2) val = (x + b) & 0xff; + else if (filter === 3) val = (x + ((a + b) >> 1)) & 0xff; + else if (filter === 4) val = (x + paeth(a, b, c)) & 0xff; + curRow[i] = val; + } + for (let x = 0; x < width; x += 1) { + const dst = (y * width + x) * 4; + const src = x * bpp; + rgba[dst] = curRow[src]; + rgba[dst + 1] = curRow[src + 1]; + rgba[dst + 2] = curRow[src + 2]; + rgba[dst + 3] = bpp === 4 ? curRow[src + 3] : 255; + } + prevRow.set(curRow); + } + return { width, height, rgba }; +} + +function countDarkInkPixels(img, x0, y0, x1, y1) { + let dark = 0; + const minX = Math.max(0, Math.floor(x0)); + const minY = Math.max(0, Math.floor(y0)); + const maxX = Math.min(img.width, Math.ceil(x1)); + const maxY = Math.min(img.height, Math.ceil(y1)); + for (let y = minY; y < maxY; y += 1) { + for (let x = minX; x < maxX; x += 1) { + const idx = (y * img.width + x) * 4; + const r = img.rgba[idx]; + const g = img.rgba[idx + 1]; + const b = img.rgba[idx + 2]; + if (r < 140 && g < 140 && b < 140) dark += 1; + } + } + return dark; +} + +function countDifferentPixels(a, b) { + if (a.width !== b.width || a.height !== b.height) return Infinity; + let diff = 0; + for (let i = 0; i < a.rgba.length; i += 4) { + if ( + Math.abs(a.rgba[i] - b.rgba[i]) > 4 || + Math.abs(a.rgba[i + 1] - b.rgba[i + 1]) > 4 || + Math.abs(a.rgba[i + 2] - b.rgba[i + 2]) > 4 + ) { + diff += 1; + } + } + return diff; +} + +function sleep(ms) { + return new Promise(r => setTimeout(r, ms)); +} + +class CdpClient { + constructor(wsUrl) { + this.ws = new WebSocket(wsUrl); + this.nextId = 1; + this.pending = new Map(); + this.listeners = new Map(); + this.ready = new Promise((resolve, reject) => { + this.ws.addEventListener('open', resolve); + this.ws.addEventListener('error', reject); + }); + this.ws.addEventListener('message', event => { + const msg = JSON.parse(event.data); + if (msg.id) { + const entry = this.pending.get(msg.id); + if (entry) { + this.pending.delete(msg.id); + if (msg.error) + entry.reject(new Error(entry.method + ': ' + msg.error.message)); + else entry.resolve(msg.result); + } + } else if (msg.method) { + const list = this.listeners.get(msg.method) || []; + for (const fn of list) fn(msg.params); + } + }); + } + + on(method, fn) { + const list = this.listeners.get(method) || []; + list.push(fn); + this.listeners.set(method, list); + } + + async send(method, params = {}) { + await this.ready; + const id = this.nextId++; + return new Promise((resolve, reject) => { + this.pending.set(id, { method, resolve, reject }); + this.ws.send(JSON.stringify({ id, method, params })); + }); + } + + close() { + this.ws.close(); + } +} + +// Drive the page the way a person's pointer, keyboard and IME do, and read back the hidden +// textarea the browser's text input works on. +function inputProbe(cdp) { + async function evaluate(expression) { + const reply = await cdp.send('Runtime.evaluate', { + expression, + awaitPromise: true, + returnByValue: true, + }); + if (reply.exceptionDetails) + throw new Error(reply.exceptionDetails.exception?.description); + return reply.result.value; + } + const mirror = () => + evaluate( + "Array.from(document.querySelectorAll('textarea')).map(t=>({value:t.value,offset:t.selectionStart,end:t.selectionEnd}))[0]" + ); + const mouse = (type, [x, y], buttons) => + cdp.send('Input.dispatchMouseEvent', { + type, + x, + y, + button: type === 'mouseMoved' ? 'none' : 'left', + buttons, + clickCount: 1, + }); + const click = async point => { + await mouse('mousePressed', point, 1); + await mouse('mouseReleased', point, 0); + await sleep(100); + return mirror(); + }; + const waitValue = async value => { + let state; + for (let i = 0; i < 40; i++) { + state = await mirror(); + if (state.value === value) return; + await sleep(50); + } + const screenshot = path.join(ROOT, 'artifacts', 'web-smoke-failure.png'); + fs.mkdirSync(path.dirname(screenshot), { recursive: true }); + const shot = await cdp.send('Page.captureScreenshot', { format: 'png' }); + const png = Buffer.from(shot.data, 'base64'); + fs.writeFileSync(screenshot, png); + const toolbar = await evaluate(`({ focus: document.activeElement?.tagName, + readOnly: document.querySelector('textarea')?.readOnly, atLink: document.elementFromPoint(426,216)?.tagName })`); + toolbar.darkPixels = countDarkInkPixels( + decodePngRgba(png), + 175, + 185, + 560, + 243 + ); + console.error({ screenshot, mirror: state, toolbar }); + throw new Error( + `Expected mirrored text ${JSON.stringify(value)}, got ${JSON.stringify(state)}` + ); + }; + const composition = (type, data) => + evaluate( + `document.querySelector('textarea').dispatchEvent(new CompositionEvent(${JSON.stringify(type)},{bubbles:true,data:${JSON.stringify(data)}}))` + ); + // `modifiers: 2` is Control, the command modifier outside macOS. + const key = async (key, code, windowsVirtualKeyCode, modifiers = 0) => { + for (const type of ['rawKeyDown', 'keyUp']) { + await cdp.send('Input.dispatchKeyEvent', { + type, + key, + code, + modifiers, + windowsVirtualKeyCode, + }); + } + }; + return { evaluate, mirror, mouse, click, waitValue, composition, key }; +} + +// Exercise the browser input handler through the same hidden textarea a platform IME uses. +async function checkComposition(cdp) { + const { mouse, click, waitValue, composition, key } = inputProbe(cdp); + const undo = () => key('z', 'KeyZ', 90, 2); + const first = [314, 215], + second = [331, 254]; + const start = await click(first), + end = await click(second); + if (start.value !== 'Page mode' || !end.value.startsWith('This page')) { + throw new Error( + `Unable to select the two showcase blocks: ${JSON.stringify([start, end])}` + ); + } + for (const reverse of [false, true]) { + const a = reverse ? second : first, + b = reverse ? first : second; + const original = reverse ? start : end; + await mouse('mousePressed', a, 1); + await mouse('mouseMoved', b, 1); + await mouse('mouseReleased', b, 0); + await waitValue(original.value); + await composition('compositionstart', ''); + await composition('compositionupdate', 'ni'); + await sleep(75); + await composition('compositionend', ''); + await waitValue(original.value); + // Cancellation must restore the directional document range for the next IME. + await composition('compositionstart', ''); + await composition('compositionupdate', 'nihao'); + await sleep(75); + await composition('compositionend', '你好'); + const joined = token => + start.value.slice(0, start.offset) + token + end.value.slice(end.offset); + await waitValue(joined('你好')); + await undo(); + await waitValue(original.value); + await cdp.send('Input.insertText', { text: 'Z' }); + await waitValue(joined('Z')); + await undo(); + await waitValue(original.value); + } + console.log( + 'Forward and backward cross-block typing, IME cancellation, commit and undo passed' + ); +} + +// The formatting toolbar's link field is the text input while it is open: composition +// and paste go into the field, and the paragraph under the selection stays as it was. +async function checkLinkField(cdp) { + const { evaluate, mirror, mouse, waitValue, composition, key } = + inputProbe(cdp); + // A few words on the first line of the second showcase block. + const from = [331, 254], + to = [400, 254]; + await evaluate( + 'new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)))' + ); + await mouse('mousePressed', from, 1); + await mouse('mouseMoved', to, 1); + await mouse('mouseReleased', to, 0); + await evaluate( + 'new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)))' + ); + await sleep(100); + const paragraph = await mirror(); + if (!(paragraph.end > paragraph.offset + 3)) { + throw new Error( + `Link toolbar drag selected fewer than four characters: ${JSON.stringify(paragraph)}` + ); + } + if (!paragraph.value.startsWith('This page')) { + throw new Error( + `Unable to select in the second showcase block: ${JSON.stringify(paragraph)}` + ); + } + // A selection in one paragraph shows a 462 px toolbar without Create Table. + // It sits 10 px above the selected line and is 37 px tall. + // The Link button center is 299 px from the left edge and 18 px from the top. + const midX = (from[0] + to[0]) / 2; + const link = [midX - 462 / 2 + 299, 243 - 10 - 37 + 18]; + await mouse('mouseMoved', link, 0); + await mouse('mousePressed', link, 1); + await mouse('mouseReleased', link, 0); + await waitValue(''); + + // A composition that is cancelled leaves the field empty; one that commits lands once. + await composition('compositionstart', ''); + await composition('compositionupdate', 'ni'); + await sleep(75); + await composition('compositionend', ''); + await waitValue(''); + await composition('compositionstart', ''); + await composition('compositionupdate', 'nihao'); + await sleep(75); + await composition('compositionend', '你好'); + await waitValue('你好'); + + // The paste key keeps its default action, so the browser follows it with a `paste` + // event, and that event's text goes into the field. + await evaluate(`window.__pasteKeyPrevented = null; + window.addEventListener('keydown', e => { + if (e.key === 'v' && e.ctrlKey) window.__pasteKeyPrevented = e.defaultPrevented; + })`); + await key('v', 'KeyV', 86, 2); + const prevented = await evaluate('window.__pasteKeyPrevented'); + if (prevented !== false) { + throw new Error( + `Ctrl+V in the link field must keep its default action, defaultPrevented=${prevented}` + ); + } + const ignored = await evaluate(`(() => { + const data = new DataTransfer(); + data.setData('text/plain', '.affine.pro'); + return document.querySelector('textarea').dispatchEvent( + new ClipboardEvent('paste', { bubbles: true, cancelable: true, clipboardData: data })); + })()`); + if (ignored) + throw new Error('The paste event was not taken by the link field'); + await waitValue('你好.affine.pro'); + + // Dual-field LinkBar: clicking the Text row mirrors the selected paragraph slice, and + // clicking back to the URL row restores focus to the typed/pasted URL. + const selectedSlice = paragraph.value.slice(paragraph.offset, paragraph.end); + // With both fields open the toolbar is 100 px tall: the Text row starts 37 px and the + // URL row 65 px below its top edge, and each row is 28 px tall. + const textFieldPt = [midX, 243 - 10 - 100 + 37 + 14]; + await mouse('mouseMoved', textFieldPt, 0); + await mouse('mousePressed', textFieldPt, 1); + await mouse('mouseReleased', textFieldPt, 0); + await waitValue(selectedSlice); + const urlFieldPt = [midX - 40, 243 - 10 - 100 + 65 + 14]; + await mouse('mouseMoved', urlFieldPt, 0); + await mouse('mousePressed', urlFieldPt, 1); + await mouse('mouseReleased', urlFieldPt, 0); + await waitValue('你好.affine.pro'); + + // Closing the field hands the text input back to the paragraph, untouched. + await key('Escape', 'Escape', 27); + await waitValue(paragraph.value); + console.log( + 'Link field composition, paste and dismissal left the paragraph untouched' + ); +} + +async function main() { + const args = parseArgs(process.argv); + const pkgJs = path.join(WEB_DIR, 'pkg', 'playground.js'); + if (!fs.existsSync(pkgJs)) { + throw new Error(`Missing wasm-bindgen output at ${pkgJs}`); + } + + let harness; + let server; + let cdp; + const errors = []; + const consoleLogs = []; + try { + harness = createChromiumHarness({ tmpPrefix: 'affine-web-smoke-' }); + server = createStaticServer(WEB_DIR); + await new Promise((ok, fail) => { + server.once('error', fail); + server.listen(0, '127.0.0.1', ok); + }); + const { port } = server.address(); + const browserPort = await harness.launchChromium(SWIFTSHADER_OPTIONS); + const attachPage = async target => { + cdp?.close(); + cdp = new CdpClient(target.webSocketDebuggerUrl); + await cdp.send('Page.enable'); + await cdp.send('Runtime.enable'); + await cdp.send('Emulation.setDeviceMetricsOverride', { + width: 1280, + height: 800, + deviceScaleFactor: 1, + mobile: false, + }); + + cdp.on('Runtime.exceptionThrown', params => { + const desc = + params?.exceptionDetails?.exception?.description || + params?.exceptionDetails?.text || + 'exception'; + errors.push(`Runtime.exceptionThrown: ${desc}`); + }); + cdp.on('Runtime.consoleAPICalled', params => { + const text = (params.args || []) + .map(a => a.value ?? a.description ?? '') + .join(' '); + consoleLogs.push(`[console.${params.type}] ${text}`); + if (params.type === 'error') { + errors.push(`console.error: ${text}`); + } + }); + + await cdp.send('Emulation.setFocusEmulationEnabled', { enabled: true }); + await cdp.send('Page.bringToFront'); + }; + await attachPage(await openPageTarget(browserPort)); + const pageUrl = `http://127.0.0.1:${port}/${args.query ? `?${args.query}` : ''}`; + const navigateToCanvas = async url => { + await cdp.send('Page.navigate', { url }); + + // Wait for wasm init + graphics init + ResizeObserver sizing canvas to 1280x800 + let ready = false; + let lastState = null; + for (let i = 0; i < 80; i += 1) { + const evalRes = await cdp.send('Runtime.evaluate', { + expression: `JSON.stringify({ + ready: Boolean(window.__playgroundReady), + err: window.__playgroundError, + bodyText: (document.body && document.body.innerText || '').trim(), + inputMounted: Boolean(document.querySelector('textarea')), + canvasCount: document.querySelectorAll('canvas').length, + canvasRect: (() => { + const c = document.querySelector('canvas'); + if (!c) return null; + const r = c.getBoundingClientRect(); + return { w: r.width, h: r.height, cw: c.width, ch: c.height }; + })() + })`, + returnByValue: true, + }); + const state = JSON.parse(evalRes.result.value); + lastState = state; + if (state.err) throw new Error(`Wasm init error: ${state.err}`); + if (state.bodyText && state.bodyText.length > 0) { + throw new Error( + `Browser page reported error text: ${state.bodyText}\nLogs: ${consoleLogs.join('\n')}` + ); + } + if ( + state.ready && + state.inputMounted && + state.canvasCount > 0 && + state.canvasRect && + state.canvasRect.cw >= 1200 && + state.canvasRect.ch >= 700 + ) { + ready = true; + break; + } + await sleep(250); + } + if (!ready) { + throw new Error( + `Timed out waiting for Wasm canvas to mount at 1280x800. lastState=${JSON.stringify(lastState)} Errors=${errors.join('; ')} Logs=${consoleLogs.join(' | ')}` + ); + } + + return lastState; + }; + const lastState = await navigateToCanvas(pageUrl); + + // Wait for SwiftShader WebGL2 first frame paint (compile + draw can take >1s) + let png1 = null; + let img1 = null; + let pillDark = 0; + let titleDark = 0; + for (let attempt = 0; attempt < 40; attempt += 1) { + await sleep(300); + const shot1 = await cdp.send('Page.captureScreenshot', { format: 'png' }); + png1 = Buffer.from(shot1.data, 'base64'); + img1 = decodePngRgba(png1); + pillDark = countDarkInkPixels(img1, 547, 8, 733, 44); + titleDark = countDarkInkPixels(img1, 168, 100, 900, 260); + if (pillDark >= 40 && titleDark >= args.minTitleInk) { + break; + } + } + fs.mkdirSync(path.dirname(args.outPage), { recursive: true }); + fs.writeFileSync(args.outPage, png1); + + // Assert actual dark ink glyph pixels exist in the mode pill and title regions + console.log( + `Web Wasm Page render: ${img1.width}x${img1.height}, pillDarkPx=${pillDark}, titleDarkPx=${titleDark}` + ); + if (pillDark < 40) { + throw new Error( + `Expected rendered glyph pixels inside mode-switcher pill (>=40), got ${pillDark}. state=${JSON.stringify(lastState)} logs=${consoleLogs.join(' | ')}` + ); + } + if (titleDark < args.minTitleInk) { + throw new Error( + `Expected rendered glyph pixels inside title/body region (>=${args.minTitleInk}), got ${titleDark}. state=${JSON.stringify(lastState)} logs=${consoleLogs.join(' | ')}` + ); + } + + if (!args.query) { + await checkComposition(cdp); + await checkLinkField(cdp); + const baselines = await measureSurfaceBaselines(inputProbe(cdp).evaluate); + assert.deepEqual( + baselines, + JSON.parse( + fs.readFileSync( + path.join(ORACLE_DIR, 'surface-baselines.json'), + 'utf8' + ) + ) + ); + console.log('Chromium DOM and Canvas surface label baselines passed'); + } + + // Click "Edgeless" segment (pill centered at x=640, w=186 -> pill_x=547; edgeless x=548+94..548+180 -> center=685, y=26) + const clickX = 685; + const clickY = 26; + await cdp.send('Input.dispatchMouseEvent', { + type: 'mouseMoved', + x: clickX, + y: clickY, + button: 'none', + }); + await cdp.send('Input.dispatchMouseEvent', { + type: 'mousePressed', + x: clickX, + y: clickY, + button: 'left', + clickCount: 1, + }); + await cdp.send('Input.dispatchMouseEvent', { + type: 'mouseReleased', + x: clickX, + y: clickY, + button: 'left', + clickCount: 1, + }); + await sleep(600); + + const shot2 = await cdp.send('Page.captureScreenshot', { format: 'png' }); + const png2 = Buffer.from(shot2.data, 'base64'); + fs.mkdirSync(path.dirname(args.outEdgeless), { recursive: true }); + fs.writeFileSync(args.outEdgeless, png2); + const img2 = decodePngRgba(png2); + + const diffPx = countDifferentPixels(img1, img2); + console.log(`Web Wasm Edgeless click diffPixels=${diffPx}`); + if (diffPx < 5000) { + throw new Error( + `Clicking Edgeless did not produce expected visual transition (diffPixels=${diffPx})` + ); + } + const edgelessInk = countDarkInkPixels(img2, 40, 80, 1240, 760); + console.log(`Web Wasm Edgeless canvas ink=${edgelessInk}`); + if (edgelessInk < 500) { + throw new Error( + `Expected non-trivial Edgeless canvas ink (>=500), got ${edgelessInk}` + ); + } + + if (!args.query) { + // Exercise Edgeless bottom creation toolbar: select Shape tool (`s`) and drag a new shape on canvas. + await cdp.send('Input.dispatchMouseEvent', { + type: 'mousePressed', + x: 640, + y: 400, + button: 'left', + clickCount: 1, + }); + await cdp.send('Input.dispatchMouseEvent', { + type: 'mouseReleased', + x: 640, + y: 400, + button: 'left', + clickCount: 1, + }); + await sleep(100); + for (const type of ['rawKeyDown', 'keyUp']) { + await cdp.send('Input.dispatchKeyEvent', { + type, + key: 's', + code: 'KeyS', + windowsVirtualKeyCode: 83, + }); + } + await sleep(100); + await cdp.send('Input.dispatchMouseEvent', { + type: 'mousePressed', + x: 520, + y: 300, + button: 'left', + clickCount: 1, + }); + await cdp.send('Input.dispatchMouseEvent', { + type: 'mouseMoved', + x: 680, + y: 400, + button: 'left', + buttons: 1, + }); + await cdp.send('Input.dispatchMouseEvent', { + type: 'mouseReleased', + x: 680, + y: 400, + button: 'left', + clickCount: 1, + }); + await sleep(300); + const shotShape = await cdp.send('Page.captureScreenshot', { + format: 'png', + }); + const imgShape = decodePngRgba(Buffer.from(shotShape.data, 'base64')); + const shapeDiff = countDifferentPixels(img2, imgShape); + console.log(`Web Wasm Edgeless shape creation diffPixels=${shapeDiff}`); + if (shapeDiff < 100) { + throw new Error( + `Edgeless shape creation produced insufficient visual change (${shapeDiff})` + ); + } + + // Also verify direct `?mode=edgeless` cold load without WebGL2/WebGPU shader errors. + // A fresh target has no renderer or CDP state from the edited page. + await attachPage(await openPageTarget(browserPort)); + await navigateToCanvas(`http://127.0.0.1:${port}/?mode=edgeless`); + await inputProbe(cdp).evaluate(`new Promise(resolve => { + requestAnimationFrame(() => requestAnimationFrame(() => resolve(true))); + })`); + const shot3 = await cdp.send('Page.captureScreenshot', { format: 'png' }); + const img3 = decodePngRgba(Buffer.from(shot3.data, 'base64')); + const edgelessDirectInk = countDarkInkPixels(img3, 40, 80, 1240, 760); + console.log(`Web Wasm direct ?mode=edgeless ink=${edgelessDirectInk}`); + if (edgelessDirectInk < 500) { + throw new Error( + `Direct ?mode=edgeless rendered insufficient ink (${edgelessDirectInk})` + ); + } + } + if (errors.length > 0) { + throw new Error( + `Uncaught browser errors during Wasm smoke test:\n${errors.join('\n')}` + ); + } + + console.log('Web Wasm Chromium smoke test PASSED.'); + } finally { + await closeBrowserResources(harness, cdp, server); + } +} + +main().catch(err => { + console.error(err); + process.exit(1); +}); diff --git a/scripts/ci/check-csf-frame-audit.mjs b/scripts/ci/check-csf-frame-audit.mjs new file mode 100644 index 0000000000..32b91bfaf2 --- /dev/null +++ b/scripts/ci/check-csf-frame-audit.mjs @@ -0,0 +1,315 @@ +#!/usr/bin/env node +// Zero-backend CSF geometry gate. Bundles the Frame Audit stories, lays them +// out in headless Chrome, and audits each frame with the Rust `frame-audit` +// engine. Every story must have no violations, and each corrupted copy of a +// real frame must report exactly the violations it was built to cause. +// +// node scripts/ci/check-csf-frame-audit.mjs +// +// The browser is $CHROME_BIN, or google-chrome / chromium from PATH. + +import { spawnSync } from 'node:child_process'; +import { + existsSync, + mkdirSync, + readFileSync, + rmSync, + writeFileSync, +} from 'node:fs'; +import { delimiter, extname, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import { chromium } from '@playwright/test'; +import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin'; +import swc from 'unplugin-swc'; +import { build } from 'vite'; + +const ROOT = fileURLToPath(new URL('../..', import.meta.url)); +const COMPONENT = join(ROOT, 'packages/frontend/component'); +const OUT = join(ROOT, '.artifacts/csf-frame-audit'); +const ORIGIN = 'http://frame-audit.invalid'; +const REQUIRED_STORIES = 7; + +const MIME = { + '.js': 'text/javascript', + '.css': 'text/css', + '.woff2': 'font/woff2', + '.avif': 'image/avif', +}; + +function findChrome() { + if (process.env.CHROME_BIN) return process.env.CHROME_BIN; + for (const dir of (process.env.PATH ?? '').split(delimiter)) { + for (const name of ['google-chrome', 'chromium']) { + if (existsSync(join(dir, name))) return join(dir, name); + } + } + throw new Error('no Chrome found: set CHROME_BIN'); +} + +async function bundleStories() { + rmSync(OUT, { recursive: true, force: true }); + mkdirSync(OUT, { recursive: true }); + await build({ + configFile: false, + root: COMPONENT, + logLevel: 'error', + define: { 'process.env.NODE_ENV': '"production"' }, + plugins: [ + vanillaExtractPlugin(), + swc.vite({ + jsc: { + parser: { syntax: 'typescript', tsx: true, decorators: true }, + target: 'es2022', + transform: { + react: { runtime: 'automatic' }, + useDefineForClassFields: false, + decoratorVersion: '2022-03', + }, + }, + }), + ], + build: { + outDir: OUT, + emptyOutDir: false, + minify: false, + cssCodeSplit: false, + rollupOptions: { + input: join(COMPONENT, 'src/ui/frame-audit/harness.tsx'), + output: { + format: 'es', + inlineDynamicImports: true, + entryFileNames: 'harness.js', + assetFileNames: '[name][extname]', + }, + }, + }, + }); +} + +async function captureFrames() { + const browser = await chromium.launch({ + executablePath: findChrome(), + args: ['--no-sandbox', '--font-render-hinting=none'], + }); + try { + const page = await browser.newPage({ + viewport: { width: 800, height: 600 }, + deviceScaleFactor: 1, + }); + const errors = []; + page.on('pageerror', error => errors.push(error.message)); + // Every request is answered from the bundle; nothing leaves the process. + await page.route('**/*', route => { + const { origin, pathname } = new URL(route.request().url()); + if (origin !== ORIGIN) return route.abort(); + if (pathname === '/') { + return route.fulfill({ + contentType: 'text/html', + body: ` + + + + + `, + }); + } + const file = join(OUT, pathname); + if (!existsSync(file)) return route.fulfill({ status: 404, body: '' }); + return route.fulfill({ + contentType: MIME[extname(file)] ?? 'application/octet-stream', + body: readFileSync(file), + }); + }); + await page.goto(`${ORIGIN}/`); + await page.waitForFunction(() => 'captureFrameAuditStories' in window); + const captured = await page.evaluate( + cases => window.captureFrameAuditStories(cases), + DOM_CASES + ); + if (errors.length) throw new Error(`page errors: ${errors.join('; ')}`); + return captured; + } finally { + await browser.close(); + } +} + +function audit(frames) { + const input = join(OUT, 'frames.json'); + writeFileSync(input, JSON.stringify(frames)); + const result = spawnSync( + 'cargo', + [ + 'run', + '--locked', + '--quiet', + '--manifest-path', + 'tools/frame-audit/Cargo.toml', + '--bin', + 'audit-frames', + '--', + '--frames', + input, + ], + { + cwd: ROOT, + encoding: 'utf8', + maxBuffer: 64 * 1024 * 1024, + env: { ...process.env, CARGO_ENCODED_RUSTFLAGS: '' }, + } + ); + if (result.status !== 0) { + throw new Error(`frame-audit audit-frames failed:\n${result.stderr}`); + } + return JSON.parse(result.stdout); +} + +const NEGATIVE_CASES = [ + { + name: 'button pushed past its clip', + story: 'DialogFooter', + corrupt: f => { + f.elements['dialog.cancel'].bounds.x = 200; + }, + expected: [['parent-clip-fault', 'dialog.cancel']], + }, + { + name: 'icon centered on the whole text block', + story: 'FirstLineBaseline', + corrupt: f => { + f.elements['row.icon'].bounds.y += 12; + }, + expected: [['first-line-baseline', 'row.icon']], + }, + { + name: 'footer wraps the primary action upward', + story: 'DialogFooter', + corrupt: f => { + const { 'dialog.confirm': a, 'dialog.cancel': b } = f.elements; + [a.bounds.y, b.bounds.y] = [b.bounds.y, a.bounds.y]; + }, + expected: [['footer-reverse-wrap', 'dialog.confirm']], + }, + { + name: 'inner radius above the concentric limit', + story: 'NestedRadii', + corrupt: f => { + f.elements['card.inner'].corner_radius = 16; + }, + expected: [['concentric-corner-radius', 'card.inner']], + }, + { + name: 'double divider after a hidden row', + story: 'DividedList', + corrupt: f => { + f.elements['list.b'].opacity = 0; + }, + expected: [['divider-placement', 'list.divider-c']], + }, + { + name: 'dangling divider after the last row', + story: 'DividedList', + corrupt: f => { + f.elements['list.c'].opacity = 0; + }, + expected: [['divider-placement', 'list.divider-c']], + }, + { + name: 'invisible button still takes the pointer', + story: 'NarrowContainer', + corrupt: f => { + f.elements['narrow.action'].opacity = 0; + }, + expected: [['zero-opacity-hit-through', 'narrow.action']], + }, + { + name: 'page content above the overlay', + story: 'FloatingOverlay', + corrupt: f => { + for (const probe of f.hit_probes) probe.receiver = 'page.action'; + }, + expected: [['overlay-z-order', 'menu']], + }, +]; + +// Applied to the rendered element in the browser, then captured again. +const DOM_CASES = [ + { + name: 'ellipsis degraded to clip', + story: 'NarrowContainer', + element: 'narrow.name', + style: { textOverflow: 'clip' }, + expected: [['text-truncation', 'narrow.name']], + }, + { + name: 'fractional cell moved past its clip', + story: 'FractionalThirds', + element: 'thirds.c', + style: { transform: 'translateX(400px)' }, + expected: [['parent-clip-fault', 'thirds.c']], + }, +]; + +const keyOf = ([rule, element]) => `${rule} @ ${element}`; +const keys = list => [...new Set(list.map(keyOf))].sort(); + +await bundleStories(); +const { frames, domFrames } = await captureFrames(); +const names = Object.keys(frames); +const problems = []; +if (names.length < REQUIRED_STORIES) { + problems.push(`only ${names.length} stories captured`); +} +for (const [name, frame] of Object.entries(frames)) { + if (Object.keys(frame.elements).length < 2) { + problems.push(`${name}: no audited elements were captured`); + } +} + +// 470px in three cells only stays gap-free when each edge is snapped alone. +const thirds = ['a', 'b', 'c'].map( + cell => frames.FractionalThirds.elements[`thirds.${cell}`].bounds.width +); +if ( + thirds.reduce((sum, width) => sum + width) !== 470 || + new Set(thirds).size < 2 +) { + problems.push(`FractionalThirds: unexpected widths ${thirds.join(', ')}`); +} + +const inputs = { ...frames }; +for (const { name } of DOM_CASES) { + inputs[`negative: ${name}`] = domFrames[name]; +} +for (const { name, story, corrupt } of NEGATIVE_CASES) { + const copy = structuredClone(frames[story]); + corrupt(copy); + inputs[`negative: ${name}`] = copy; +} +const report = audit(inputs); + +for (const name of names) { + for (const v of report[name]) { + problems.push(`${name}: ${v.rule} @ ${v.element_id}: ${v.message}`); + } +} +for (const { name, expected } of [...NEGATIVE_CASES, ...DOM_CASES]) { + const found = keys( + report[`negative: ${name}`].map(v => [v.rule, v.element_id]) + ); + const want = keys(expected); + if (found.join('\n') !== want.join('\n')) { + problems.push( + `negative "${name}": expected [${want.join(', ')}], got [${found.join(', ')}]` + ); + } +} + +if (problems.length) { + console.error(problems.join('\n')); + console.error(`CSF frame audit: ${problems.length} problem(s)`); + process.exit(1); +} +console.log( + `CSF frame audit passed: ${names.length} stories clean, ${NEGATIVE_CASES.length + DOM_CASES.length} corrupted frames rejected` +); diff --git a/scripts/ci/check-l0-tier-a.mjs b/scripts/ci/check-l0-tier-a.mjs index 4ba96813e9..13360baf04 100644 --- a/scripts/ci/check-l0-tier-a.mjs +++ b/scripts/ci/check-l0-tier-a.mjs @@ -20,6 +20,10 @@ // 7. compat-backlog: every `// compat(): -- ` marker in // packages/backend/ production Rust has a `### ` entry in // docs/post-cutover-ablation-backlog.md, and every entry has a marker. +// 8. Directory classification: every first-level subdirectory under +// packages/frontend/, packages/common/, and blocksuite/ belongs to a known +// legacy Web set or a known Rust/client set, and native-playground.yml's +// web-build filter covers every legacy Web subdirectory. import { createHash } from 'node:crypto'; import { @@ -761,6 +765,184 @@ if (!existsSync(COMPAT_BACKLOG_PATH)) { } } +// 8. Top-level directory classification for web-build filter ---------------- + +const DOMAIN_CLASSIFICATION = { + 'packages/ui': { + legacyWeb: new Set([]), + newRust: new Set(['ui', 'kit', 'tokens']), + ignored: new Set(['node_modules']), + }, + 'packages/frontend': { + legacyWeb: new Set([ + 'admin', + 'apps', + 'component', + 'core', + 'electron-api', + 'i18n', + 'mobile-native', + 'native', + 'routes', + 'templates', + 'track', + ]), + newRust: new Set([ + 'client', + 'desktop', + 'hosts', + 'legacy-import', + 'mobile', + 'perf', + 'scripts', + ]), + ignored: new Set(['target', 'artifacts', 'node_modules']), + }, + 'packages/common': { + legacyWeb: new Set([ + 'auth', + 'debug', + 'env', + 'error', + 'graphql', + 'infra', + 'native', + 'nbstore', + 'reader', + 'realtime', + 's3-compat', + 'theme', + ]), + newRust: new Set(['store']), + ignored: new Set(['node_modules']), + }, + blocksuite: { + legacyWeb: new Set([ + 'affine', + 'docs', + 'docs-site', + 'framework', + 'integration-test', + 'playground', + ]), + newRust: new Set(['crates']), + ignored: new Set(['node_modules']), + }, +}; + +const WEB_BUILD_FIXED_ENTRIES = new Set([ + 'blocksuite/tsconfig.json', + 'tools/cli/**', + '**/package.json', + '**/tsconfig*.json', + 'yarn.lock', + '.yarnrc.yml', + '.yarn/**', + '.github/actions/setup-node/**', + '.github/workflows/np-web-build.yml', +]); + +const npWorkflowPath = join(WORKFLOWS, 'native-playground.yml'); +const npWorkflowText = existsSync(npWorkflowPath) ? read(npWorkflowPath) : ''; +const webBuildSectionMatch = /^\s*web-build:\n((?:\s+-\s+.*\n)+)/m.exec( + npWorkflowText +); +const webBuildEntries = new Set( + (webBuildSectionMatch?.[1] ?? '') + .split('\n') + .map(l => /^\s*-\s+['"]?([^'"]+?)['"]?\s*$/.exec(l)?.[1]) + .filter(Boolean) +); + +const expectedWebBuildEntries = new Set(WEB_BUILD_FIXED_ENTRIES); + +for (const [baseDir, sets] of Object.entries(DOMAIN_CLASSIFICATION)) { + const fullBase = join(ROOT, baseDir); + if (!existsSync(fullBase)) continue; + for (const entry of readdirSync(fullBase, { withFileTypes: true })) { + if (!entry.isDirectory()) continue; + const name = entry.name; + if (sets.ignored.has(name)) continue; + if (!sets.legacyWeb.has(name) && !sets.newRust.has(name)) { + fail( + 'dir-classification', + `${baseDir}/${name}: unclassified directory; add it to legacyWeb (and native-playground.yml web-build) or newRust in scripts/ci/check-l0-tier-a.mjs` + ); + } + } + for (const legacy of sets.legacyWeb) { + expectedWebBuildEntries.add(`${baseDir}/${legacy}/**`); + } +} + +for (const expected of expectedWebBuildEntries) { + if (!webBuildEntries.has(expected)) { + fail( + 'dir-classification', + `.github/workflows/native-playground.yml: web-build filter is missing ${expected}` + ); + } +} +for (const actual of webBuildEntries) { + if (!expectedWebBuildEntries.has(actual)) { + fail( + 'dir-classification', + `.github/workflows/native-playground.yml: web-build filter contains unexpected broad or unknown pattern ${actual}` + ); + } +} + +function globToRegExp(glob) { + let out = '^'; + for (let i = 0; i < glob.length; i += 1) { + if (glob.slice(i, i + 3) === '**/') { + out += '(?:.*/)?'; + i += 2; + } else if (glob.slice(i, i + 2) === '**') { + out += '.*'; + i += 1; + } else if (glob[i] === '*') { + out += '[^/]*'; + } else { + out += glob[i].replace(/[.+?^${}()|[\]\\]/g, '\\$&'); + } + } + return new RegExp(`${out}$`); +} + +const webBuildRegexes = [...webBuildEntries].map(globToRegExp); +const matchesWebBuild = paths => + paths.some(p => webBuildRegexes.some(re => re.test(p))); + +const WEB_BUILD_FILTER_CASES = [ + ['oracle-only', ['blocksuite/crates/oracle/style-oracle.json'], false], + [ + 'rust-only', + [ + 'packages/ui/ui/src/lib.rs', + 'packages/common/store/AGENTS.md', + 'blocksuite/crates/doc/src/lib.rs', + ], + false, + ], + ['legacy-ts', ['packages/frontend/core/src/index.ts'], true], + [ + 'mixed', + ['packages/ui/ui/src/lib.rs', 'packages/common/infra/src/index.ts'], + true, + ], +]; + +for (const [label, paths, expected] of WEB_BUILD_FILTER_CASES) { + const actual = matchesWebBuild(paths); + if (actual !== expected) { + fail( + 'dir-classification', + `web-build filter self-test "${label}" returned ${actual}, expected ${expected}` + ); + } +} + // --------------------------------------------------------------------------- const ms = Math.round(performance.now() - started); diff --git a/scripts/ci/classify-web-host-only.mjs b/scripts/ci/classify-web-host-only.mjs new file mode 100644 index 0000000000..45c8bb4ab2 --- /dev/null +++ b/scripts/ci/classify-web-host-only.mjs @@ -0,0 +1,458 @@ +#!/usr/bin/env node +// Classify changed paths for CI. + +import { execFileSync } from 'node:child_process'; +import { appendFileSync } from 'node:fs'; +import { pathToFileURL } from 'node:url'; + +export const ZERO_SHA = '0000000000000000000000000000000000000000'; + +export const TRUNK_REFS = Object.freeze( + new Set([ + 'darksky/np/mobile', + 'canary', + 'darksky/native-playground', + 'main', + 'refs/heads/darksky/np/mobile', + 'refs/heads/canary', + 'refs/heads/darksky/native-playground', + 'refs/heads/main', + ]) +); + +// Events that always run every lane, Apple jobs included. +const FULL_RUN_EVENTS = Object.freeze( + new Set(['pull_request', 'workflow_dispatch']) +); + +// A change under these paths runs the macOS and iOS jobs on topic branches. +const APPLE_PATH_PREFIXES = ['.cargo/']; + +const APPLE_PATHS = new Set([ + '.github/workflows/native-playground.yml', + '.github/workflows/np-mobile.yml', + 'packages/ui/ui/tests/metal_atlas_fence.rs', + 'scripts/ci/classify-web-host-only.mjs', + 'scripts/ci/classify-web-host-only.test.mjs', +]); + +const APPLE_SEGMENT_OR_MANIFEST_RE = + /(?:^|\/)(?:macos|ios|apple)\/|\.(?:swift|metal|m|mm)$|(?:^|\/)(?:Cargo\.toml|Cargo\.lock|build\.rs|rust-toolchain\.toml)$/; + +// Source text that compiles only for Apple targets. +export const APPLE_TARGET_CFG_RE = + /\btarget_os\s*=\s*"(?:macos|ios)"|\btarget_vendor\s*=\s*"apple"/; + +export function isAppleSpecificPath(filePath) { + return ( + APPLE_PATHS.has(filePath) || + APPLE_PATH_PREFIXES.some(prefix => filePath.startsWith(prefix)) || + APPLE_SEGMENT_OR_MANIFEST_RE.test(filePath) + ); +} + +export const WEB_HOST_ONLY_ALLOWLIST = Object.freeze( + new Set([ + 'packages/frontend/hosts/web/src/idb-storage.js', + 'packages/frontend/hosts/web/desktop/boot.js', + 'packages/frontend/hosts/web/desktop/start.js', + 'packages/frontend/hosts/web/desktop/index.html', + 'packages/frontend/hosts/web/tests/idb-storage.test.mjs', + 'packages/frontend/hosts/web/tests/desktop.test.mjs', + 'packages/frontend/hosts/web/tests/dual-shell-save.browser.mjs', + ]) +); + +const DESKTOP_LEAF_DIRS = [ + 'packages/frontend/desktop/src/', + 'packages/frontend/desktop/tests/', +]; + +function noFastLane(reason) { + return { + webHostOnly: false, + desktopLeafOnly: false, + desktopRsOnly: false, + backendOnly: false, + webWrapperOnly: false, + appleSpecific: true, + reason, + checkedPaths: [], + }; +} + +function fullRunReason(forceAll, ref, event) { + if (forceAll === true || forceAll === 'true') return 'force_all'; + if (isTrunkRef(ref)) return 'trunk_ref'; + if (event === 'pull_request' || ref.trim().startsWith('refs/pull/')) { + return 'pull_request'; + } + if (FULL_RUN_EVENTS.has(event)) return event; + return null; +} + +export function isTrunkRef(ref) { + return typeof ref === 'string' && TRUNK_REFS.has(ref.trim()); +} + +export function isValidBaseSha(baseSha) { + if (typeof baseSha !== 'string') return false; + const trimmed = baseSha.trim(); + return /^[0-9a-f]{7,64}$/i.test(trimmed) && !/^0+$/.test(trimmed); +} + +function parseNulTokens(raw) { + if (raw === '') return { valid: true, entries: [] }; + const tokens = raw.split('\0'); + if (tokens[tokens.length - 1] === '') { + tokens.pop(); + } + const entries = []; + let i = 0; + while (i < tokens.length) { + const status = tokens[i++]; + if (/^[RC]\d*$/.test(status)) { + const oldPath = tokens[i++]; + const newPath = tokens[i++]; + if (!oldPath || !newPath) { + return { valid: false, entries: [] }; + } + entries.push({ status, paths: [oldPath, newPath] }); + } else if (/^[AMDT]$/.test(status)) { + const filePath = tokens[i++]; + if (!filePath) { + return { valid: false, entries: [] }; + } + entries.push({ status, paths: [filePath] }); + } else { + return { valid: false, entries: [] }; + } + } + return { valid: true, entries }; +} + +function parseTabLines(lines) { + const entries = []; + for (const rawLine of lines) { + if (typeof rawLine !== 'string') { + return { valid: false, entries: [] }; + } + if (rawLine.length === 0) continue; + const parts = rawLine.split('\t'); + const status = parts[0]; + if (/^[RC]\d*$/.test(status)) { + if (parts.length !== 3 || !parts[1] || !parts[2]) { + return { valid: false, entries: [] }; + } + entries.push({ status, paths: [parts[1], parts[2]] }); + } else if (/^[AMDT]$/.test(status)) { + if (parts.length !== 2 || !parts[1]) { + return { valid: false, entries: [] }; + } + entries.push({ status, paths: [parts[1]] }); + } else { + return { valid: false, entries: [] }; + } + } + return { valid: true, entries }; +} + +export function parseNameStatus(input) { + if (Buffer.isBuffer(input)) { + return parseNulTokens(input.toString('utf8')); + } + if (typeof input === 'string') { + if (input.includes('\0')) { + return parseNulTokens(input); + } + return parseTabLines(input.split(/\r?\n/)); + } + if (Array.isArray(input)) { + return parseTabLines(input); + } + return { valid: false, entries: [] }; +} + +export function classifyWebHostOnly(options = {}) { + const { + nameStatus, + nameStatusLines, + forceAll = false, + baseSha, + ref = '', + event = '', + contentTouchesApple = false, + } = options; + + const fullRun = fullRunReason(forceAll, ref, event); + if (fullRun) { + return noFastLane(fullRun); + } + if (baseSha !== undefined && !isValidBaseSha(baseSha)) { + return noFastLane('invalid_base'); + } + + const rawInput = nameStatus !== undefined ? nameStatus : nameStatusLines; + if (rawInput === undefined || rawInput === null) { + return noFastLane('missing_diff'); + } + + const parsed = parseNameStatus(rawInput); + if (!parsed.valid) { + return noFastLane('invalid_name_status'); + } + if (parsed.entries.length === 0) { + return noFastLane('empty_diff'); + } + + const checkedPaths = parsed.entries.flatMap(entry => entry.paths); + const webHostOnly = checkedPaths.every(filePath => + WEB_HOST_ONLY_ALLOWLIST.has(filePath) + ); + const isDesktopRustPath = filePath => + filePath.endsWith('.rs') && + DESKTOP_LEAF_DIRS.some(dir => filePath.startsWith(dir)); + const desktopRsOnly = checkedPaths.every(isDesktopRustPath); + const appleSpecific = + contentTouchesApple === true || + checkedPaths.some( + filePath => + isAppleSpecificPath(filePath) || + (contentTouchesApple instanceof Set && + contentTouchesApple.has(filePath)) + ); + return { + webHostOnly, + desktopLeafOnly: + !webHostOnly && + checkedPaths.every( + filePath => + WEB_HOST_ONLY_ALLOWLIST.has(filePath) || isDesktopRustPath(filePath) + ), + desktopRsOnly, + backendOnly: checkedPaths.every(filePath => + filePath.startsWith('packages/backend/') + ), + webWrapperOnly: checkedPaths.every(filePath => + filePath.startsWith('packages/frontend/hosts/web/') + ), + appleSpecific, + reason: webHostOnly ? 'allowlist_only' : 'non_allowlist_path', + checkedPaths, + }; +} + +function runGitDiff(cwd, args) { + return execFileSync('git', ['diff', '--name-status', '-z', ...args], { + cwd, + encoding: 'buffer', + maxBuffer: 64 * 1024 * 1024, + stdio: ['ignore', 'pipe', 'pipe'], + }); +} + +// Returns the changed paths whose old or new text has an Apple target cfg, or +// true when a blob cannot be read. +function findAppleCfgPaths(cwd, oldRev, newRev, entries) { + const hits = new Set(); + const textHasAppleCfg = (rev, filePath) => + APPLE_TARGET_CFG_RE.test( + execFileSync('git', ['cat-file', '-p', `${rev}:${filePath}`], { + cwd, + encoding: 'utf8', + maxBuffer: 32 * 1024 * 1024, + stdio: ['ignore', 'pipe', 'pipe'], + }) + ); + try { + for (const { status, paths } of entries) { + const oldPath = paths[0]; + const newPath = paths[paths.length - 1]; + const blobs = + status === 'A' + ? [[newRev, newPath]] + : status === 'D' + ? [[oldRev, oldPath]] + : [ + [oldRev, oldPath], + [newRev, newPath], + ]; + if (blobs.some(([rev, filePath]) => textHasAppleCfg(rev, filePath))) { + paths.forEach(filePath => hits.add(filePath)); + } + } + } catch { + return true; + } + return hits; +} + +export function classifyGitDiff({ + baseSha, + head = 'HEAD', + forceAll = false, + ref = '', + event = '', + cwd = process.cwd(), +} = {}) { + const fullRun = fullRunReason(forceAll, ref, event); + if (fullRun) { + return noFastLane(fullRun); + } + if (!isValidBaseSha(baseSha)) { + return noFastLane('invalid_base'); + } + + const trimmedBase = baseSha.trim(); + const gitOpts = { + cwd, + encoding: 'buffer', + stdio: ['ignore', 'pipe', 'pipe'], + }; + + let mergeBase; + try { + execFileSync( + 'git', + ['rev-parse', '--verify', '--quiet', `${trimmedBase}^{commit}`], + gitOpts + ); + execFileSync( + 'git', + ['rev-parse', '--verify', '--quiet', `${head}^{commit}`], + gitOpts + ); + mergeBase = execFileSync('git', ['merge-base', trimmedBase, head], gitOpts) + .toString('utf8') + .trim(); + } catch { + return noFastLane('unreachable_base'); + } + + const diffRange = `${trimmedBase}...${head}`; + let diffBuf; + try { + diffBuf = runGitDiff(cwd, [diffRange]); + } catch { + return noFastLane('git_diff_error'); + } + + const parsed = parseNameStatus(diffBuf); + const contentTouchesApple = + parsed.valid && + !parsed.entries.some(entry => entry.paths.some(isAppleSpecificPath)) + ? findAppleCfgPaths(cwd, mergeBase, head, parsed.entries) + : false; + const classify = nameStatus => + classifyWebHostOnly({ + nameStatus, + forceAll, + baseSha: trimmedBase, + ref, + event, + contentTouchesApple, + }); + + const initial = classify(diffBuf); + if ( + !initial.webHostOnly && + !initial.desktopLeafOnly && + !initial.backendOnly && + !initial.webWrapperOnly + ) { + return initial; + } + + if (!parsed.entries.some(entry => entry.status === 'A')) { + return initial; + } + + // Check both paths when Git detects a copy from a file that did not change. + let copyDiffBuf; + try { + copyDiffBuf = runGitDiff(cwd, ['-C', '--find-copies-harder', diffRange]); + } catch { + return noFastLane('git_diff_error'); + } + + return classify(copyDiffBuf); +} + +function parseCliArgs(argv) { + const args = { + baseSha: process.env.BASE ?? '', + head: 'HEAD', + forceAll: process.env.FORCE_ALL ?? 'false', + ref: process.env.GITHUB_REF ?? process.env.GITHUB_REF_NAME ?? '', + event: process.env.GITHUB_EVENT_NAME ?? '', + githubOutput: process.env.GITHUB_OUTPUT ?? '', + cwd: process.cwd(), + }; + + for (let i = 0; i < argv.length; i++) { + const flag = argv[i]; + const value = argv[i + 1]; + if (flag === '--base' && value !== undefined) { + args.baseSha = value; + i++; + } else if (flag === '--head' && value !== undefined) { + args.head = value; + i++; + } else if (flag === '--force-all' && value !== undefined) { + args.forceAll = value; + i++; + } else if (flag === '--ref' && value !== undefined) { + args.ref = value; + i++; + } else if (flag === '--event' && value !== undefined) { + args.event = value; + i++; + } else if (flag === '--github-output' && value !== undefined) { + args.githubOutput = value; + i++; + } else if (flag === '--cwd' && value !== undefined) { + args.cwd = value; + i++; + } else { + throw new Error(`Unknown or incomplete argument: ${flag}`); + } + } + return args; +} + +function main() { + const args = parseCliArgs(process.argv.slice(2)); + const result = classifyGitDiff({ + baseSha: args.baseSha, + head: args.head, + forceAll: args.forceAll, + ref: args.ref, + event: args.event, + cwd: args.cwd, + }); + + if (args.githubOutput) { + appendFileSync( + args.githubOutput, + `web_host_only=${result.webHostOnly}\n` + + `desktop_leaf_only=${result.desktopLeafOnly}\n` + + `desktop_rs_only=${result.desktopRsOnly}\n` + + `backend_only=${result.backendOnly}\n` + + `web_wrapper_only=${result.webWrapperOnly}\n` + + `apple_specific=${result.appleSpecific}\n` + ); + } + const summary = + `web_host_only=${result.webHostOnly} ` + + `(${result.reason}, ${result.checkedPaths.length} path(s))`; + console.log(summary); + console.log(`desktop_leaf_only=${result.desktopLeafOnly}`); + console.log(`desktop_rs_only=${result.desktopRsOnly}`); + console.log(`apple_specific=${result.appleSpecific}`); +} + +const isMain = + process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href; +if (isMain) { + main(); +} diff --git a/scripts/ci/classify-web-host-only.test.mjs b/scripts/ci/classify-web-host-only.test.mjs new file mode 100644 index 0000000000..cbee6af728 --- /dev/null +++ b/scripts/ci/classify-web-host-only.test.mjs @@ -0,0 +1,914 @@ +import assert from 'node:assert/strict'; +import { execFileSync } from 'node:child_process'; +import { + mkdirSync, + mkdtempSync, + readFileSync, + rmSync, + writeFileSync, +} from 'node:fs'; +import { tmpdir } from 'node:os'; +import { dirname, join } from 'node:path'; +import test from 'node:test'; +import { fileURLToPath } from 'node:url'; + +import { + classifyGitDiff, + classifyWebHostOnly, + WEB_HOST_ONLY_ALLOWLIST, + ZERO_SHA, +} from './classify-web-host-only.mjs'; + +const REPO_ROOT = fileURLToPath(new URL('../..', import.meta.url)); +const CLI_PATH = join(REPO_ROOT, 'scripts/ci/classify-web-host-only.mjs'); +const SAMPLE_BASE = '65460a7f136d32b15d0d4398f0f4976273c51c9d'; + +await test('Native Playground CI applies desktop gates under the correct conditions', () => { + const workflow = readFileSync( + join(REPO_ROOT, '.github/workflows/native-playground.yml'), + 'utf8' + ); + const jobs = new Map(); + const jobBlocks = workflow.split('\njobs:\n')[1].split(/(?=^ {2}[\w-]+:\n)/m); + for (const block of jobBlocks) { + const [heading, ...lines] = block.split('\n'); + jobs.set(heading.trim().slice(0, -1), lines.join('\n')); + } + const step = (job, name) => { + const body = jobs + .get(job) + .split(/^ {6}- name: /m) + .find(block => block.startsWith(`${name}\n`)); + assert.ok(body, `Missing step: ${name}`); + return body + .trimEnd() + .split('\n') + .map(line => line.trim()); + }; + const lintJob = 'lint-and-wasm'; + const clippy = step(lintJob, 'Clippy check'); + assert.deepEqual(clippy.slice(3, -1), [ + 'cargo clippy --locked --workspace --all-targets --features harness -- -D warnings', + ]); + const tokenDrift = step( + lintJob, + 'Verify generated tokens, icons, and fonts.lock have zero drift' + ); + assert.equal(tokenDrift[1], 'run: |'); + assert.ok( + tokenDrift.includes( + 'node ../ui/tokens/extract-tokens.mjs --check --node-modules /tmp/np-token-deps/node_modules' + ) + ); + const wasmCheck = step(lintJob, 'Check WebAssembly target'); + assert.equal( + wasmCheck[1], + "if: needs.changes.outputs.desktop-rs-only != 'true'" + ); + assert.deepEqual(wasmCheck.slice(4, -1), [ + 'cargo check --locked -p ui-tokens -p ui -p ui-kit -p blocksuite-editor -p playground --target wasm32-unknown-unknown', + 'cargo check --locked -p blocksuite-playground-doc --no-default-features --target wasm32-unknown-unknown', + 'cargo check --locked -p affine-store --no-default-features --target wasm32-unknown-unknown', + 'cargo check --locked -p blocksuite-preview --no-default-features --features mermaid,wasm-worker --target wasm32-unknown-unknown', + 'cargo check --locked -p blocksuite-preview --no-default-features --features math,wasm-worker --target wasm32-unknown-unknown', + 'cargo check --locked -p blocksuite-preview --no-default-features --features typst,wasm-worker --target wasm32-unknown-unknown', + 'cargo check --locked -p blocksuite-preview --no-default-features --features pdf,wasm-worker --target wasm32-unknown-unknown', + ]); + const allTargetsCheck = + 'cargo check --locked -p affine-desktop --all-targets --features harness'; + const desktopCheck = step( + lintJob, + 'Check Desktop on Linux (default and harness)' + ); + assert.equal( + desktopCheck[1], + "if: needs.changes.outputs.desktop-rs-only == 'true'" + ); + assert.deepEqual(desktopCheck.slice(4, -1), [ + 'cargo check --locked -p affine-desktop --lib', + allTargetsCheck, + ]); + const desktopTest = step( + 'headless-linux-and-perf', + 'Test Desktop on Linux (default and harness)' + ); + assert.equal( + desktopTest[1], + "if: needs.changes.outputs.desktop-leaf-only == 'true'" + ); + assert.deepEqual(desktopTest.slice(4, -1), [ + 'cargo test --locked -p affine-desktop', + 'cargo test --locked -p affine-desktop --features harness --bin desktop-harness', + 'if [ "${{ needs.changes.outputs.desktop-rs-only }}" != "true" ]; then', + allTargetsCheck, + 'fi', + ]); + assert.deepEqual( + [...jobs].flatMap(([job, body]) => + [...body.matchAll(/^ +timeout-minutes: (.+)$/gm)].map(([, value]) => [ + job, + value, + ]) + ), + [ + ['web-wasm-smoke', '20'], + ['headless-linux-and-perf', '25'], + ['perf-guardrail', '5'], + ] + ); +}); + +await test('allowlist remains frozen to the seven pure web-host paths', () => { + assert.deepEqual( + [...WEB_HOST_ONLY_ALLOWLIST], + [ + 'packages/frontend/hosts/web/src/idb-storage.js', + 'packages/frontend/hosts/web/desktop/boot.js', + 'packages/frontend/hosts/web/desktop/start.js', + 'packages/frontend/hosts/web/desktop/index.html', + 'packages/frontend/hosts/web/tests/idb-storage.test.mjs', + 'packages/frontend/hosts/web/tests/desktop.test.mjs', + 'packages/frontend/hosts/web/tests/dual-shell-save.browser.mjs', + ] + ); +}); + +await test('classifyWebHostOnly handles allowlist, rename, and guards', () => { + const cases = [ + { + name: 'single allowlisted file modification', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/darksky/np/mobile-web-fix', + nameStatusLines: ['M\tpackages/frontend/hosts/web/src/idb-storage.js'], + }, + expected: true, + }, + { + name: 'multi-file allowlist modification matching e7236462b016', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/darksky/np/mobile-wave-h2-idb-quota', + nameStatusLines: [ + 'M\tpackages/frontend/hosts/web/desktop/start.js', + 'M\tpackages/frontend/hosts/web/src/idb-storage.js', + 'M\tpackages/frontend/hosts/web/tests/desktop.test.mjs', + 'M\tpackages/frontend/hosts/web/tests/idb-storage.test.mjs', + ], + }, + expected: true, + }, + { + name: 'allowlist files mixed with Rust source or Cargo.toml', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/darksky/np/mobile-mixed', + nameStatusLines: [ + 'M\tpackages/frontend/hosts/web/src/idb-storage.js', + 'M\tpackages/frontend/Cargo.toml', + ], + }, + expected: false, + }, + { + name: 'allowlist files mixed with .rs file', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/darksky/np/mobile-mixed-rs', + nameStatusLines: [ + 'M\tpackages/frontend/hosts/web/desktop/start.js', + 'M\tpackages/frontend/mobile/src/lib.rs', + ], + }, + expected: false, + }, + { + name: 'preview-workers.js included by Rust tests must be false', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/darksky/np/mobile-preview-worker', + nameStatusLines: [ + 'M\tblocksuite/crates/playground/web/preview-workers.js', + ], + }, + expected: false, + }, + { + name: 'R100 rename inside allowlist is true', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/darksky/np/mobile-rename-in', + nameStatusLines: [ + [ + 'R100', + 'packages/frontend/hosts/web/desktop/start.js', + 'packages/frontend/hosts/web/src/idb-storage.js', + ].join('\t'), + ], + }, + expected: true, + }, + { + name: 'R100 rename from outside allowlist into allowlist is false', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/darksky/np/mobile-rename-into', + nameStatusLines: [ + [ + 'R100', + 'packages/frontend/hosts/web/src/other.js', + 'packages/frontend/hosts/web/src/idb-storage.js', + ].join('\t'), + ], + }, + expected: false, + }, + { + name: 'R100 rename from allowlist to outside allowlist is false', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/darksky/np/mobile-rename-out', + nameStatusLines: [ + [ + 'R100', + 'packages/frontend/hosts/web/desktop/start.js', + 'packages/frontend/hosts/web/desktop/start-v2.js', + ].join('\t'), + ], + }, + expected: false, + }, + { + name: 'C100 copy from outside allowlist into allowlist is false', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/darksky/np/mobile-copy-into', + nameStatusLines: [ + [ + 'C100', + 'packages/frontend/hosts/web/src/other.js', + 'packages/frontend/hosts/web/src/idb-storage.js', + ].join('\t'), + ], + }, + expected: false, + }, + { + name: 'web host helper script verify-idb-real-browser.mjs must be false', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/darksky/np/mobile-script', + nameStatusLines: [ + 'M\tpackages/frontend/hosts/web/scripts/verify-idb-real-browser.mjs', + ], + }, + expected: false, + }, + { + name: 'empty diff must be false', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/darksky/np/mobile-empty', + nameStatusLines: [], + }, + expected: false, + }, + { + name: 'forceAll=true overrides allowlist diff to false', + input: { + baseSha: SAMPLE_BASE, + forceAll: true, + ref: 'refs/heads/darksky/np/mobile-force', + nameStatusLines: ['M\tpackages/frontend/hosts/web/src/idb-storage.js'], + }, + expected: false, + }, + { + name: 'trunk push to refs/heads/darksky/np/mobile must be false', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/darksky/np/mobile', + nameStatusLines: ['M\tpackages/frontend/hosts/web/src/idb-storage.js'], + }, + expected: false, + }, + { + name: 'trunk push to refs/heads/canary must be false', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/canary', + nameStatusLines: ['M\tpackages/frontend/hosts/web/src/idb-storage.js'], + }, + expected: false, + }, + { + name: 'zero SHA base must be false', + input: { + baseSha: ZERO_SHA, + ref: 'refs/heads/darksky/np/mobile-zero', + nameStatusLines: ['M\tpackages/frontend/hosts/web/src/idb-storage.js'], + }, + expected: false, + }, + { + name: 'missing base SHA must be false', + input: { + baseSha: '', + ref: 'refs/heads/darksky/np/mobile-missing-base', + nameStatusLines: ['M\tpackages/frontend/hosts/web/src/idb-storage.js'], + }, + expected: false, + }, + { + name: 'NUL-delimited -z output works for allowlist and rejects invalid status', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/darksky/np/mobile-z', + nameStatus: + 'M\0packages/frontend/hosts/web/desktop/index.html\0' + + 'M\0packages/frontend/hosts/web/tests/dual-shell-save.browser.mjs\0', + }, + expected: true, + }, + { + name: 'unknown git status code fails closed', + input: { + baseSha: SAMPLE_BASE, + ref: 'refs/heads/darksky/np/mobile-unknown', + nameStatus: 'U\0packages/frontend/hosts/web/src/idb-storage.js\0', + }, + expected: false, + }, + ]; + + for (const tc of cases) { + const result = classifyWebHostOnly(tc.input); + assert.equal(result.webHostOnly, tc.expected, tc.name); + } +}); + +await test('Desktop lanes distinguish Rust changes from mixed web host changes', () => { + const desktop = 'packages/frontend/desktop'; + const source = `M\t${desktop}/src/window/mod.rs`; + const webHost = 'M\tpackages/frontend/hosts/web/src/idb-storage.js'; + const cases = [ + ['Desktop source', [source], [false, true, true]], + ['Desktop test', [`A\t${desktop}/tests/smoke.rs`], [false, true, true]], + ['Desktop and web host', [source, webHost], [false, true, false]], + ['web host only', [webHost], [true, false, false]], + ['empty diff', [], [false, false, false]], + [ + 'Desktop manifest', + [source, `M\t${desktop}/Cargo.toml`], + [false, false, false], + ], + [ + 'workspace lockfile', + [source, 'M\tpackages/frontend/Cargo.lock'], + [false, false, false], + ], + ['Desktop asset', [`M\t${desktop}/src/icon.png`], [false, false, false]], + ['Desktop build script', [`M\t${desktop}/build.rs`], [false, false, false]], + [ + 'client source', + [source, 'M\tpackages/frontend/client/src/lib.rs'], + [false, false, false], + ], + [ + 'BlockSuite source', + [source, 'M\tblocksuite/crates/editor/src/lib.rs'], + [false, false, false], + ], + [ + 'rename from client', + [`R100\tpackages/frontend/client/src/lib.rs\t${desktop}/src/moved.rs`], + [false, false, false], + ], + [ + 'rename within Desktop', + [`R100\t${desktop}/src/old.rs\t${desktop}/src/new.rs`], + [false, true, true], + ], + ['invalid status', [`U\t${desktop}/src/file.rs`], [false, false, false]], + ]; + for (const [label, nameStatusLines, expected] of cases) { + const { webHostOnly, desktopLeafOnly, desktopRsOnly } = classifyWebHostOnly( + { + nameStatusLines, + baseSha: SAMPLE_BASE, + } + ); + assert.deepEqual( + [webHostOnly, desktopLeafOnly, desktopRsOnly], + expected, + label + ); + } + + for (const guard of [ + { forceAll: true }, + { ref: 'refs/heads/darksky/np/mobile' }, + { baseSha: ZERO_SHA }, + ]) { + const result = classifyWebHostOnly({ nameStatusLines: [source], ...guard }); + assert.equal(result.webHostOnly, false, result.reason); + assert.equal(result.desktopLeafOnly, false, result.reason); + assert.equal(result.desktopRsOnly, false, result.reason); + } +}); + +function createGitRunner(cwd) { + return (...args) => + execFileSync('git', args, { + cwd, + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'pipe'], + }).trim(); +} + +await test('classifyGitDiff handles Git commits, lane guards, and CLI outputs', () => { + const tmpRepo = mkdtempSync(join(tmpdir(), 'classify-web-host-')); + const outputFile = join(tmpRepo, 'github-output.txt'); + + try { + const git = createGitRunner(tmpRepo); + + git('init', '-b', 'main'); + git('config', 'user.name', 'Test User'); + git('config', 'user.email', 'test@example.com'); + + const allowFile = join( + tmpRepo, + 'packages/frontend/hosts/web/src/idb-storage.js' + ); + const desktopHtmlFile = join( + tmpRepo, + 'packages/frontend/hosts/web/desktop/index.html' + ); + const desktopStartFile = join( + tmpRepo, + 'packages/frontend/hosts/web/desktop/start.js' + ); + const otherFile = join( + tmpRepo, + 'packages/frontend/hosts/web/scripts/verify-idb-real-browser.mjs' + ); + const otherContent = [ + 'export function runVerify(target) {', + ' const steps = ["boot", "sync", "persist", "reload"];', + ' return steps.map((step, index) => `${index}:${target}:${step}`);', + '}', + '', + ].join('\n'); + mkdirSync(join(tmpRepo, 'packages/frontend/hosts/web/src'), { + recursive: true, + }); + mkdirSync(join(tmpRepo, 'packages/frontend/hosts/web/desktop'), { + recursive: true, + }); + mkdirSync(join(tmpRepo, 'packages/frontend/hosts/web/scripts'), { + recursive: true, + }); + + const backend = 'packages/backend/server-domain/src'; + const web = 'packages/frontend/hosts/web'; + const sharedSource = 'packages/common/store/shared.js'; + const sharedContent = 'export const shared = "common store";\n'; + mkdirSync(join(tmpRepo, backend), { recursive: true }); + mkdirSync(join(tmpRepo, 'packages/common/store'), { recursive: true }); + writeFileSync(join(tmpRepo, sharedSource), sharedContent); + writeFileSync(join(tmpRepo, backend, 'lib.rs'), 'pub fn first() {}\n'); + writeFileSync(join(tmpRepo, web, 'index.html'), 'Base\n'); + + writeFileSync(allowFile, 'export const v = 1;\n'); + writeFileSync(otherFile, otherContent); + git('add', '.'); + git('commit', '-m', 'base'); + const baseSha = git('rev-parse', 'HEAD'); + + // Empty diff against self -> false. + assert.equal( + classifyGitDiff({ + baseSha, + ref: 'refs/heads/darksky/np/mobile-test', + cwd: tmpRepo, + }).webHostOnly, + false + ); + + // Pure allowlist commit -> true. + writeFileSync(allowFile, 'export const v = 2;\n'); + git('add', '.'); + git('commit', '-m', 'web host only'); + + const cliOut = execFileSync( + process.execPath, + [ + CLI_PATH, + '--base', + baseSha, + '--ref', + 'refs/heads/darksky/np/mobile-test', + '--github-output', + outputFile, + ], + { cwd: tmpRepo, encoding: 'utf8' } + ); + assert.match(cliOut, /^web_host_only=true /); + assert.equal( + readFileSync(outputFile, 'utf8'), + 'web_host_only=true\ndesktop_leaf_only=false\ndesktop_rs_only=false\n' + + 'backend_only=false\nweb_wrapper_only=true\napple_specific=false\n' + ); + assert.match(cliOut, /^apple_specific=false$/m); + + const webHostSha = git('rev-parse', 'HEAD'); + const desktopDir = join(tmpRepo, 'packages/frontend/desktop/src'); + const desktopFile = join(desktopDir, 'new.rs'); + mkdirSync(desktopDir, { recursive: true }); + writeFileSync(desktopFile, 'pub fn unique() {}\n'); + git('add', desktopFile); + git('commit', '-m', 'add Desktop source'); + const desktop = classifyGitDiff({ baseSha: webHostSha, cwd: tmpRepo }); + assert.equal(desktop.desktopLeafOnly, true); + assert.equal(desktop.desktopRsOnly, true); + + const mixed = classifyGitDiff({ baseSha, cwd: tmpRepo }); + assert.equal(mixed.desktopLeafOnly, true); + assert.equal(mixed.desktopRsOnly, false); + assert.equal(mixed.webHostOnly, false); + + writeFileSync(desktopFile, otherContent); + git('add', desktopFile); + git('commit', '-m', 'copy into Desktop source'); + const desktopCopy = classifyGitDiff({ baseSha: webHostSha, cwd: tmpRepo }); + assert.equal(desktopCopy.desktopLeafOnly, false); + assert.equal(desktopCopy.desktopRsOnly, false); + + git('reset', '--hard', 'HEAD~2'); + + // Unreachable / non-existent base -> false. + assert.equal( + classifyGitDiff({ + baseSha: 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef', + ref: 'refs/heads/darksky/np/mobile-test', + cwd: tmpRepo, + }).webHostOnly, + false + ); + + // Brand-new unique allowlisted file -> still true after copy re-check. + writeFileSync( + desktopHtmlFile, + 'AFFiNE Workbench\n' + ); + git('add', desktopHtmlFile); + git('commit', '-m', 'add unique allowlisted html'); + assert.equal( + classifyGitDiff({ + baseSha, + ref: 'refs/heads/darksky/np/mobile-test', + cwd: tmpRepo, + }).webHostOnly, + true + ); + + // Copying an unmodified non-allowlisted file into a newly added + // allowlisted file -> false (caught by --find-copies-harder). + writeFileSync(desktopStartFile, otherContent); + git('add', desktopStartFile); + git('commit', '-m', 'copy non-allowlisted file into allowlisted path'); + const copyResult = classifyGitDiff({ + baseSha, + ref: 'refs/heads/darksky/np/mobile-test', + cwd: tmpRepo, + }); + assert.equal(copyResult.webHostOnly, false); + assert.equal(copyResult.reason, 'non_allowlist_path'); + + // Adding a non-allowlisted file -> false. + writeFileSync(otherFile, 'export const s = 2;\n'); + git('add', otherFile); + git('commit', '-m', 'touch helper script'); + assert.equal( + classifyGitDiff({ + baseSha, + ref: 'refs/heads/darksky/np/mobile-test', + cwd: tmpRepo, + }).webHostOnly, + false + ); + + const cases = [ + { + name: 'backend edits and additions', + files: [ + [`${backend}/lib.rs`, 'pub fn second() {}\n'], + [`${backend}/new.rs`, 'pub fn new_file() {}\n'], + ], + backendOnly: true, + }, + { + name: 'Web wrapper HTML and script edits', + files: [ + [`${web}/index.html`, 'Updated\n'], + [ + `${web}/scripts/verify-idb-real-browser.mjs`, + 'export const v = 3;\n', + ], + ], + webWrapperOnly: true, + }, + { + name: 'copy from the common store into an allowlisted Web wrapper path', + files: [[`${web}/desktop/start.js`, sharedContent]], + copyTo: `${web}/desktop/start.js`, + }, + { + name: 'copy from the common store into the backend', + files: [[`${backend}/copy.js`, sharedContent]], + copyTo: `${backend}/copy.js`, + }, + { + name: 'mixed backend and Web wrapper edits', + files: [ + [`${backend}/lib.rs`, 'pub fn second() {}\n'], + [`${web}/index.html`, 'Updated\n'], + ], + }, + ]; + for (const { + name, + files, + copyTo, + backendOnly = false, + webWrapperOnly = false, + } of cases) { + git('reset', '--hard', baseSha); + for (const [path, content] of files) { + const file = join(tmpRepo, path); + mkdirSync(dirname(file), { recursive: true }); + writeFileSync(file, content); + } + git('add', '--', ...files.map(([path]) => path)); + git('commit', '-m', name); + if (copyTo) { + assert.equal( + git( + 'diff', + '--name-status', + '-C', + '--find-copies-harder', + baseSha, + 'HEAD' + ), + `C100\t${sharedSource}\t${copyTo}` + ); + } + const result = classifyGitDiff({ baseSha, cwd: tmpRepo }); + assert.equal(result.backendOnly, backendOnly, name); + assert.equal(result.webWrapperOnly, webWrapperOnly, name); + assert.equal(result.webHostOnly, false, name); + assert.equal(result.desktopLeafOnly, false, name); + assert.equal(result.desktopRsOnly, false, name); + if (backendOnly || webWrapperOnly) { + for (const guard of [ + { forceAll: 'true' }, + { ref: 'refs/heads/darksky/np/mobile' }, + { baseSha: ZERO_SHA }, + { baseSha: 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' }, + { baseSha: git('rev-parse', 'HEAD') }, + ]) { + const guarded = classifyGitDiff({ baseSha, cwd: tmpRepo, ...guard }); + assert.equal(guarded.backendOnly, false, guarded.reason); + assert.equal(guarded.webWrapperOnly, false, guarded.reason); + } + } + } + } finally { + rmSync(tmpRepo, { recursive: true, force: true }); + } +}); + +await test('classifyWebHostOnly flags Apple jobs for full runs and Apple paths', () => { + const slice = 'refs/heads/darksky/np/mobile-r29-foo'; + const crossPlatform = [ + 'M\tpackages/frontend/desktop/src/sidebar/mod.rs', + 'M\tblocksuite/crates/editor/src/directory.rs', + 'M\tpackages/frontend/mobile/src/state/derived.rs', + ]; + const cases = [ + ['trunk darksky/np/mobile', { ref: 'refs/heads/darksky/np/mobile' }, true], + ['trunk canary', { ref: 'refs/heads/canary' }, true], + ['trunk main', { ref: 'refs/heads/main' }, true], + ['pull request ref', { ref: 'refs/pull/123/merge' }, true], + ['pull request event', { ref: slice, event: 'pull_request' }, true], + ['manual dispatch', { ref: slice, event: 'workflow_dispatch' }, true], + ['force all', { ref: slice, forceAll: true }, true], + ['invalid base', { ref: slice, baseSha: ZERO_SHA }, true], + ['empty diff', { ref: slice, nameStatusLines: [] }, true], + ['missing diff', { ref: slice, nameStatusLines: null }, true], + ['cross-platform slice', { ref: slice }, false], + ['push event slice', { ref: slice, event: 'push' }, false], + ['content hit', { ref: slice, contentTouchesApple: true }, true], + [ + 'content hit on a changed path', + { + ref: slice, + contentTouchesApple: new Set([ + 'blocksuite/crates/editor/src/directory.rs', + ]), + }, + true, + ], + [ + 'content hit on an unchanged path', + { ref: slice, contentTouchesApple: new Set(['other.rs']) }, + false, + ], + ]; + for (const path of [ + 'packages/ui/ui/src/platform/apple/metal_renderer.rs', + 'packages/ui/ui/src/platform/macos/window.rs', + 'packages/ui/ui/src/platform/ios/window.rs', + 'packages/frontend/hosts/ios/Sources/AppDelegate.swift', + 'packages/frontend/apps/ios/App/App/AppDelegate.swift', + '.cargo/config.toml', + 'packages/ui/ui/tests/metal_atlas_fence.rs', + 'packages/ui/ui/build.rs', + 'packages/frontend/Cargo.toml', + 'packages/frontend/Cargo.lock', + 'packages/frontend/desktop/Cargo.toml', + 'packages/frontend/native/media_capture/build.rs', + 'packages/frontend/native/media_capture/src/macos/audio_buffer.rs', + 'packages/frontend/rust-toolchain.toml', + 'packages/ui/ui/src/platform/apple/shaders.metal', + 'Cargo.lock', + 'rust-toolchain.toml', + '.github/workflows/native-playground.yml', + '.github/workflows/np-mobile.yml', + 'scripts/ci/classify-web-host-only.mjs', + ]) { + cases.push([path, { ref: slice, nameStatusLines: [`M\t${path}`] }, true]); + } + cases.push([ + 'rename out of an Apple path', + { + ref: slice, + nameStatusLines: [ + 'R100\tpackages/ui/ui/src/platform/macos/a.rs\tpackages/ui/ui/src/b.rs', + ], + }, + true, + ]); + for (const [label, input, expected] of cases) { + const result = classifyWebHostOnly({ + baseSha: SAMPLE_BASE, + nameStatusLines: crossPlatform, + ...input, + }); + assert.equal(result.appleSpecific, expected, `${label} (${result.reason})`); + } +}); + +await test('classifyWebHostOnly skips non-Apple desktop topic branches and runs trunk', () => { + const desktopLeaf = 'packages/frontend/desktop/src/views_extra/scroll.rs'; + const rows = [ + [ + 'non-Apple desktop topic branch', + { + ref: 'refs/heads/darksky/np/mobile-test', + event: 'push', + nameStatusLines: [`M\t${desktopLeaf}`], + contentTouchesApple: false, + }, + { appleSpecific: false, desktopLeafOnly: true }, + ], + [ + 'same desktop change on trunk', + { + ref: 'refs/heads/darksky/np/mobile', + event: 'push', + nameStatusLines: [`M\t${desktopLeaf}`], + contentTouchesApple: false, + }, + { appleSpecific: true, desktopLeafOnly: false }, + ], + [ + 'Apple-cfg desktop topic branch', + { + ref: 'refs/heads/darksky/np/mobile-test', + event: 'push', + nameStatusLines: [`M\t${desktopLeaf}`], + contentTouchesApple: true, + }, + { appleSpecific: true, desktopLeafOnly: true }, + ], + [ + 'workflow push on darksky/native-playground', + { + ref: 'refs/heads/darksky/native-playground', + event: 'push', + nameStatusLines: ['M\t.github/workflows/native-playground.yml'], + contentTouchesApple: false, + }, + { appleSpecific: true, desktopLeafOnly: false }, + ], + ]; + for (const [label, input, expected] of rows) { + const result = classifyWebHostOnly({ baseSha: SAMPLE_BASE, ...input }); + assert.equal( + result.appleSpecific, + expected.appleSpecific, + `${label} appleSpecific` + ); + assert.equal( + result.desktopLeafOnly, + expected.desktopLeafOnly, + `${label} desktopLeafOnly` + ); + } +}); + +await test('classifyGitDiff flags Apple jobs from Apple target cfg text', () => { + const tmpRepo = mkdtempSync(join(tmpdir(), 'classify-apple-cfg-')); + try { + const git = createGitRunner(tmpRepo); + const write = (path, content) => { + const file = join(tmpRepo, path); + mkdirSync(dirname(file), { recursive: true }); + writeFileSync(file, content); + }; + git('init', '-b', 'main'); + git('config', 'user.name', 'Test User'); + git('config', 'user.email', 'test@example.com'); + + const moreMenu = 'blocksuite/crates/editor/src/more_menu.rs'; + const vendorFile = 'blocksuite/crates/editor/src/vendor.rs'; + const plain = 'blocksuite/crates/editor/src/directory.rs'; + write( + moreMenu, + '#[cfg(target_os = "macos")]\nconst COPY: &str = "C";\nfn a() {}\n' + ); + write(vendorFile, '#[cfg(target_vendor = "apple")]\nfn v() {}\n'); + write(plain, 'pub fn directory() {}\n'); + git('add', '.'); + git('commit', '-m', 'base'); + const baseSha = git('rev-parse', 'HEAD'); + + const cases = [ + [ + 'edit outside the cfg in a file with a macOS cfg', + () => + write( + moreMenu, + '#[cfg(target_os = "macos")]\nconst COPY: &str = "C";\nfn b() {}\n' + ), + true, + ], + [ + 'add a file with an iOS cfg', + () => + write( + 'blocksuite/crates/editor/src/ios.rs', + '#[cfg(target_os = "ios")]\nfn i() {}\n' + ), + true, + ], + [ + 'delete a file with an Apple vendor cfg', + () => rmSync(join(tmpRepo, vendorFile)), + true, + ], + [ + 'remove the macOS cfg from a file', + () => write(moreMenu, 'const COPY: &str = "C";\n'), + true, + ], + [ + 'rename a file with a macOS cfg', + () => git('mv', moreMenu, 'blocksuite/crates/editor/src/menu.rs'), + true, + ], + [ + 'edit a file with no Apple cfg', + () => write(plain, 'pub fn directory() -> u8 { 1 }\n'), + false, + ], + ]; + for (const [label, change, expected] of cases) { + git('reset', '--hard', baseSha); + change(); + git('add', '-A'); + git('commit', '-m', label); + const result = classifyGitDiff({ + baseSha, + ref: 'refs/heads/darksky/np/mobile-r29-foo', + cwd: tmpRepo, + }); + assert.equal(result.appleSpecific, expected, label); + } + } finally { + rmSync(tmpRepo, { recursive: true, force: true }); + } +}); diff --git a/scripts/ci/l0-ratchet.json b/scripts/ci/l0-ratchet.json index 00830222d5..aa56ee9181 100644 --- a/scripts/ci/l0-ratchet.json +++ b/scripts/ci/l0-ratchet.json @@ -1,6 +1,6 @@ { "waitForTimeout": { - "total": 371, + "total": 312, "files": { "blocksuite/framework/std/src/__tests__/inline/utils.ts": 3, "tests/affine-cloud-copilot/e2e/basic/chat.spec.ts": 3, @@ -13,7 +13,6 @@ "tests/affine-desktop/e2e/split-view.spec.ts": 1, "tests/affine-desktop/e2e/tabs.spec.ts": 2, "tests/affine-desktop/e2e/workspace.spec.ts": 3, - "tests/affine-local/e2e/all-page.spec.ts": 5, "tests/affine-local/e2e/attachment-preview.spec.ts": 11, "tests/affine-local/e2e/blocksuite/clipboard/clipboard.spec.ts": 14, "tests/affine-local/e2e/blocksuite/database/utils.ts": 6, @@ -31,59 +30,38 @@ "tests/affine-local/e2e/image-preview.spec.ts": 44, "tests/affine-local/e2e/import-dialog.spec.ts": 1, "tests/affine-local/e2e/links.spec.ts": 6, - "tests/affine-local/e2e/local-first-avatar.spec.ts": 3, "tests/affine-local/e2e/local-first-collections-items.spec.ts": 5, - "tests/affine-local/e2e/local-first-delete-page.spec.ts": 2, - "tests/affine-local/e2e/local-first-delete-workspace.spec.ts": 2, - "tests/affine-local/e2e/local-first-favorite-page.spec.ts": 2, - "tests/affine-local/e2e/local-first-restore-page.spec.ts": 1, - "tests/affine-local/e2e/local-first-workspace-list.spec.ts": 6, - "tests/affine-local/e2e/local-first-workspace.spec.ts": 1, - "tests/affine-local/e2e/peek-view.spec.ts": 2, - "tests/affine-local/e2e/quick-search.spec.ts": 20, + "tests/affine-local/e2e/local-first-favorite-page.spec.ts": 1, + "tests/affine-local/e2e/local-first-workspace-list.spec.ts": 4, "tests/affine-local/e2e/router.spec.ts": 1, - "tests/affine-local/e2e/settings.spec.ts": 1, - "tests/affine-local/e2e/theme.spec.ts": 1, - "tests/affine-local/e2e/undo-empty.spec.ts": 1, "tests/affine-mobile/e2e/back-button-visibility.spec.ts": 1, "tests/blocksuite/e2e/attachment.spec.ts": 4, "tests/blocksuite/e2e/bookmark.spec.ts": 19, - "tests/blocksuite/e2e/clipboard/clipboard.spec.ts": 1, - "tests/blocksuite/e2e/clipboard/list.spec.ts": 2, + "tests/blocksuite/e2e/clipboard/list.spec.ts": 1, "tests/blocksuite/e2e/clipboard/markdown.spec.ts": 4, - "tests/blocksuite/e2e/code/readonly.spec.ts": 1, "tests/blocksuite/e2e/code/selections.spec.ts": 2, "tests/blocksuite/e2e/cross-platform/basic.spec.ts": 3, "tests/blocksuite/e2e/cross-platform/inline/inline-editor.spec.ts": 37, "tests/blocksuite/e2e/database/actions.ts": 1, - "tests/blocksuite/e2e/edgeless/basic.spec.ts": 1, - "tests/blocksuite/e2e/edgeless/brush.spec.ts": 1, - "tests/blocksuite/e2e/edgeless/clipboard.spec.ts": 1, - "tests/blocksuite/e2e/edgeless/frame/frame.spec.ts": 1, - "tests/blocksuite/e2e/edgeless/note/note.spec.ts": 1, "tests/blocksuite/e2e/edgeless/pan.spec.ts": 1, "tests/blocksuite/e2e/edgeless/selection/selection.spec.ts": 16, "tests/blocksuite/e2e/edgeless/shape.spec.ts": 6, - "tests/blocksuite/e2e/edgeless/text.spec.ts": 1, - "tests/blocksuite/e2e/format-bar.spec.ts": 1, "tests/blocksuite/e2e/hotkey/hotkey.spec.ts": 4, "tests/blocksuite/e2e/image/load.spec.ts": 5, "tests/blocksuite/e2e/link.spec.ts": 3, - "tests/blocksuite/e2e/list.spec.ts": 1, "tests/blocksuite/e2e/paragraph.spec.ts": 5, "tests/blocksuite/e2e/selection/block.spec.ts": 13, "tests/blocksuite/e2e/selection/native.spec.ts": 7, - "tests/blocksuite/e2e/slash-menu.spec.ts": 1, "tests/blocksuite/e2e/utils/actions/edgeless.ts": 4, - "tests/blocksuite/e2e/utils/actions/misc.ts": 3, + "tests/blocksuite/e2e/utils/actions/misc.ts": 2, "tests/blocksuite/e2e/utils/asserts.ts": 1, "tests/blocksuite/e2e/utils/inline-editor.ts": 1, "tests/kit/src/utils/clipboard.ts": 1, - "tests/kit/src/utils/cloud.ts": 5, + "tests/kit/src/utils/cloud.ts": 4, "tests/kit/src/utils/editor.ts": 7, "tests/kit/src/utils/image.ts": 1, "tests/kit/src/utils/page-logic.ts": 3, - "tests/kit/src/utils/properties.ts": 5 + "tests/kit/src/utils/properties.ts": 2 } }, "skip": { diff --git a/scripts/ci/vitest-node-projects.mjs b/scripts/ci/vitest-node-projects.mjs new file mode 100644 index 0000000000..cfb1c44a2c --- /dev/null +++ b/scripts/ci/vitest-node-projects.mjs @@ -0,0 +1,51 @@ +#!/usr/bin/env node +// Prints `--project ` arguments for every Vitest project of the root +// config that runs in Node with nothing but JS dependencies. Left out: +// browser-mode projects (they need Playwright browsers), the Electron project +// (it needs the Electron binary and the native addon, and is not under +// blocksuite/), and the projects in NEEDS_RUST_BINARIES. Exits non-zero when +// it finds no project, so a caller never runs an unfiltered `vitest run`. + +import { existsSync, readdirSync, readFileSync } from 'node:fs'; +import { dirname, join, relative } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const ROOT = fileURLToPath(new URL('../..', import.meta.url)); + +// Projects whose tests spawn compiled Rust binaries; native-playground.yml's +// js-room-coop job builds those binaries and runs them. +const NEEDS_RUST_BINARIES = new Set(['@blocksuite/playground']); + +function* configs(dir) { + for (const entry of readdirSync(dir, { withFileTypes: true })) { + if (entry.name === 'node_modules' || entry.name === 'dist') continue; + const path = join(dir, entry.name); + if (entry.isDirectory()) yield* configs(path); + else if (entry.name === 'vitest.config.ts') yield path; + } +} + +const projects = [ + join(ROOT, 'vitest.config.ts'), + ...configs(join(ROOT, 'blocksuite')), +]; +const names = []; +for (const config of projects) { + const source = readFileSync(config, 'utf8'); + if (/\bbrowser\s*:\s*\{[^}]*\benabled\s*:\s*true/s.test(source)) continue; + const explicit = /\btest\s*:\s*\{[^]*?\bname\s*:\s*'([^']+)'/.exec(source); + const pkg = join(dirname(config), 'package.json'); + const name = + explicit?.[1] ?? + (existsSync(pkg) ? JSON.parse(readFileSync(pkg, 'utf8')).name : null); + if (!name) { + console.error(`${relative(ROOT, config)}: cannot determine project name`); + process.exit(1); + } + if (!NEEDS_RUST_BINARIES.has(name)) names.push(name); +} +if (names.length === 0) { + console.error('no Node-only Vitest project found'); + process.exit(1); +} +process.stdout.write(names.map(n => `--project ${n}`).join(' ') + '\n'); diff --git a/tests/affine-local/e2e/all-page.spec.ts b/tests/affine-local/e2e/all-page.spec.ts index 27633c2074..de45f7357d 100644 --- a/tests/affine-local/e2e/all-page.spec.ts +++ b/tests/affine-local/e2e/all-page.spec.ts @@ -61,27 +61,21 @@ test('enable selection and use ESC to disable selection', async ({ page }) => { modifiers: ['Shift'], }); - // wait for 500ms - await page.waitForTimeout(500); - // there should be checkboxes in the page list now - expect( - await page + await expect( + page .locator('[data-testid="doc-list-item-select"][data-select-mode="true"]') - .count() - ).toBeGreaterThan(0); + .first() + ).toBeVisible(); // esc again, checkboxes should disappear await page.keyboard.press('Escape'); - // wait for 500ms - await page.waitForTimeout(500); - - expect( - await page - .locator('[data-testid="doc-list-item-select"][data-select-mode="true"]') - .count() - ).toBe(0); + await expect( + page.locator( + '[data-testid="doc-list-item-select"][data-select-mode="true"]' + ) + ).toHaveCount(0); }); test('select two pages and delete', async ({ page }) => { @@ -119,12 +113,11 @@ test('select two pages and delete', async ({ page }) => { await page.getByRole('button', { name: 'Delete' }).click(); // check the page count again - await page.waitForTimeout(300); await expect( page.locator('[data-testid="floating-toolbar"]') ).not.toBeVisible(); - expect(await getPagesCount(page)).toBe(pageCount - 2); + await expect.poll(() => getPagesCount(page)).toBe(pageCount - 2); }); test('select three pages with shiftKey and delete', async ({ page }) => { @@ -158,12 +151,11 @@ test('select three pages with shiftKey and delete', async ({ page }) => { await page.getByRole('button', { name: 'Delete' }).click(); // check the page count again - await page.waitForTimeout(300); await expect( page.locator('[data-testid="floating-toolbar"]') ).not.toBeVisible(); - expect(await getPagesCount(page)).toBe(pageCount - 3); + await expect.poll(() => getPagesCount(page)).toBe(pageCount - 3); }); test('select all and delete closes the floating toolbar', async ({ page }) => { @@ -186,11 +178,10 @@ test('select all and delete closes the floating toolbar', async ({ page }) => { await page.locator('[data-testid="list-toolbar-delete"]').click(); await page.getByRole('button', { name: 'Delete' }).click(); - await page.waitForTimeout(300); await expect( page.locator('[data-testid="floating-toolbar"]') ).not.toBeVisible(); - expect(await getPagesCount(page)).toBeLessThan(pageCount); + await expect.poll(() => getPagesCount(page)).toBeLessThan(pageCount); }); test('create a tag and delete it', async ({ page }) => { diff --git a/tests/affine-local/e2e/local-first-avatar.spec.ts b/tests/affine-local/e2e/local-first-avatar.spec.ts index c6928e7fda..4bef80064e 100644 --- a/tests/affine-local/e2e/local-first-avatar.spec.ts +++ b/tests/affine-local/e2e/local-first-avatar.spec.ts @@ -15,7 +15,9 @@ test('should create a page with a local first avatar and remove it', async ({ await waitForEditorLoad(page); await clickNewPageButton(page); await createLocalWorkspace({ name: 'Test Workspace 1' }, page); - await page.waitForTimeout(1000); + await expect(page.getByTestId('workspace-name')).toHaveText( + 'Test Workspace 1' + ); await page.getByTestId('workspace-name').click(); await page .getByTestId('workspace-card') @@ -33,7 +35,7 @@ test('should create a page with a local first avatar and remove it', async ({ .nth(0) .getByTestId('workspace-avatar') .click(); - await page.waitForTimeout(2000); + await expect(page.getByTestId('workspace-name')).toHaveText('Demo Workspace'); await page.getByTestId('workspace-name').click(); await page .getByTestId('workspace-card') @@ -63,7 +65,7 @@ test('should create a page with a local first avatar and remove it', async ({ await page.getByTestId('workspace-setting-avatar').hover(); await page.getByTestId('workspace-setting-remove-avatar-button').click(); await page.mouse.click(0, 0); - await page.waitForTimeout(1000); + await expect(page.getByTestId('setting-modal')).not.toBeVisible(); await page.getByTestId('workspace-name').click(); await page.getByTestId('workspace-card').nth(1).click(); const removedAvatarImage = await page diff --git a/tests/affine-local/e2e/local-first-delete-page.spec.ts b/tests/affine-local/e2e/local-first-delete-page.spec.ts index 9c09dce4a6..ae538a3bd6 100644 --- a/tests/affine-local/e2e/local-first-delete-page.spec.ts +++ b/tests/affine-local/e2e/local-first-delete-page.spec.ts @@ -72,15 +72,17 @@ test('page delete -> create new page -> refresh page -> new page should be appea await clickNewPageButton(page); await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).fill('this is a new page1'); - await page.waitForTimeout(1000); const newPageId1 = getCurrentDocIdFromUrl(page); await page.getByTestId('all-pages').click(); + await expect(getPageItem(page, newPageId1)).toBeVisible(); + await expect(getPageByTitle(page, 'this is a new page1')).toBeVisible(); await clickNewPageButton(page); await getBlockSuiteEditorTitle(page).click(); await getBlockSuiteEditorTitle(page).fill('this is a new page2'); - await page.waitForTimeout(1000); const newPageId2 = getCurrentDocIdFromUrl(page); await page.getByTestId('all-pages').click(); + await expect(getPageItem(page, newPageId2)).toBeVisible(); + await expect(getPageByTitle(page, 'this is a new page2')).toBeVisible(); await getPageItem(page, newPageId1).click(); await page.getByTestId('all-pages').click(); await getPageItem(page, newPageId2).click(); diff --git a/tests/affine-local/e2e/local-first-delete-workspace.spec.ts b/tests/affine-local/e2e/local-first-delete-workspace.spec.ts index 6f99019baf..8e3a99e971 100644 --- a/tests/affine-local/e2e/local-first-delete-workspace.spec.ts +++ b/tests/affine-local/e2e/local-first-delete-workspace.spec.ts @@ -38,10 +38,7 @@ test('Create new workspace, then delete it', async ({ page, workspace }) => { await promise; await page.reload(); await page.waitForSelector('[data-testid="workspace-name"]'); - await page.waitForTimeout(1000); - expect(await page.getByTestId('workspace-name').textContent()).toBe( - 'Demo Workspace' - ); + await expect(page.getByTestId('workspace-name')).toHaveText('Demo Workspace'); const currentWorkspace = await workspace.current(); expect(currentWorkspace.meta.flavour).toContain('local'); @@ -68,7 +65,6 @@ test('Delete last workspace', async ({ page }) => { await openHomePage(page); await expect(page.getByTestId('new-workspace')).toBeVisible(); await createLocalWorkspace({ name: 'Test Workspace' }, page, true); - await page.waitForTimeout(1000); await page.waitForSelector('[data-testid="workspace-name"]'); await expect(page.getByTestId('workspace-name')).toHaveText('Test Workspace'); }); diff --git a/tests/affine-local/e2e/local-first-favorite-page.spec.ts b/tests/affine-local/e2e/local-first-favorite-page.spec.ts index 665e4eb985..7212b13974 100644 --- a/tests/affine-local/e2e/local-first-favorite-page.spec.ts +++ b/tests/affine-local/e2e/local-first-favorite-page.spec.ts @@ -43,7 +43,7 @@ test('Export to html, markdown and png', async ({ page }) => { await page.getByTestId('export-to-markdown').click(); await downloadPromise; } - await page.waitForTimeout(50); + await expect(page.getByTestId('export-menu')).not.toBeVisible(); { await clickPageMoreActions(page); await page.getByTestId('export-menu').click(); diff --git a/tests/affine-local/e2e/local-first-restore-page.spec.ts b/tests/affine-local/e2e/local-first-restore-page.spec.ts index 76af55eb4f..ae60ad3af8 100644 --- a/tests/affine-local/e2e/local-first-restore-page.spec.ts +++ b/tests/affine-local/e2e/local-first-restore-page.spec.ts @@ -33,7 +33,7 @@ test('New a page , then delete it in all pages, restore it', async ({ await page.getByRole('button', { name: 'Delete' }).click(); await page.getByTestId('trash-page').click(); - await page.waitForTimeout(50); + await expect(page.getByTestId('restore-page-button')).toBeVisible(); const trashPage = page.url(); // restore it await page.getByTestId('restore-page-button').click(); diff --git a/tests/affine-local/e2e/local-first-workspace-list.spec.ts b/tests/affine-local/e2e/local-first-workspace-list.spec.ts index e082131e98..5c5207d660 100644 --- a/tests/affine-local/e2e/local-first-workspace-list.spec.ts +++ b/tests/affine-local/e2e/local-first-workspace-list.spec.ts @@ -43,13 +43,9 @@ test('create one workspace in the workspace list', async ({ //check page list length await page.keyboard.press('Escape'); await clickSideBarAllPageButton(page); - await page.waitForTimeout(2000); - const result = await getPagesCount(page); - expect(result).toBe(2); + await expect.poll(() => getPagesCount(page)).toBe(2); await page.reload(); - await page.waitForTimeout(4000); - const result1 = await getPagesCount(page); - expect(result1).toBe(2); + await expect.poll(() => getPagesCount(page)).toBe(2); const currentWorkspace = await workspace.current(); expect(currentWorkspace.meta.flavour).toContain('local'); diff --git a/tests/affine-local/e2e/local-first-workspace.spec.ts b/tests/affine-local/e2e/local-first-workspace.spec.ts index b3cf123b8a..b38718216c 100644 --- a/tests/affine-local/e2e/local-first-workspace.spec.ts +++ b/tests/affine-local/e2e/local-first-workspace.spec.ts @@ -7,8 +7,7 @@ test('preset workspace name', async ({ page, workspace }) => { await openHomePage(page); await waitForEditorLoad(page); const workspaceName = page.getByTestId('workspace-name'); - await page.waitForTimeout(1000); - expect(await workspaceName.textContent()).toBe('Demo Workspace'); + await expect(workspaceName).toHaveText('Demo Workspace'); const currentWorkspace = await workspace.current(); expect(currentWorkspace.meta.flavour).toContain('local'); diff --git a/tests/affine-local/e2e/peek-view.spec.ts b/tests/affine-local/e2e/peek-view.spec.ts index 2c856ca4d6..2d59315464 100644 --- a/tests/affine-local/e2e/peek-view.spec.ts +++ b/tests/affine-local/e2e/peek-view.spec.ts @@ -131,7 +131,6 @@ test('should not open peek view when content is covered by canvas element', asyn steps: 10, }); await page.mouse.dblclick(syncedDocCenter.x, syncedDocCenter.y); - await page.waitForTimeout(100); await expect(page.getByTestId('peek-view-modal')).toBeVisible(); // close peek view @@ -152,7 +151,15 @@ test('should not open peek view when content is covered by canvas element', asyn } ); await page.mouse.up(); - await page.waitForTimeout(100); + await expect + .poll(async () => { + try { + return (await getSelectedXYWH(page))[2]; + } catch { + return 0; + } + }) + .toBeGreaterThan(0); // click the same position again await page.mouse.move(syncedDocCenter.x, syncedDocCenter.y, { diff --git a/tests/affine-local/e2e/quick-search.spec.ts b/tests/affine-local/e2e/quick-search.spec.ts index a6e4935d3f..af3ea909d2 100644 --- a/tests/affine-local/e2e/quick-search.spec.ts +++ b/tests/affine-local/e2e/quick-search.spec.ts @@ -137,7 +137,8 @@ test('Create a new page without keyword', async ({ page }) => { await openQuickSearchByShortcut(page); const addNewPage = page.getByText('New page', { exact: true }); await addNewPage.click(); - await page.waitForTimeout(300); + await expect(page.getByTestId('cmdk-quick-search')).toBeHidden(); + await waitForEditorLoad(page); await assertTitle(page, ''); }); @@ -151,7 +152,8 @@ test('Create a new page with keyword', async ({ page }) => { '[cmdk-item] >> text=New ""test123456"" Page' ); await addNewPage.click(); - await page.waitForTimeout(300); + await expect(page.getByTestId('cmdk-quick-search')).toBeHidden(); + await waitForEditorLoad(page); await assertTitle(page, '"test123456"'); }); @@ -170,28 +172,27 @@ test('Create a new page and search this page', async ({ page }) => { await openQuickSearchByShortcut(page); // input title and create new page await insertInputText(page, 'test123456'); - await page.waitForTimeout(300); const addNewPage = page.locator('[cmdk-item] >> text=New "test123456" Page'); + await expect(addNewPage).toBeVisible(); await addNewPage.click(); - await page.waitForTimeout(300); + await expect(page.getByTestId('cmdk-quick-search')).toBeHidden(); + await waitForEditorLoad(page); await assertTitle(page, 'test123456'); await openQuickSearchByShortcut(page); await insertInputText(page, 'test123456'); - await page.waitForTimeout(1000); await assertResultList(page, ['test123456', 'test123456']); await page.keyboard.press('Enter'); - await page.waitForTimeout(300); + await expect(page.getByTestId('cmdk-quick-search')).toBeHidden(); await assertTitle(page, 'test123456'); await page.reload(); await waitForEditorLoad(page); await openQuickSearchByShortcut(page); await insertInputText(page, 'test123456'); - await page.waitForTimeout(1000); await assertResultList(page, ['test123456', 'test123456']); await page.keyboard.press('Enter'); - await page.waitForTimeout(300); + await expect(page.getByTestId('cmdk-quick-search')).toBeHidden(); await assertTitle(page, 'test123456'); }); @@ -228,7 +229,7 @@ test('Autofocus input after select', async ({ page }) => { await openHomePage(page); await waitForEditorLoad(page); await clickNewPageButton(page); - await page.waitForTimeout(500); // wait for new page loaded + await waitForEditorLoad(page); await openQuickSearchByShortcut(page); await page.keyboard.press('ArrowUp'); const locator = page.locator('[cmdk-input]'); @@ -266,7 +267,7 @@ test('assert the recent browse pages are on the recent list', async ({ { const title = getBlockSuiteEditorTitle(page); await title.click(); - await page.waitForTimeout(200); + await expect(title).toBeFocused(); await title.pressSequentially('sgtokidoki', { delay: 100 }); await expect(title).toHaveText('sgtokidoki'); } @@ -279,11 +280,10 @@ test('assert the recent browse pages are on the recent list', async ({ { const title = getBlockSuiteEditorTitle(page); await title.click(); - await page.waitForTimeout(200); + await expect(title).toBeFocused(); await title.pressSequentially('theliquidhorse', { delay: 100 }); await expect(title).toHaveText('theliquidhorse'); } - await page.waitForTimeout(200); // create thrid page await openQuickSearchByShortcut(page); @@ -292,7 +292,7 @@ test('assert the recent browse pages are on the recent list', async ({ { const title = getBlockSuiteEditorTitle(page); await title.click(); - await page.waitForTimeout(200); + await expect(title).toBeFocused(); await title.pressSequentially('battlekot', { delay: 100 }); await expect(title).toHaveText('battlekot'); } @@ -320,11 +320,10 @@ test('assert the recent browse pages are on the recent list', async ({ { const title = getBlockSuiteEditorTitle(page); await title.click(); - await page.waitForTimeout(200); + await expect(title).toBeFocused(); await title.pressSequentially('affine is the best', { delay: 100 }); await expect(title).toHaveText('affine is the best', { timeout: 500 }); } - await page.waitForTimeout(1000); await openQuickSearchByShortcut(page); { const quickSearchItems = page.locator( @@ -359,7 +358,6 @@ test('can use cmdk to delete page and restore it', async ({ page }) => { await page.getByTestId('confirm-modal-confirm').click(); const restoreButton = page.getByTestId('page-restore-button'); await expect(restoreButton).toBeVisible(); - await page.waitForTimeout(100); await openQuickSearchByShortcut(page); expect(await commandsIsVisible(page, 'Move to trash')).toBe(false); expect(await commandsIsVisible(page, 'Restore from trash')).toBe(true); @@ -388,7 +386,6 @@ test('can use cmdk to search page content and scroll to it, then the block will await clickSideBarAllPageButton(page); await openQuickSearchByShortcut(page); await insertInputText(page, '123456'); - await page.waitForTimeout(1000); await assertResultList(page, [ 'this is a new page to search for content', '123456', @@ -431,7 +428,7 @@ test('Create a new page with special characters in the title and search for this }) .toBe(true); await page.keyboard.press('Enter'); - await page.waitForTimeout(1000); + await expect(page.getByTestId('cmdk-quick-search')).toBeHidden(); await assertTitle(page, specialTitle); }); @@ -498,15 +495,10 @@ test('can use @ to open quick search to search for doc and insert into canvas', ).toContainText(docTitle); // focus on the note block - await page.waitForTimeout(500); - await page - .locator('affine-embed-edgeless-synced-doc-block') - .click({ force: true }); - await page.waitForTimeout(500); - // double clock to show peek view - await page - .locator('affine-embed-edgeless-synced-doc-block') - .dblclick({ force: true }); + const syncedDocBlock = page.locator('affine-embed-edgeless-synced-doc-block'); + await syncedDocBlock.click({ force: true }); + // double click to show peek view + await syncedDocBlock.dblclick({ force: true }); await expect(page.getByTestId('peek-view-modal')).toBeVisible(); }); diff --git a/tests/affine-local/e2e/settings.spec.ts b/tests/affine-local/e2e/settings.spec.ts index 82645a4e22..2188b82fd7 100644 --- a/tests/affine-local/e2e/settings.spec.ts +++ b/tests/affine-local/e2e/settings.spec.ts @@ -29,7 +29,7 @@ test('change language using keyboard', async ({ page }) => { const locator = page.getByTestId('language-menu-button'); const oldName = await locator.textContent(); await locator.click(); - await page.waitForTimeout(200); + await expect(page.getByRole('menu')).toBeVisible(); await page.keyboard.press('ArrowDown', { delay: 50, }); diff --git a/tests/affine-local/e2e/theme.spec.ts b/tests/affine-local/e2e/theme.spec.ts index 18bfe6d545..fa9d6ffd5e 100644 --- a/tests/affine-local/e2e/theme.spec.ts +++ b/tests/affine-local/e2e/theme.spec.ts @@ -21,7 +21,7 @@ test('default white', async ({ page }) => { }); await page.getByTestId('settings-modal-trigger').click(); await page.getByTestId('appearance-panel-trigger').click(); - await page.waitForTimeout(50); + await expect(page.getByTestId('dark-theme-trigger')).toBeVisible(); await page.getByTestId('dark-theme-trigger').click(); const darkMode = await root.evaluate(element => element.dataset.theme); expect(darkMode).toBe('dark'); diff --git a/tests/affine-local/e2e/undo-empty.spec.ts b/tests/affine-local/e2e/undo-empty.spec.ts index 9226a8a574..42384ee0ab 100644 --- a/tests/affine-local/e2e/undo-empty.spec.ts +++ b/tests/affine-local/e2e/undo-empty.spec.ts @@ -18,7 +18,7 @@ test('should be able to undo on empty page', async ({ page }) => { // test editor still work await page.locator('.edgeless-note-page-content').click({ force: true }); await page.locator('.edgeless-note-page-content').click({ force: true }); - await page.waitForTimeout(100); + await expect(page.locator('.edgeless-note-page-content')).toBeVisible(); await page .locator('.edgeless-note-page-content') .pressSequentially('test text'); diff --git a/tests/blocksuite/e2e/clipboard/clipboard.spec.ts b/tests/blocksuite/e2e/clipboard/clipboard.spec.ts index 4f5a979192..4e6c417bad 100644 --- a/tests/blocksuite/e2e/clipboard/clipboard.spec.ts +++ b/tests/blocksuite/e2e/clipboard/clipboard.spec.ts @@ -158,7 +158,7 @@ test(scoped`copy clipItems format`, async ({ page }) => { `; await pasteContent(page, { 'text/plain': clipData }); - await page.waitForTimeout(100); + await expect(page.locator('affine-list')).toHaveCount(4); await setSelection(page, 4, 1, 5, 1); assertClipItems(page, 'text/plain', 'bc'); assertClipItems(page, 'text/html', '
  • b
    • c
'); diff --git a/tests/blocksuite/e2e/clipboard/list.spec.ts b/tests/blocksuite/e2e/clipboard/list.spec.ts index 69152c1cf6..de31c2a7c8 100644 --- a/tests/blocksuite/e2e/clipboard/list.spec.ts +++ b/tests/blocksuite/e2e/clipboard/list.spec.ts @@ -441,7 +441,7 @@ test(scoped`should copy and paste of database work`, async ({ page }) => { await copyByKeyboard(page); await pressEnter(page); await pasteByKeyboard(page); - await page.waitForTimeout(100); + await expect(page.locator('affine-database')).toHaveCount(2); let pageJson = await getPageSnapshot(page, false); let note = (pageJson as BlockSnapshot).children[0]; diff --git a/tests/blocksuite/e2e/code/readonly.spec.ts b/tests/blocksuite/e2e/code/readonly.spec.ts index aada3d552f..063bee3e56 100644 --- a/tests/blocksuite/e2e/code/readonly.spec.ts +++ b/tests/blocksuite/e2e/code/readonly.spec.ts @@ -24,12 +24,12 @@ test('should code block widget be disabled in read only mode', async ({ await initEmptyCodeBlockState(page); await focusRichTextEnd(page); - await page.waitForTimeout(300); await switchReadonly(page); const codeBlockController = getCodeBlock(page); const codeBlock = codeBlockController.codeBlock; await codeBlock.hover(); + await expect(codeBlockController.moreButton).toHaveAttribute('disabled'); await codeBlockController.clickLanguageButton(); await expect(codeBlockController.langList).toBeHidden(); diff --git a/tests/blocksuite/e2e/edgeless/basic.spec.ts b/tests/blocksuite/e2e/edgeless/basic.spec.ts index c013a2c1c0..6f0b13c32d 100644 --- a/tests/blocksuite/e2e/edgeless/basic.spec.ts +++ b/tests/blocksuite/e2e/edgeless/basic.spec.ts @@ -326,8 +326,7 @@ test('the tooltip of more button should be hidden when the action menu is shown' throw new Error('moreButtonBox is not found'); } - // need to wait for previous tooltip to be hidden - await page.waitForTimeout(100); + await expect(tooltip).toBeHidden(); await page.mouse.move(moreButtonBox.x + 10, moreButtonBox.y + 10); await expect(tooltip).toBeVisible(); diff --git a/tests/blocksuite/e2e/edgeless/brush.spec.ts b/tests/blocksuite/e2e/edgeless/brush.spec.ts index 37fdc913d2..11fecb1e7d 100644 --- a/tests/blocksuite/e2e/edgeless/brush.spec.ts +++ b/tests/blocksuite/e2e/edgeless/brush.spec.ts @@ -162,8 +162,9 @@ test('change brush element size by component-toolbar', async ({ page }) => { const end = { x: 200, y: 200 }; await addBasicBrushElement(page, start, end); - // wait for menu hide animation - await page.waitForTimeout(500); + await expect(page.locator('edgeless-line-width-panel:visible')).toHaveCount( + 0 + ); // change to line width 12 await page.mouse.click(110, 110); diff --git a/tests/blocksuite/e2e/edgeless/clipboard.spec.ts b/tests/blocksuite/e2e/edgeless/clipboard.spec.ts index f87ece35c8..f6290cc900 100644 --- a/tests/blocksuite/e2e/edgeless/clipboard.spec.ts +++ b/tests/blocksuite/e2e/edgeless/clipboard.spec.ts @@ -44,8 +44,6 @@ test.describe('mime', () => { await pasteContent(page, content); - // wait for paste - await page.waitForTimeout(200); await assertRichImage(page, 1); }); diff --git a/tests/blocksuite/e2e/edgeless/frame/frame.spec.ts b/tests/blocksuite/e2e/edgeless/frame/frame.spec.ts index e2f2be6e67..f77a36e4f6 100644 --- a/tests/blocksuite/e2e/edgeless/frame/frame.spec.ts +++ b/tests/blocksuite/e2e/edgeless/frame/frame.spec.ts @@ -409,11 +409,10 @@ test('outline should keep updated during a new frame created by frame-tool dragg await page.mouse.move(start[0], start[1]); await page.mouse.down(); await page.mouse.move(end[0], end[1], { steps: 10 }); - await page.waitForTimeout(50); - expect( - await pickColorAtPoints(page, [start, [end[0] - 1, end[1] - 1]]) - ).toEqual(['#1e96eb', '#1e96eb']); + await expect + .poll(() => pickColorAtPoints(page, [start, [end[0] - 1, end[1] - 1]])) + .toEqual(['#1e96eb', '#1e96eb']); }); test('undo should work when create a frame by dragging', async ({ page }) => { diff --git a/tests/blocksuite/e2e/edgeless/note/note.spec.ts b/tests/blocksuite/e2e/edgeless/note/note.spec.ts index 149be914da..68eb2e04e1 100644 --- a/tests/blocksuite/e2e/edgeless/note/note.spec.ts +++ b/tests/blocksuite/e2e/edgeless/note/note.spec.ts @@ -236,7 +236,6 @@ test('format quick bar should show up when double-clicking on text', async ({ position: { x: 10, y: 10 }, delay: 20, }); - await page.waitForTimeout(200); const formatBar = page.locator('affine-toolbar-widget editor-toolbar'); await expect(formatBar).toBeVisible(); }); diff --git a/tests/blocksuite/e2e/edgeless/text.spec.ts b/tests/blocksuite/e2e/edgeless/text.spec.ts index b14d2d1193..ba26b62409 100644 --- a/tests/blocksuite/e2e/edgeless/text.spec.ts +++ b/tests/blocksuite/e2e/edgeless/text.spec.ts @@ -110,8 +110,7 @@ test.describe('edgeless canvas text', () => { state: 'attached', }); await type(page, 'hello'); - await page.waitForTimeout(100); - await assertEdgelessCanvasText(page, 'hhelloello'); + await expect(() => assertEdgelessCanvasText(page, 'hhelloello')).toPass(); await page.mouse.click(145, 155); await type(page, 'ddd\n'); diff --git a/tests/blocksuite/e2e/format-bar.spec.ts b/tests/blocksuite/e2e/format-bar.spec.ts index ced0f7c8a7..90c807fe8b 100644 --- a/tests/blocksuite/e2e/format-bar.spec.ts +++ b/tests/blocksuite/e2e/format-bar.spec.ts @@ -436,7 +436,6 @@ test('should format quick bar be able to change to heading paragraph type', asyn expect(await getPageSnapshot(page, true)).toMatchSnapshot( `${testInfo.title}_finial.json` ); - await page.waitForTimeout(10); // The paragraph button should prevent selection after click await assertRichTextInlineRange(page, 0, 0, 3); }); diff --git a/tests/blocksuite/e2e/list.spec.ts b/tests/blocksuite/e2e/list.spec.ts index 660b3d95f7..94f075ca6e 100644 --- a/tests/blocksuite/e2e/list.spec.ts +++ b/tests/blocksuite/e2e/list.spec.ts @@ -333,7 +333,7 @@ test('basic indent and unindent', async ({ page }, testInfo) => { `${testInfo.title}_after_tab.json` ); - await page.waitForTimeout(100); + await assertRichTextInlineRange(page, 1, 5); await pressShiftTab(page); expect(await getPageSnapshot(page, true)).toMatchSnapshot( diff --git a/tests/blocksuite/e2e/slash-menu.spec.ts b/tests/blocksuite/e2e/slash-menu.spec.ts index 938f0dc1e6..ae8f419dc1 100644 --- a/tests/blocksuite/e2e/slash-menu.spec.ts +++ b/tests/blocksuite/e2e/slash-menu.spec.ts @@ -767,7 +767,7 @@ test.describe('slash menu with style', () => { await expect(slashMenu).toBeVisible(); const bold = page.getByTestId('Bold'); await bold.click(); - await page.waitForTimeout(50); + await expect(slashMenu).toBeHidden(); await type(page, 'hello'); expect(await getPageSnapshot(page, true)).toMatchSnapshot( diff --git a/tests/blocksuite/e2e/utils/actions/misc.ts b/tests/blocksuite/e2e/utils/actions/misc.ts index 55e5210227..af7f1ecb1b 100644 --- a/tests/blocksuite/e2e/utils/actions/misc.ts +++ b/tests/blocksuite/e2e/utils/actions/misc.ts @@ -1066,8 +1066,10 @@ export async function getIndexCoordinate( [richTextIndex, vIndex]: [number, number], coordOffSet: { x: number; y: number } = { x: 0, y: 0 } ) { - for (let attempt = 0; attempt < 20; attempt++) { - const coord = await page.evaluate( + // Re-evaluated on every animation frame until the inline editor has laid out + // the range, instead of sleeping between fixed retries. + const coord = await page + .waitForFunction( ({ richTextIndex, vIndex, coordOffSet, currentEditorIndex }) => { const editorHost = document.querySelectorAll('editor-host')[currentEditorIndex]; @@ -1112,17 +1114,16 @@ export async function getIndexCoordinate( vIndex, coordOffSet, currentEditorIndex, - } - ); - if (coord) { - return coord; - } - await page.waitForTimeout(50); - } - - throw new Error( - `Failed to get index coordinate: richTextIndex=${richTextIndex}, vIndex=${vIndex}` - ); + }, + { polling: 'raf', timeout: 1000 } + ) + .catch(error => { + throw new Error( + `Failed to get index coordinate: richTextIndex=${richTextIndex}, vIndex=${vIndex}`, + { cause: error } + ); + }); + return (await coord.jsonValue()) as { x: number; y: number }; } export function inlineEditorInnerTextToString(innerText: string): string { diff --git a/tests/kit/src/utils/cloud.ts b/tests/kit/src/utils/cloud.ts index d493fd7dbe..53c1e20170 100644 --- a/tests/kit/src/utils/cloud.ts +++ b/tests/kit/src/utils/cloud.ts @@ -357,8 +357,7 @@ async function waitForWorkspaceSynced(page: Page) { export async function enableShare(page: Page) { await page.getByTestId('cloud-share-menu-button').click(); await page.getByTestId('share-link-menu-trigger').click(); - // wait for the menu to be visible - await page.waitForTimeout(500); + // click() waits for the menu item to be visible, stable and enabled. await page.getByTestId('share-link-menu-enable-share').click(); await expect(page.getByTestId('share-link-menu-trigger')).toHaveText( 'Read only', diff --git a/tests/kit/src/utils/properties.ts b/tests/kit/src/utils/properties.ts index 3a8676674b..29c8563c9c 100644 --- a/tests/kit/src/utils/properties.ts +++ b/tests/kit/src/utils/properties.ts @@ -107,7 +107,6 @@ export const ensureAddPropertyButtonVisible = async ( return; } await togglePropertyListVisibility(page); - await page.waitForTimeout(500); await expect( root.getByRole('button', { name: 'Add property' }) ).toBeVisible(); @@ -152,35 +151,6 @@ export const openWorkspaceProperties = async (page: Page) => { await page.getByTestId('workspace-setting:properties').click(); }; -export const selectVisibilitySelector = async ( - page: Page, - name: string, - option: string -) => { - await page - .getByRole('menu') - .locator( - `[data-testid="page-properties-settings-menu-item"]:has-text("${name}")` - ) - .getByRole('button') - .click(); - - await page - .getByRole('menu') - .last() - .getByRole('menuitem', { - name: option, - exact: true, - }) - .click(); - - await page.waitForTimeout(500); - - await page.keyboard.press('Escape'); - - await page.waitForTimeout(500); -}; - export const changePropertyVisibility = async ( page: Page, name: string,