Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

ci: reuse release binaries across validation suites

ldm09bae1b9992c3
diff --git a/.github/scripts/unpack-ci-release.sh b/.github/scripts/unpack-ci-release.sh
new file mode 100755
index 000000000..bb8eb8b68
--- /dev/null
+++ b/.github/scripts/unpack-ci-release.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [[ $# -lt 1 || $# -gt 2 ]]; then
+ echo "usage: $0 head|base [EXPECTED_REVISION]" >&2
+ exit 2
+fi
+
+side=$1
+case "$side" in
+ head|base) ;;
+ *) echo "invalid release side: $side" >&2; exit 2 ;;
+esac
+
+release_name="moli-release-$side"
+archive="target/ci-artifacts/$side/$release_name.tar.gz"
+test -f "$archive"
+mkdir -p target/ci-bin
+tar -xzf "$archive" -C target/ci-bin
+(cd "target/ci-bin/$release_name" && sha256sum --check SHA256SUMS)
+if [[ $# -eq 2 ]]; then
+ actual_revision=$(<"target/ci-bin/$release_name/revision.txt")
+ if [[ "$actual_revision" != "$2" ]]; then
+ echo "$side artifact revision mismatch: expected $2, got $actual_revision" >&2
+ exit 1
+ fi
+fi
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 69bc5723a..5d1416e55 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -2,17 +2,23 @@ name: CI
on:
pull_request:
- # The closed event exists only to supersede stale queued/running PR CI.
- types: [opened, synchronize, reopened, closed]
+ types: [opened, synchronize, reopened]
push:
branches:
- main
workflow_dispatch:
+ inputs:
+ base_ref:
+ description: Base commit or ref (defaults to the previous commit)
+ required: false
+ default: ""
+ head_ref:
+ description: Head commit or ref (defaults to the dispatched commit)
+ required: false
+ default: ""
concurrency:
- # github.ref changes to the base branch when a PR is merged, so use the
- # stable PR number to keep its closed event in the original PR CI group.
- group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
@@ -20,20 +26,68 @@ permissions:
env:
CARGO_TERM_COLOR: always
- # CI jobs use clean, one-shot builds, so incremental compiler state is not reused.
CARGO_INCREMENTAL: "0"
- # actions/checkout registers safe.directory through a temporary HOME that is
- # not retained by these container jobs. Keep Git trust scoped to this exact
- # checkout so vergen-gitcl can read the build revision without weakening the
- # container's policy for any other path.
GIT_CONFIG_COUNT: "1"
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: ${{ github.workspace }}
jobs:
+ resolve-refs:
+ name: Resolve exact revisions
+ runs-on: ubuntu-latest
+ outputs:
+ target_base_sha: ${{ steps.refs.outputs.target_base_sha }}
+ base_sha: ${{ steps.refs.outputs.base_sha }}
+ head_sha: ${{ steps.refs.outputs.head_sha }}
+ execution_order: ${{ steps.refs.outputs.execution_order }}
+ steps:
+ - name: Checkout exact HEAD
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ persist-credentials: false
+ ref: ${{ github.event.pull_request.head.sha || inputs.head_ref || github.sha }}
+
+ - name: Resolve HEAD and common ancestor
+ id: refs
+ shell: bash
+ env:
+ TARGET_BASE_REF: ${{ github.event.pull_request.base.sha || inputs.base_ref }}
+ HEAD_REF: ${{ github.event.pull_request.head.sha || inputs.head_ref || github.sha }}
+ EVENT_BEFORE: ${{ github.event.before }}
+ run: |
+ set -euo pipefail
+
+ head_sha=$(git rev-parse "${HEAD_REF}^{commit}")
+ target_base_ref=$TARGET_BASE_REF
+ if [[ -z "$target_base_ref" ]]; then
+ if [[ "$GITHUB_EVENT_NAME" == push \
+ && -n "$EVENT_BEFORE" \
+ && "$EVENT_BEFORE" != 0000000000000000000000000000000000000000 ]]; then
+ target_base_ref=$EVENT_BEFORE
+ else
+ target_base_ref="${head_sha}^"
+ fi
+ fi
+
+ target_base_sha=$(git rev-parse "${target_base_ref}^{commit}")
+ base_sha=$(git merge-base "$target_base_sha" "$head_sha")
+ git merge-base --is-ancestor "$base_sha" "$target_base_sha"
+ git merge-base --is-ancestor "$base_sha" "$head_sha"
+
+ if (( GITHUB_RUN_NUMBER % 2 == 0 )); then
+ execution_order=head-first
+ else
+ execution_order=base-first
+ fi
+
+ echo "target_base_sha=$target_base_sha" >> "$GITHUB_OUTPUT"
+ echo "base_sha=$base_sha" >> "$GITHUB_OUTPUT"
+ echo "head_sha=$head_sha" >> "$GITHUB_OUTPUT"
+ echo "execution_order=$execution_order" >> "$GITHUB_OUTPUT"
+
format:
name: Format
- if: github.event_name != 'pull_request' || github.event.action != 'closed'
runs-on: ubuntu-latest
container: rust:1.96.1-bookworm
steps:
@@ -48,7 +102,6 @@ jobs:
clippy:
name: Clippy
- if: github.event_name != 'pull_request' || github.event.action != 'closed'
runs-on: ubuntu-latest
container: rust:1.96.1-bookworm
steps:
@@ -68,7 +121,6 @@ jobs:
nextest:
name: Nextest
- if: github.event_name != 'pull_request' || github.event.action != 'closed'
runs-on: [self-hosted, moli-ci]
container: rust:1.96.1-bookworm
steps:
@@ -85,26 +137,17 @@ jobs:
with:
- # Keep one unpartitioned run so full-suite process and resource interactions
- # remain visible. The ci profile owns fail-fast and retry behavior.
- name: Run full workspace tests
run: cargo nextest run --workspace --profile ci
- protocol-smoke:
- name: CDP and WebDriver smoke
- if: github.event_name != 'pull_request' || github.event.action != 'closed'
+ python-harness-tests:
+ name: Python harness tests
runs-on: ubuntu-latest
- timeout-minutes: 60
- container: rust:1.96.1-bookworm
+ timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4
- - name: Install AWS-LC build dependencies
- run: |
- apt-get update
- apt-get install --yes --no-install-recommends cmake libclang-dev
-
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
@@ -112,82 +155,764 @@ jobs:
python-version: "3.12"
enable-cache: true
cache-dependency-glob: |
+ moli-benchmark/uv.lock
+ moli-frontend-smoke/uv.lock
moli-cdp-smoke/uv.lock
moli-webdriver-smoke/uv.lock
- - name: Install Node.js
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- with:
- node-version: 24.15.0
- cache: npm
- cache-dependency-path: moli-cdp-smoke/package-lock.json
-
- - name: Install smoke dependencies
+ - name: Install harness dependencies
run: |
+ uv sync --project moli-benchmark --locked
+ uv sync --project moli-frontend-smoke --locked
uv sync --project moli-cdp-smoke --locked
uv sync --project moli-webdriver-smoke --locked
- npm ci --prefix moli-cdp-smoke
+
+ - name: Test benchmark harness
+ shell: bash
+ run: |
+ set -euo pipefail
+ for test_file in moli-benchmark/tests/test_*.py; do
+ case "$test_file" in
+ */test_wpt_cross*.py) continue ;;
+ esac
+ uv run --project moli-benchmark --no-sync python "$test_file"
+ done
+
+ - name: Test frontend differential harness
+ run: uv run --project moli-frontend-smoke --no-sync pytest moli-frontend-smoke/tests
- name: Test CDP smoke diagnostics
run: >-
- uv run --project moli-cdp-smoke --no-sync
- python -m unittest discover
+ uv run --project moli-cdp-smoke --no-sync python -m unittest discover
--start-directory moli-cdp-smoke/tests
- - name: Build moli
- id: build_moli
- run: cargo build --release -p moli
-
- name: Test WebDriver smoke diagnostics
run: >-
- uv run --project moli-webdriver-smoke --no-sync
- python -m unittest discover
+ uv run --project moli-webdriver-smoke --no-sync python -m unittest discover
--start-directory moli-webdriver-smoke/tests
+ node-harness-tests:
+ name: Node harness and fixture tests
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
+ with:
+ node-version: 24.15.0
+ cache: npm
+ cache-dependency-path: |
+ moli-frontend-smoke/package-lock.json
+ moli-benchmark/browser-spider-local/package-lock.json
+ - name: Install dependencies
+ run: |
+ npm ci --prefix moli-frontend-smoke
+ npm ci --prefix moli-benchmark/browser-spider-local
+ - name: Validate frontend fixtures
+ working-directory: moli-frontend-smoke
+ run: |
+ npm run check:catalog
+ npm run test:node
+ npm run typecheck
+ npm run build
+ - name: Test Spider harness
+ working-directory: moli-benchmark/browser-spider-local
+ run: npm test
+
+ build-release-head:
+ name: Build release · HEAD
+ needs: resolve-refs
+ runs-on: [self-hosted, moli-ci]
+ timeout-minutes: 60
+ container: rust:1.96.1-bookworm
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ ref: ${{ needs.resolve-refs.outputs.head_sha }}
+ - name: Install AWS-LC build dependencies
+ run: |
+ apt-get update
+ apt-get install --yes --no-install-recommends cmake libclang-dev
+ - name: Build release binary
+ run: cargo build --release --locked -p moli
+ - name: Package release artifact
+ shell: bash
+ run: |
+ set -euo pipefail
+ package_dir=target/ci-package/moli-release-head
+ mkdir -p "$package_dir"
+ install -m 0755 target/release/moli "$package_dir/moli"
+ printf '%s\n' '${{ needs.resolve-refs.outputs.head_sha }}' > "$package_dir/revision.txt"
+ "$package_dir/moli" --version > "$package_dir/version.txt"
+ stat --format='%s' "$package_dir/moli" > "$package_dir/size-bytes.txt"
+ (cd "$package_dir" && sha256sum moli > SHA256SUMS)
+ tar -C target/ci-package -czf target/moli-release-head.tar.gz moli-release-head
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: moli-release-head
+ path: target/moli-release-head.tar.gz
+ if-no-files-found: error
+ retention-days: 3
+
+ build-release-base:
+ name: Build release · common ancestor
+ needs: resolve-refs
+ runs-on: [self-hosted, moli-ci]
+ timeout-minutes: 60
+ container: rust:1.96.1-bookworm
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ ref: ${{ needs.resolve-refs.outputs.base_sha }}
+ - name: Install AWS-LC build dependencies
+ run: |
+ apt-get update
+ apt-get install --yes --no-install-recommends cmake libclang-dev
+ - name: Build release binary
+ run: cargo build --release --locked -p moli
+ - name: Package release artifact
+ shell: bash
+ run: |
+ set -euo pipefail
+ package_dir=target/ci-package/moli-release-base
+ mkdir -p "$package_dir"
+ install -m 0755 target/release/moli "$package_dir/moli"
+ printf '%s\n' '${{ needs.resolve-refs.outputs.base_sha }}' > "$package_dir/revision.txt"
+ "$package_dir/moli" --version > "$package_dir/version.txt"
+ stat --format='%s' "$package_dir/moli" > "$package_dir/size-bytes.txt"
+ (cd "$package_dir" && sha256sum moli > SHA256SUMS)
+ tar -C target/ci-package -czf target/moli-release-base.tar.gz moli-release-base
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: moli-release-base
+ path: target/moli-release-base.tar.gz
+ if-no-files-found: error
+ retention-days: 3
+
+ cdp-smoke:
+ name: CDP smoke
+ needs: [resolve-refs, build-release-head]
+ runs-on: ubuntu-latest
+ timeout-minutes: 60
+ container: rust:1.96.1-bookworm
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ ref: ${{ needs.resolve-refs.outputs.head_sha }}
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: moli-release-head
+ path: target/ci-artifacts/head
+ - name: Verify HEAD release
+ run: .github/scripts/unpack-ci-release.sh head "${{ needs.resolve-refs.outputs.head_sha }}"
+ - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
+ with:
+ version: 0.11.14
+ python-version: "3.12"
+ enable-cache: true
+ cache-dependency-glob: moli-cdp-smoke/uv.lock
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
+ with:
+ node-version: 24.15.0
+ cache: npm
+ cache-dependency-path: moli-cdp-smoke/package-lock.json
+ - name: Install dependencies
+ run: |
+ uv sync --project moli-cdp-smoke --locked
+ npm ci --prefix moli-cdp-smoke
- name: Run full CDP smoke
- id: cdp
- continue-on-error: true
env:
- MOLI_BIN: ${{ github.workspace }}/target/release/moli
+ MOLI_BIN: ${{ github.workspace }}/target/ci-bin/moli-release-head/moli
run: >-
- uv run --project moli-cdp-smoke --no-sync
- moli-cdp-smoke
- --jobs 4
- --output-dir target/smoke/cdp-ci
-
- - name: Upload CDP smoke diagnostics
- if: ${{ always() && steps.cdp.outcome != 'skipped' }}
+ uv run --project moli-cdp-smoke --no-sync moli-cdp-smoke
+ --jobs 4 --output-dir target/smoke/cdp-ci
+ - name: Upload diagnostics
+ if: ${{ always() }}
continue-on-error: true
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: cdp-smoke-diagnostics
path: target/smoke/cdp-ci
if-no-files-found: warn
+ retention-days: 7
+ webdriver-smoke:
+ name: WebDriver smoke
+ needs: [resolve-refs, build-release-head]
+ runs-on: ubuntu-latest
+ timeout-minutes: 60
+ container: rust:1.96.1-bookworm
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ ref: ${{ needs.resolve-refs.outputs.head_sha }}
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: moli-release-head
+ path: target/ci-artifacts/head
+ - name: Verify HEAD release
+ run: .github/scripts/unpack-ci-release.sh head "${{ needs.resolve-refs.outputs.head_sha }}"
+ - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
+ with:
+ version: 0.11.14
+ python-version: "3.12"
+ enable-cache: true
+ cache-dependency-glob: moli-webdriver-smoke/uv.lock
+ - name: Install dependencies
+ run: uv sync --project moli-webdriver-smoke --locked
- name: Run full WebDriver smoke
- id: webdriver
- if: ${{ !cancelled() && steps.build_moli.outcome == 'success' }}
+ env:
+ MOLI_BIN: ${{ github.workspace }}/target/ci-bin/moli-release-head/moli
+ shell: bash
+ run: |
+ mkdir -p target/smoke/webdriver-ci
+ set -o pipefail
+ uv run --project moli-webdriver-smoke --no-sync \
+ moli-webdriver-smoke --continue-on-failure \
+ 2>&1 | tee target/smoke/webdriver-ci/run.log
+ - name: Upload diagnostics
+ if: ${{ always() }}
+ continue-on-error: true
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: webdriver-smoke-diagnostics
+ path: target/smoke/webdriver-ci
+ if-no-files-found: warn
+ retention-days: 7
+
+ frontend-differential:
+ name: Frontend differential · 1020 cases
+ needs: [resolve-refs, build-release-head]
+ runs-on: [self-hosted, moli-ci]
+ timeout-minutes: 45
+ container: mcr.microsoft.com/playwright/python:v1.58.0-noble
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ ref: ${{ needs.resolve-refs.outputs.head_sha }}
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: moli-release-head
+ path: target/ci-artifacts/head
+ - name: Verify HEAD release
+ run: .github/scripts/unpack-ci-release.sh head "${{ needs.resolve-refs.outputs.head_sha }}"
+ - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
+ with:
+ version: 0.11.14
+ python-version: "3.12"
+ enable-cache: true
+ cache-dependency-glob: |
+ moli-frontend-smoke/uv.lock
+ moli-cdp-smoke/uv.lock
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
+ with:
+ node-version: 24.15.0
+ cache: npm
+ cache-dependency-path: moli-frontend-smoke/package-lock.json
+ - name: Install dependencies and build fixtures
+ run: |
+ uv sync --project moli-frontend-smoke --locked
+ uv sync --project moli-cdp-smoke --locked
+ npm ci --prefix moli-frontend-smoke
+ npm run build --prefix moli-frontend-smoke
+ - name: Resolve pinned Chromium
+ id: chromium
+ shell: bash
+ run: |
+ set -euo pipefail
+ chromium_bin=$(uv run --project moli-cdp-smoke --no-sync python -c \
+ 'from playwright.sync_api import sync_playwright; p = sync_playwright().start(); print(p.chromium.executable_path); p.stop()')
+ test -x "$chromium_bin"
+ wrapper="$GITHUB_WORKSPACE/target/ci-bin/chromium-ci"
+ printf '%s\n' '#!/bin/sh' "exec \"$chromium_bin\" --no-sandbox \"\$@\"" > "$wrapper"
+ chmod 0755 "$wrapper"
+ echo "binary=$wrapper" >> "$GITHUB_OUTPUT"
+ - name: Run full differential
+ id: frontend
+ continue-on-error: true
+ run: >-
+ uv run --project moli-frontend-smoke --no-sync moli-frontend-smoke
+ --chromium-bin "${{ steps.chromium.outputs.binary }}"
+ --moli-bin "${{ github.workspace }}/target/ci-bin/moli-release-head/moli"
+ --output target/frontend-smoke
+ - name: Validate frontend artifacts
+ id: analysis
+ if: ${{ always() && steps.frontend.outcome != 'skipped' }}
+ continue-on-error: true
+ run: >-
+ uv run --project moli-frontend-smoke --no-sync
+ moli-frontend-smoke-analyze results target/frontend-smoke
+ - name: Upload frontend evidence
+ if: ${{ always() && steps.frontend.outcome != 'skipped' }}
continue-on-error: true
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: frontend-differential-results
+ path: target/frontend-smoke
+ if-no-files-found: warn
+ retention-days: 7
+ - name: Require differential and artifact validation
+ if: ${{ always() }}
env:
- MOLI_BIN: ${{ github.workspace }}/target/release/moli
+ FRONTEND_OUTCOME: ${{ steps.frontend.outcome }}
+ ANALYSIS_OUTCOME: ${{ steps.analysis.outcome }}
+ run: |
+ test "$FRONTEND_OUTCOME" = success
+ test "$ANALYSIS_OUTCOME" = success
+
+ runtime-contracts:
+ name: Runtime and CDP session contracts
+ needs: [resolve-refs, build-release-head]
+ runs-on: [self-hosted, moli-ci]
+ timeout-minutes: 30
+ container: rust:1.96.1-bookworm
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ ref: ${{ needs.resolve-refs.outputs.head_sha }}
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: moli-release-head
+ path: target/ci-artifacts/head
+ - name: Verify HEAD release
+ run: .github/scripts/unpack-ci-release.sh head "${{ needs.resolve-refs.outputs.head_sha }}"
+ - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
+ with:
+ version: 0.11.14
+ python-version: "3.12"
+ enable-cache: true
+ cache-dependency-glob: moli-benchmark/uv.lock
+ - name: Install dependencies
+ run: uv sync --project moli-benchmark --locked
+ - name: Run deterministic fetch contracts
+ run: >-
+ uv run --project moli-benchmark --no-sync moli-benchmark synthetic
+ --moli-bin "${{ github.workspace }}/target/ci-bin/moli-release-head/moli"
+ --runs 5 --output-dir target/benchmark/runtime-synthetic
+ - name: Run long-lived CDP session contracts
+ run: >-
+ uv run --project moli-benchmark --no-sync moli-benchmark cdp-session
+ --moli-bin "${{ github.workspace }}/target/ci-bin/moli-release-head/moli"
+ --target moli-cdp --gate-target moli-cdp --runs 3
+ --output-dir target/benchmark/cdp-session
+ - name: Upload evidence
+ if: ${{ always() }}
+ continue-on-error: true
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: runtime-contract-results
+ path: target/benchmark
+ if-no-files-found: warn
+ retention-days: 7
+
+ agent-episode:
+ name: Agent episodes · Moli vs Chromium
+ needs: [resolve-refs, build-release-head]
+ runs-on: [self-hosted, moli-ci]
+ timeout-minutes: 45
+ container: mcr.microsoft.com/playwright/python:v1.58.0-noble
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ ref: ${{ needs.resolve-refs.outputs.head_sha }}
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: moli-release-head
+ path: target/ci-artifacts/head
+ - name: Verify HEAD release
+ run: .github/scripts/unpack-ci-release.sh head "${{ needs.resolve-refs.outputs.head_sha }}"
+ - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
+ with:
+ version: 0.11.14
+ python-version: "3.12"
+ enable-cache: true
+ cache-dependency-glob: |
+ moli-benchmark/uv.lock
+ moli-cdp-smoke/uv.lock
+ - name: Install dependencies
+ run: |
+ uv sync --project moli-benchmark --locked
+ uv sync --project moli-cdp-smoke --locked
+ - name: Resolve pinned Chromium
+ id: chromium
+ run: |
+ chromium_bin=$(uv run --project moli-cdp-smoke --no-sync python -c \
+ 'from playwright.sync_api import sync_playwright; p = sync_playwright().start(); print(p.chromium.executable_path); p.stop()')
+ test -x "$chromium_bin"
+ echo "binary=$chromium_bin" >> "$GITHUB_OUTPUT"
+ - name: Run fast cross-engine contract
+ run: >-
+ uv run --project moli-benchmark --no-sync moli-benchmark agent-episode
+ --moli-bin "${{ github.workspace }}/target/ci-bin/moli-release-head/moli"
+ --chrome-bin "${{ steps.chromium.outputs.binary }}"
+ --step-dwell-ms 0 --output-dir target/benchmark/agent-fast
+ - name: Run idle-resource episode
+ run: >-
+ uv run --project moli-benchmark --no-sync moli-benchmark agent-episode
+ --moli-bin "${{ github.workspace }}/target/ci-bin/moli-release-head/moli"
+ --chrome-bin "${{ steps.chromium.outputs.binary }}"
+ --output-dir target/benchmark/agent-resource
+ - name: Upload evidence
+ if: ${{ always() }}
+ continue-on-error: true
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: agent-episode-results
+ path: target/benchmark
+ if-no-files-found: warn
+ retention-days: 7
+
+ release-regression:
+ name: Release startup, size, and matrix A/B
+ needs: [resolve-refs, build-release-head, build-release-base]
+ runs-on: [self-hosted, moli-ci]
+ timeout-minutes: 60
+ container: rust:1.96.1-bookworm
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ ref: ${{ needs.resolve-refs.outputs.head_sha }}
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: moli-release-head
+ path: target/ci-artifacts/head
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: moli-release-base
+ path: target/ci-artifacts/base
+ - name: Verify release artifacts
+ run: |
+ .github/scripts/unpack-ci-release.sh head "${{ needs.resolve-refs.outputs.head_sha }}"
+ .github/scripts/unpack-ci-release.sh base "${{ needs.resolve-refs.outputs.base_sha }}"
+ - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
+ with:
+ version: 0.11.14
+ python-version: "3.12"
+ enable-cache: true
+ cache-dependency-glob: moli-benchmark/uv.lock
+ - run: uv sync --project moli-benchmark --locked
+ - name: Measure common-ancestor startup and package
+ continue-on-error: true
+ run: >-
+ uv run --project moli-benchmark --no-sync moli-benchmark startup
+ --moli-bin "${{ github.workspace }}/target/ci-bin/moli-release-base/moli"
+ --profile formal --output-dir target/release-regression/base-startup
+ - name: Require HEAD startup and package workflow
+ run: >-
+ uv run --project moli-benchmark --no-sync moli-benchmark startup
+ --moli-bin "${{ github.workspace }}/target/ci-bin/moli-release-head/moli"
+ --profile formal --baseline-report target/release-regression/base-startup
+ --output-dir target/release-regression/head-startup
+ - name: Measure common-ancestor concurrency matrix
+ continue-on-error: true
+ run: >-
+ uv run --project moli-benchmark --no-sync moli-benchmark synthetic-matrix
+ --moli-bin "${{ github.workspace }}/target/ci-bin/moli-release-base/moli"
+ --profile smoke --output-dir target/release-regression/base-matrix
+ - name: Require HEAD concurrency matrix
+ run: >-
+ uv run --project moli-benchmark --no-sync moli-benchmark synthetic-matrix
+ --moli-bin "${{ github.workspace }}/target/ci-bin/moli-release-head/moli"
+ --profile smoke --baseline-report target/release-regression/base-matrix
+ --output-dir target/release-regression/head-matrix
+ - name: Upload evidence
+ if: ${{ always() }}
+ continue-on-error: true
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: release-regression-results
+ path: target/release-regression
+ if-no-files-found: warn
+ retention-days: 7
+
+ spider-fixture:
+ name: Deterministic Spider fixture
+ needs: [resolve-refs, build-release-head]
+ runs-on: [self-hosted, moli-ci]
+ timeout-minutes: 20
+ container: rust:1.96.1-bookworm
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ ref: ${{ needs.resolve-refs.outputs.head_sha }}
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: moli-release-head
+ path: target/ci-artifacts/head
+ - name: Verify HEAD release
+ run: .github/scripts/unpack-ci-release.sh head "${{ needs.resolve-refs.outputs.head_sha }}"
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
+ with:
+ node-version: 24.15.0
+ cache: npm
+ cache-dependency-path: moli-benchmark/browser-spider-local/package-lock.json
+ - run: npm ci --prefix moli-benchmark/browser-spider-local
+ - name: Require exact fixture contract
run: >-
- uv run --project moli-webdriver-smoke --no-sync
- moli-webdriver-smoke
- --continue-on-failure
+ node moli-benchmark/browser-spider-local/bench.mjs
+ --target moli
+ --moli-bin "${{ github.workspace }}/target/ci-bin/moli-release-head/moli"
+ --workers 1 --parallelism 1 --runs 1
+ --site-source fixture --goto-timeout-ms 1500 --server-hang-ms 3000
+ --sample-interval-ms 100 --assert-fixture-contract
+ --output-dir target/spider-fixture
+ - name: Upload evidence
+ if: ${{ always() }}
+ continue-on-error: true
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: spider-fixture-results
+ path: target/spider-fixture
+ if-no-files-found: warn
+ retention-days: 7
- - name: Require all protocol smoke suites
- if: ${{ always() && !cancelled() && steps.build_moli.outcome == 'success' }}
+ spider-bench:
+ name: Spider public-web A/B
+ needs: [resolve-refs, build-release-head, build-release-base]
+ if: >-
+ github.event_name != 'pull_request' ||
+ (github.event.pull_request.head.repo.full_name == github.repository &&
+ github.actor != 'dependabot[bot]')
+ runs-on: [self-hosted, moli-ci]
+ timeout-minutes: 90
+ container: rust:1.96.1-bookworm
+ env:
+ BENCHMARK_OUTPUT: spider-bench-results
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ ref: ${{ needs.resolve-refs.outputs.head_sha }}
+ - name: Initialize benchmark evidence
+ shell: bash
+ run: |
+ mkdir -p "$BENCHMARK_OUTPUT"
+ printf '{\n "schema": "moli.browser-spider.run-metadata.v1",\n "status": "resolved",\n "target_base": { "sha": "%s" },\n "base": { "sha": "%s", "role": "common-ancestor" },\n "head": { "sha": "%s" },\n "harness": { "sha": "%s", "role": "exact-head" },\n "execution_order": "%s"\n}\n' \
+ "${{ needs.resolve-refs.outputs.target_base_sha }}" \
+ "${{ needs.resolve-refs.outputs.base_sha }}" \
+ "${{ needs.resolve-refs.outputs.head_sha }}" \
+ "${{ needs.resolve-refs.outputs.head_sha }}" \
+ "${{ needs.resolve-refs.outputs.execution_order }}" \
+ > "$BENCHMARK_OUTPUT/run-metadata.json"
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: moli-release-head
+ path: target/ci-artifacts/head
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: moli-release-base
+ path: target/ci-artifacts/base
+ - name: Verify release artifacts
+ run: |
+ .github/scripts/unpack-ci-release.sh head "${{ needs.resolve-refs.outputs.head_sha }}"
+ .github/scripts/unpack-ci-release.sh base "${{ needs.resolve-refs.outputs.base_sha }}"
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
+ with:
+ node-version: 24.15.0
+ cache: npm
+ cache-dependency-path: moli-benchmark/browser-spider-local/package-lock.json
+ - run: npm ci --prefix moli-benchmark/browser-spider-local
+ - name: Run deterministic and public-web A/B
+ run: >-
+ node moli-benchmark/browser-spider-local/compare.mjs run
+ --base-bin "${{ github.workspace }}/target/ci-bin/moli-release-base/moli"
+ --head-bin "${{ github.workspace }}/target/ci-bin/moli-release-head/moli"
+ --base-sha "${{ needs.resolve-refs.outputs.base_sha }}"
+ --head-sha "${{ needs.resolve-refs.outputs.head_sha }}"
+ --execution-order "${{ needs.resolve-refs.outputs.execution_order }}"
+ --output-dir "$BENCHMARK_OUTPUT"
+ --run-url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
+ - name: Render job summary
+ if: ${{ always() && !cancelled() }}
+ continue-on-error: true
+ run: |
+ if [[ -f "$BENCHMARK_OUTPUT/comment.md" ]]; then
+ cat "$BENCHMARK_OUTPUT/comment.md" >> "$GITHUB_STEP_SUMMARY"
+ fi
+ - name: Upload full evidence
+ if: ${{ always() && !cancelled() }}
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: spider-bench-results
+ path: ${{ env.BENCHMARK_OUTPUT }}
+ if-no-files-found: error
+ retention-days: 14
+
+ sequential-navigation-soak:
+ name: Sequential navigation soak · 200 A/B
+ needs: [resolve-refs, build-release-head, build-release-base]
+ if: >-
+ github.event_name != 'pull_request' ||
+ (github.event.pull_request.head.repo.full_name == github.repository &&
+ github.actor != 'dependabot[bot]')
+ runs-on: [self-hosted, moli-ci]
+ timeout-minutes: 90
+ container: rust:1.96.1-bookworm
+ env:
+ BENCHMARK_OUTPUT: sequential-navigation-soak-results
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ ref: ${{ needs.resolve-refs.outputs.head_sha }}
+ - name: Initialize soak evidence
+ shell: bash
+ run: |
+ mkdir -p "$BENCHMARK_OUTPUT"
+ printf '{\n "schema": "moli.sequential-navigation.run-metadata.v1",\n "status": "resolved",\n "target_base": { "sha": "%s" },\n "base": { "sha": "%s", "role": "common-ancestor" },\n "head": { "sha": "%s" },\n "harness": { "sha": "%s", "role": "exact-head" },\n "execution_order": "%s",\n "navigation_count": 200\n}\n' \
+ "${{ needs.resolve-refs.outputs.target_base_sha }}" \
+ "${{ needs.resolve-refs.outputs.base_sha }}" \
+ "${{ needs.resolve-refs.outputs.head_sha }}" \
+ "${{ needs.resolve-refs.outputs.head_sha }}" \
+ "${{ needs.resolve-refs.outputs.execution_order }}" \
+ > "$BENCHMARK_OUTPUT/run-metadata.json"
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: moli-release-head
+ path: target/ci-artifacts/head
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
+ with:
+ name: moli-release-base
+ path: target/ci-artifacts/base
+ - name: Verify release artifacts
+ run: |
+ .github/scripts/unpack-ci-release.sh head "${{ needs.resolve-refs.outputs.head_sha }}"
+ .github/scripts/unpack-ci-release.sh base "${{ needs.resolve-refs.outputs.base_sha }}"
+ - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
+ with:
+ version: 0.11.14
+ python-version: "3.12"
+ enable-cache: true
+ cache-dependency-glob: moli-benchmark/uv.lock
+ - run: uv sync --project moli-benchmark --locked
+ - name: Run one-session public-web A/B
+ id: soak
+ shell: bash
env:
- CDP_OUTCOME: ${{ steps.cdp.outcome }}
- WEBDRIVER_OUTCOME: ${{ steps.webdriver.outcome }}
+ EXECUTION_ORDER: ${{ needs.resolve-refs.outputs.execution_order }}
run: |
- failed=0
- if [ "$CDP_OUTCOME" != success ]; then
- echo "CDP smoke: $CDP_OUTCOME"
- failed=1
+ set -euo pipefail
+ run_side() {
+ local side=$1
+ local binary=$2
+ set +e
+ uv run --project moli-benchmark --no-sync python \
+ moli-benchmark/scripts/fuzz-cdp-sequential-navigate.py \
+ --engine moli --moli-bin "$binary" \
+ --url https://www.csdn.net/ \
+ --url https://segmentfault.com/ \
+ --url https://huaban.com/ \
+ --url https://example.com/ \
+ --rounds 50 --network-diagnostics --navigation-resource-samples \
+ --response-timeout 15 --dcl-timeout 14 --load-timeout 20 \
+ --postcheck-timeout 5 --recovery-timeout 8 \
+ --output "$BENCHMARK_OUTPUT/$side.json"
+ local status=$?
+ set -e
+ echo "${side}_exit_code=$status" >> "$GITHUB_OUTPUT"
+ }
+ if [[ "$EXECUTION_ORDER" == head-first ]]; then
+ run_side head "${{ github.workspace }}/target/ci-bin/moli-release-head/moli"
+ run_side base "${{ github.workspace }}/target/ci-bin/moli-release-base/moli"
+ else
+ run_side base "${{ github.workspace }}/target/ci-bin/moli-release-base/moli"
+ run_side head "${{ github.workspace }}/target/ci-bin/moli-release-head/moli"
fi
- if [ "$WEBDRIVER_OUTCOME" != success ]; then
- echo "WebDriver smoke: $WEBDRIVER_OUTCOME"
- failed=1
+ - name: Compare resilience and memory evidence
+ id: comparison
+ if: ${{ always() && !cancelled() && steps.soak.outcome == 'success' }}
+ env:
+ PYTHONPATH: moli-benchmark
+ run: >-
+ uv run --project moli-benchmark --no-sync python
+ -m moli_benchmark.sequential_navigate_ci compare
+ --base-report "$BENCHMARK_OUTPUT/base.json"
+ --head-report "$BENCHMARK_OUTPUT/head.json"
+ --base-exit-code "${{ steps.soak.outputs.base_exit_code }}"
+ --head-exit-code "${{ steps.soak.outputs.head_exit_code }}"
+ --base-sha "${{ needs.resolve-refs.outputs.base_sha }}"
+ --head-sha "${{ needs.resolve-refs.outputs.head_sha }}"
+ --execution-order "${{ needs.resolve-refs.outputs.execution_order }}"
+ --expected-navigations 200
+ --output "$BENCHMARK_OUTPUT/comparison.json"
+ --comment-output "$BENCHMARK_OUTPUT/comment.md"
+ --run-url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
+ --conclusion local
+ - name: Render job summary
+ if: ${{ always() && !cancelled() }}
+ continue-on-error: true
+ run: |
+ if [[ -f "$BENCHMARK_OUTPUT/comment.md" ]]; then
+ cat "$BENCHMARK_OUTPUT/comment.md" >> "$GITHUB_STEP_SUMMARY"
fi
- exit "$failed"
+ - name: Upload full evidence
+ if: ${{ always() && !cancelled() }}
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: sequential-navigation-soak-results
+ path: ${{ env.BENCHMARK_OUTPUT }}
+ if-no-files-found: error
+ retention-days: 14
+ - name: Require complete HEAD resilience evidence
+ if: ${{ always() && !cancelled() && steps.comparison.outcome == 'success' }}
+ env:
+ PYTHONPATH: moli-benchmark
+ run: >-
+ uv run --project moli-benchmark --no-sync python
+ -m moli_benchmark.sequential_navigate_ci check
+ --input "$BENCHMARK_OUTPUT/comparison.json"
+
+ required:
+ name: Required
+ if: ${{ always() && !cancelled() }}
+ needs:
+ - format
+ - clippy
+ - nextest
+ - python-harness-tests
+ - node-harness-tests
+ - build-release-head
+ - build-release-base
+ - cdp-smoke
+ - webdriver-smoke
+ - frontend-differential
+ - runtime-contracts
+ - agent-episode
+ - release-regression
+ - spider-fixture
+ runs-on: ubuntu-latest
+ env:
+ REQUIRED_RESULTS: >-
+ ${{ needs.format.result }}
+ ${{ needs.clippy.result }}
+ ${{ needs.nextest.result }}
+ ${{ needs.python-harness-tests.result }}
+ ${{ needs.node-harness-tests.result }}
+ ${{ needs.build-release-head.result }}
+ ${{ needs.build-release-base.result }}
+ ${{ needs.cdp-smoke.result }}
+ ${{ needs.webdriver-smoke.result }}
+ ${{ needs.frontend-differential.result }}
+ ${{ needs.runtime-contracts.result }}
+ ${{ needs.agent-episode.result }}
+ ${{ needs.release-regression.result }}
+ ${{ needs.spider-fixture.result }}
+ steps:
+ - name: Require every deterministic check
+ run: |
+ set -euo pipefail
+ for result in $REQUIRED_RESULTS; do
+ if [[ "$result" != success ]]; then
+ echo "required CI dependency finished with: $result"
+ exit 1
+ fi
+ done
diff --git a/.github/workflows/sequential-navigation-soak-comment.yml b/.github/workflows/sequential-navigation-soak-comment.yml
index 66ce5fa36..6ef2dd7c7 100644
--- a/.github/workflows/sequential-navigation-soak-comment.yml
+++ b/.github/workflows/sequential-navigation-soak-comment.yml
@@ -2,7 +2,7 @@ name: Sequential Navigation Soak Comment
on:
workflow_run:
- workflows: [Sequential Navigation Soak]
+ workflows: [CI]
types: [completed]
# This workflow runs from the default branch. It never executes the measured
@@ -48,10 +48,16 @@ jobs:
EVIDENCE_OUTCOME: ${{ steps.evidence.outcome }}
run: |
if [[ "$EVIDENCE_OUTCOME" == success && -f sequential-navigation-soak-results/comparison.json ]]; then
+ if python3 -m moli_benchmark.sequential_navigate_ci check \
+ --input sequential-navigation-soak-results/comparison.json; then
+ benchmark_conclusion=success
+ else
+ benchmark_conclusion=failure
+ fi
python3 -m moli_benchmark.sequential_navigate_ci comment \
--input sequential-navigation-soak-results/comparison.json \
--run-url "$RUN_URL" \
- --conclusion "$CONCLUSION" \
+ --conclusion "$benchmark_conclusion" \
--output sequential-navigation-soak-comment.md
echo "has_comparison=true" >> "$GITHUB_OUTPUT"
else
diff --git a/.github/workflows/sequential-navigation-soak.yml b/.github/workflows/sequential-navigation-soak.yml
deleted file mode 100644
index a0546c252..000000000
--- a/.github/workflows/sequential-navigation-soak.yml
+++ /dev/null
@@ -1,216 +0,0 @@
-name: Sequential Navigation Soak
-
-on:
- pull_request:
- types: [opened, synchronize, reopened]
- workflow_dispatch:
- inputs:
- base_ref:
- description: Base commit or ref
- required: false
- default: main
- head_ref:
- description: Head commit or ref (defaults to the dispatched commit)
- required: false
- default: ""
-
-concurrency:
- group: sequential-navigation-soak-${{ github.event.pull_request.number || github.ref }}
- cancel-in-progress: true
-
-# Candidate code builds and runs without a token capable of writing to GitHub.
-# A separate workflow_run workflow renders the artifact from the default branch.
-permissions:
- contents: read
-
-env:
- CARGO_TERM_COLOR: always
- CARGO_INCREMENTAL: "0"
-
-jobs:
- compare:
- name: 200 navigations · Base vs HEAD
- if: >-
- github.event_name != 'pull_request' ||
- (github.event.pull_request.head.repo.full_name == github.repository &&
- github.actor != 'dependabot[bot]')
- runs-on: [self-hosted, moli-ci]
- timeout-minutes: 90
- container: rust:1.96.1-bookworm
- env:
- BENCHMARK_OUTPUT: sequential-navigation-soak-results
- BINARY_DIR: /tmp/moli-sequential-navigation-binaries
- TARGET_BASE_REF: ${{ github.event.pull_request.base.sha || inputs.base_ref || github.event.repository.default_branch }}
- HEAD_REF: ${{ github.event.pull_request.head.sha || inputs.head_ref || github.sha }}
- steps:
- # The exact HEAD harness drives both binaries, so an A/B run uses one
- # report schema and one URL order. This job has read-only permissions.
- - name: Checkout exact HEAD harness
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- persist-credentials: false
- ref: ${{ github.event.pull_request.head.sha || inputs.head_ref || github.sha }}
-
- - name: Install AWS-LC build dependencies
- run: |
- apt-get update
- apt-get install --yes --no-install-recommends cmake libclang-dev
-
- - name: Resolve commits and initialize evidence
- id: refs
- shell: bash
- run: |
- set -euo pipefail
- git config --global --add safe.directory "$(pwd -P)"
-
- mkdir -p "$BENCHMARK_OUTPUT"
- printf '%s\n' '{"schema":"moli.sequential-navigation.run-metadata.v1","status":"initializing"}' \
- > "$BENCHMARK_OUTPUT/run-metadata.json"
-
- target_base_sha=$(git rev-parse "${TARGET_BASE_REF}^{commit}")
- head_sha=$(git rev-parse "${HEAD_REF}^{commit}")
- base_sha=$(git merge-base "$target_base_sha" "$head_sha")
- git merge-base --is-ancestor "$base_sha" "$target_base_sha"
- git merge-base --is-ancestor "$base_sha" "$head_sha"
- echo "target_base_sha=$target_base_sha" >> "$GITHUB_OUTPUT"
- echo "base_sha=$base_sha" >> "$GITHUB_OUTPUT"
- echo "head_sha=$head_sha" >> "$GITHUB_OUTPUT"
-
- if (( GITHUB_RUN_NUMBER % 2 == 0 )); then
- execution_order=head-first
- else
- execution_order=base-first
- fi
- echo "execution_order=$execution_order" >> "$GITHUB_OUTPUT"
-
- printf '{\n "schema": "moli.sequential-navigation.run-metadata.v1",\n "status": "resolved",\n "target_base": { "sha": "%s" },\n "base": { "sha": "%s", "role": "common-ancestor" },\n "head": { "sha": "%s" },\n "harness": { "sha": "%s", "role": "exact-head" },\n "execution_order": "%s",\n "navigation_count": 200\n}\n' \
- "$target_base_sha" "$base_sha" "$head_sha" "$head_sha" \
- "$execution_order" > "$BENCHMARK_OUTPUT/run-metadata.json"
-
- - name: Build common-ancestor base and exact HEAD release binaries
- shell: bash
- env:
- BASE_SHA: ${{ steps.refs.outputs.base_sha }}
- HEAD_SHA: ${{ steps.refs.outputs.head_sha }}
- run: |
- set -euo pipefail
- mkdir -p "$BINARY_DIR"
-
- restore_harness() {
- git checkout --detach "$HEAD_SHA"
- }
- trap restore_harness EXIT
-
- git checkout --detach "$BASE_SHA"
- cargo build --release --locked -p moli
- install -m 755 target/release/moli "$BINARY_DIR/moli-base"
-
- git checkout --detach "$HEAD_SHA"
- cargo build --release --locked -p moli
- install -m 755 target/release/moli "$BINARY_DIR/moli-head"
-
- restore_harness
- trap - EXIT
-
- - name: Install uv
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- with:
- version: 0.11.14
- python-version: "3.12"
- enable-cache: true
- cache-dependency-glob: moli-benchmark/uv.lock
-
- - name: Install benchmark dependencies
- run: uv sync --project moli-benchmark --locked
-
- - name: Run one-session public-web A/B
- id: soak
- shell: bash
- env:
- EXECUTION_ORDER: ${{ steps.refs.outputs.execution_order }}
- run: |
- set -euo pipefail
-
- run_side() {
- local side=$1
- local binary=$2
- local report="$BENCHMARK_OUTPUT/$side.json"
- set +e
- uv run --project moli-benchmark --no-sync python \
- moli-benchmark/scripts/fuzz-cdp-sequential-navigate.py \
- --engine moli \
- --moli-bin "$binary" \
- --url https://www.csdn.net/ \
- --url https://segmentfault.com/ \
- --url https://huaban.com/ \
- --url https://example.com/ \
- --rounds 50 \
- --network-diagnostics \
- --navigation-resource-samples \
- --response-timeout 15 \
- --dcl-timeout 14 \
- --load-timeout 20 \
- --postcheck-timeout 5 \
- --recovery-timeout 8 \
- --output "$report"
- local status=$?
- set -e
- echo "${side}_exit_code=$status" >> "$GITHUB_OUTPUT"
- }
-
- if [[ "$EXECUTION_ORDER" == head-first ]]; then
- run_side head "$BINARY_DIR/moli-head"
- run_side base "$BINARY_DIR/moli-base"
- else
- run_side base "$BINARY_DIR/moli-base"
- run_side head "$BINARY_DIR/moli-head"
- fi
-
- - name: Compare resilience and memory evidence
- id: comparison
- if: ${{ always() && !cancelled() && steps.soak.outcome == 'success' }}
- env:
- PYTHONPATH: moli-benchmark
- run: >-
- uv run --project moli-benchmark --no-sync python
- -m moli_benchmark.sequential_navigate_ci compare
- --base-report "$BENCHMARK_OUTPUT/base.json"
- --head-report "$BENCHMARK_OUTPUT/head.json"
- --base-exit-code "${{ steps.soak.outputs.base_exit_code }}"
- --head-exit-code "${{ steps.soak.outputs.head_exit_code }}"
- --base-sha "${{ steps.refs.outputs.base_sha }}"
- --head-sha "${{ steps.refs.outputs.head_sha }}"
- --execution-order "${{ steps.refs.outputs.execution_order }}"
- --expected-navigations 200
- --output "$BENCHMARK_OUTPUT/comparison.json"
- --comment-output "$BENCHMARK_OUTPUT/comment.md"
- --run-url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
- --conclusion local
-
- - name: Render Actions job summary
- if: ${{ always() && !cancelled() }}
- continue-on-error: true
- shell: bash
- run: |
- if [[ -f "$BENCHMARK_OUTPUT/comment.md" ]]; then
- cat "$BENCHMARK_OUTPUT/comment.md" >> "$GITHUB_STEP_SUMMARY"
- fi
-
- - name: Upload full soak evidence
- if: ${{ always() && !cancelled() }}
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
- with:
- name: sequential-navigation-soak-results
- path: ${{ env.BENCHMARK_OUTPUT }}
- if-no-files-found: error
- retention-days: 14
-
- - name: Require complete HEAD resilience evidence
- if: ${{ always() && !cancelled() && steps.comparison.outcome == 'success' }}
- env:
- PYTHONPATH: moli-benchmark
- run: >-
- uv run --project moli-benchmark --no-sync python
- -m moli_benchmark.sequential_navigate_ci check
- --input "$BENCHMARK_OUTPUT/comparison.json"
diff --git a/.github/workflows/spider-bench-comment.yml b/.github/workflows/spider-bench-comment.yml
index 8c8eb5529..bab13451f 100644
--- a/.github/workflows/spider-bench-comment.yml
+++ b/.github/workflows/spider-bench-comment.yml
@@ -2,7 +2,7 @@ name: Spider Bench Comment
on:
workflow_run:
- workflows: [Spider Bench]
+ workflows: [CI]
types: [completed]
# This trusted workflow runs from the default branch. It never executes code
@@ -55,7 +55,7 @@ jobs:
node moli-benchmark/browser-spider-local/compare.mjs comment \
--input spider-bench-results/comparison.json \
--run-url "$RUN_URL" \
- --conclusion "$CONCLUSION" \
+ --conclusion success \
--output spider-bench-comment.md
echo "has_comparison=true" >> "$GITHUB_OUTPUT"
else
diff --git a/.github/workflows/spider-bench.yml b/.github/workflows/spider-bench.yml
deleted file mode 100644
index fdf34376c..000000000
--- a/.github/workflows/spider-bench.yml
+++ /dev/null
@@ -1,162 +0,0 @@
-name: Spider Bench
-
-on:
- pull_request:
- types: [opened, synchronize, reopened]
- workflow_dispatch:
- inputs:
- base_ref:
- description: Base commit or ref
- required: false
- default: main
- head_ref:
- description: Head commit or ref (defaults to the dispatched commit)
- required: false
- default: ""
-
-concurrency:
- group: spider-bench-${{ github.event.pull_request.number || github.ref }}
- cancel-in-progress: true
-
-# PR code builds and runs without a token capable of writing back to GitHub.
-# The separate Spider Bench Comment workflow consumes the resulting artifact.
-permissions:
- contents: read
-
-env:
- CARGO_TERM_COLOR: always
- CARGO_INCREMENTAL: "0"
-
-jobs:
- compare:
- name: Base vs HEAD
- if: >-
- github.event_name != 'pull_request' ||
- (github.event.pull_request.head.repo.full_name == github.repository &&
- github.actor != 'dependabot[bot]')
- runs-on: [self-hosted, moli-ci]
- timeout-minutes: 90
- container: rust:1.96.1-bookworm
- env:
- BENCHMARK_OUTPUT: spider-bench-results
- BINARY_DIR: /tmp/moli-spider-bench-binaries
- TARGET_BASE_REF: ${{ github.event.pull_request.base.sha || inputs.base_ref || github.event.repository.default_branch }}
- HEAD_REF: ${{ github.event.pull_request.head.sha || inputs.head_ref || github.sha }}
- steps:
- # The benchmark harness is infrastructure, not part of the candidate
- # being measured. Keep it on the trusted target base even when the PR
- # branch predates the harness itself.
- - name: Checkout trusted target-base harness
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- persist-credentials: false
- ref: ${{ github.event.pull_request.base.sha || inputs.base_ref || github.event.repository.default_branch }}
-
- - name: Install AWS-LC build dependencies
- run: |
- apt-get update
- apt-get install --yes --no-install-recommends cmake libclang-dev
-
- - name: Resolve commits and initialize evidence
- id: refs
- shell: bash
- run: |
- set -euo pipefail
- # actions/checkout writes safe.directory through a temporary HOME.
- # Re-register it in the container user's persistent HOME before the
- # first git command run by this job.
- git config --global --add safe.directory "$(pwd -P)"
-
- mkdir -p "$BENCHMARK_OUTPUT"
- printf '%s\n' '{"schema":"moli.browser-spider.run-metadata.v1","status":"initializing"}' \
- > "$BENCHMARK_OUTPUT/run-metadata.json"
-
- target_base_sha=$(git rev-parse "${TARGET_BASE_REF}^{commit}")
- head_sha=$(git rev-parse "${HEAD_REF}^{commit}")
- base_sha=$(git merge-base "$target_base_sha" "$head_sha")
- git merge-base --is-ancestor "$base_sha" "$target_base_sha"
- git merge-base --is-ancestor "$base_sha" "$head_sha"
- echo "target_base_sha=$target_base_sha" >> "$GITHUB_OUTPUT"
- echo "base_sha=$base_sha" >> "$GITHUB_OUTPUT"
- echo "head_sha=$head_sha" >> "$GITHUB_OUTPUT"
-
- if (( GITHUB_RUN_NUMBER % 2 == 0 )); then
- execution_order=head-first
- else
- execution_order=base-first
- fi
- echo "execution_order=$execution_order" >> "$GITHUB_OUTPUT"
-
- printf '{\n "schema": "moli.browser-spider.run-metadata.v1",\n "status": "resolved",\n "target_base": { "sha": "%s" },\n "base": { "sha": "%s", "role": "common-ancestor" },\n "head": { "sha": "%s" },\n "harness": { "sha": "%s" },\n "execution_order": "%s"\n}\n' \
- "$target_base_sha" "$base_sha" "$head_sha" "$target_base_sha" \
- "$execution_order" > "$BENCHMARK_OUTPUT/run-metadata.json"
-
- - name: Build common-ancestor base and exact HEAD release binaries
- shell: bash
- env:
- TARGET_BASE_SHA: ${{ steps.refs.outputs.target_base_sha }}
- BASE_SHA: ${{ steps.refs.outputs.base_sha }}
- HEAD_SHA: ${{ steps.refs.outputs.head_sha }}
- run: |
- set -euo pipefail
- mkdir -p "$BINARY_DIR"
-
- restore_harness() {
- git checkout --detach "$TARGET_BASE_SHA"
- }
- trap restore_harness EXIT
-
- git checkout --detach "$BASE_SHA"
- cargo build --release --locked -p moli
- install -m 755 target/release/moli "$BINARY_DIR/moli-base"
-
- git checkout --detach "$HEAD_SHA"
- cargo build --release --locked -p moli
- install -m 755 target/release/moli "$BINARY_DIR/moli-head"
-
- restore_harness
- trap - EXIT
-
- - name: Install Node.js
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- with:
- node-version: 24.15.0
- cache: npm
- cache-dependency-path: moli-benchmark/browser-spider-local/package-lock.json
-
- - name: Install Spider Bench dependencies
- run: npm ci --prefix moli-benchmark/browser-spider-local
-
- - name: Run deterministic and public-web A/B
- env:
- EXECUTION_ORDER: ${{ steps.refs.outputs.execution_order }}
- run: >-
- node moli-benchmark/browser-spider-local/compare.mjs run
- --base-bin "$BINARY_DIR/moli-base"
- --head-bin "$BINARY_DIR/moli-head"
- --base-sha "${{ steps.refs.outputs.base_sha }}"
- --head-sha "${{ steps.refs.outputs.head_sha }}"
- --execution-order "$EXECUTION_ORDER"
- --output-dir "$BENCHMARK_OUTPUT"
- --run-url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
-
- - name: Render Actions job summary
- if: ${{ always() && !cancelled() }}
- continue-on-error: true
- shell: bash
- env:
- COMMENT_PATH: ${{ env.BENCHMARK_OUTPUT }}/comment.md
- run: |
- if [[ -f "$COMMENT_PATH" ]]; then
- cat "$COMMENT_PATH" >> "$GITHUB_STEP_SUMMARY"
- fi
-
- - name: Upload full benchmark evidence
- if: ${{ always() && !cancelled() }}
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
- with:
- name: spider-bench-results
- path: ${{ env.BENCHMARK_OUTPUT }}
- if-no-files-found: error
- retention-days: 14
diff --git a/moli-benchmark/browser-spider-local/compare.mjs b/moli-benchmark/browser-spider-local/compare.mjs
index 99ecdedae..dbc0b0aa7 100644
--- a/moli-benchmark/browser-spider-local/compare.mjs
+++ b/moli-benchmark/browser-spider-local/compare.mjs
@@ -544,14 +544,14 @@ function fixtureContractSummary(suite) {
function assessmentSummary(assessment) {
if (assessment.clean) {
- return '✅ Deterministic fixture diagnostic is clean.';
+ return '✅ Deterministic fixture contract is clean.';
}
const reasons = assessment.reasons
.slice(0, 8)
.map((reason) => ASSESSMENT_REASON_LABELS[reason] ?? 'unknown fixture diagnostic')
.map((reason) => ` - ${reason}`)
.join('\n');
- return `⚠️ Deterministic fixture recorded diagnostic issues (non-blocking):\n${reasons}`;
+ return `❌ Deterministic fixture contract recorded issues:\n${reasons}`;
}
function observationSummary(comparison) {
@@ -636,7 +636,7 @@ export function renderSpiderComparison(comparison, { runUrl, conclusion }) {
'Public-site content, timing, and memory are noisy. This single A/B run reports evidence only; site outcome counts explain missing rows without treating them as a deterministic regression.',
...(resourceTimelines ? ['', resourceTimelines] : []),
'',
- '### Deterministic fixture · diagnostic',
+ '### Deterministic fixture · required contract',
'',
fixtureContractSummary(fixture),
'',
@@ -644,7 +644,7 @@ export function renderSpiderComparison(comparison, { runUrl, conclusion }) {
'',
`Full HTML, JSON, CSV, logs, and page snapshots: ${workflowLink}.`,
'',
- '_Spider Bench is informational: site failures, missing benchmark reports, failed browser service runs, fixture diagnostics, timing, and performance deltas do not fail the workflow. Build, runner, and artifact infrastructure errors can still fail it._'
+ '_The public-web A/B is informational. The exact HEAD fixture contract runs as a separate required CI check; timing and public-site content deltas remain non-blocking._'
].join('\n');
}
diff --git a/moli-benchmark/browser-spider-local/tests/compare.test.mjs b/moli-benchmark/browser-spider-local/tests/compare.test.mjs
index 50283a5c1..576382662 100644
--- a/moli-benchmark/browser-spider-local/tests/compare.test.mjs
+++ b/moli-benchmark/browser-spider-local/tests/compare.test.mjs
@@ -305,15 +305,15 @@ test('comment labels browser execution and public content as informational evide
assert.ok(comment.startsWith(SPIDER_CI_COMMENT_MARKER));
assert.match(comment, /All benchmark browser service runs completed; results are informational/);
- assert.match(comment, /Deterministic fixture diagnostic is clean/);
- assert.match(comment, /Deterministic fixture · diagnostic/);
+ assert.match(comment, /Deterministic fixture contract is clean/);
+ assert.match(comment, /Deterministic fixture · required contract/);
assert.match(comment, /Public 48-site run · informational/);
assert.ok(
comment.indexOf('Public 48-site run · informational')
- < comment.indexOf('Deterministic fixture · diagnostic')
+ < comment.indexOf('Deterministic fixture · required contract')
);
assert.match(comment, /### Public 48-site run · informational/);
- assert.match(comment, /### Deterministic fixture · diagnostic/);
+ assert.match(comment, /### Deterministic fixture · required contract/);
assert.doesNotMatch(comment, /<details/);
assert.match(comment, /Public HEAD:\*\* 174 \/ 240 rows; 36 \/ 48 sites produced rows/);
assert.match(comment, /fixture exercises 15 routes: 8 are expected to emit rows and 7 intentionally/);
@@ -323,8 +323,8 @@ test('comment labels browser execution and public content as informational evide
assert.match(comment, /\| sports \| 27 \/ 40 \| 27 \/ 40 \| 0 \|/);
assert.match(comment, /\+3\.00 MiB \(\+0\.67%\)/);
assert.match(comment, /actions\/runs\/123/);
- assert.match(comment, /missing benchmark reports, failed browser service runs/);
- assert.match(comment, /do not fail the workflow/);
+ assert.match(comment, /public-web A\/B is informational/);
+ assert.match(comment, /exact HEAD fixture contract runs as a separate required CI check/);
assert.match(comment, /Common ancestor `111111111111` → HEAD `222222222222`/);
assert.match(comment, /### CPU and memory timelines/);
assert.match(comment, /bounded 40-point views of the same complete process-tree samples/);
@@ -434,9 +434,9 @@ test('infrastructure-comment command writes the trusted fallback comment', () =>
}
});
-test('CI resolves a common-ancestor baseline and restores the target-base harness', () => {
+test('CI resolves a common ancestor and reuses exact release artifacts', () => {
const benchmarkWorkflow = fs.readFileSync(
- fileURLToPath(new URL('../../../.github/workflows/spider-bench.yml', import.meta.url)),
+ fileURLToPath(new URL('../../../.github/workflows/ci.yml', import.meta.url)),
'utf8'
);
const commentWorkflow = fs.readFileSync(
@@ -448,7 +448,13 @@ test('CI resolves a common-ancestor baseline and restores the target-base harnes
benchmarkWorkflow,
/base_sha=\$\(git merge-base "\$target_base_sha" "\$head_sha"\)/
);
- assert.match(benchmarkWorkflow, /restore_harness\(\)[\s\S]*TARGET_BASE_SHA/);
+ assert.match(benchmarkWorkflow, /build-release-head:[\s\S]*name: moli-release-head/);
+ assert.match(benchmarkWorkflow, /build-release-base:[\s\S]*name: moli-release-base/);
+ assert.match(
+ benchmarkWorkflow,
+ /spider-bench:[\s\S]*needs: \[resolve-refs, build-release-head, build-release-base\]/
+ );
+ assert.match(benchmarkWorkflow, /ref: \$\{\{ needs\.resolve-refs\.outputs\.head_sha \}\}/);
assert.match(commentWorkflow, /compareCommitsWithBasehead/);
assert.match(commentWorkflow, /comparison\.base\?\.sha !== expectedCommonAncestor/);
});