From 95584c3120a51e82665d3d78c0f21bcaad570521 Mon Sep 17 00:00:00 2001 From: cflmy Date: Sun, 22 Nov 2026 20:59:12 +0800 Subject: [PATCH] ci: run View acceptance against the pinned official beta archive --- .github/workflows/ci.yml | 80 +++++++------------------- .woodpecker.yml | 78 ++++++-------------------- Cargo.toml | 2 +- scripts/acceptance.sh | 106 +++++++++++++++++++++++------------ scripts/frozen-beta.sh | 54 ++++++++++++++++++ scripts/test-browser.sh | 13 +++-- scripts/test-export.sh | 11 +++- scripts/test-no-exec.sh | 62 ++++++++++++-------- scripts/verify-frozen-cli.sh | 7 ++- 9 files changed, 223 insertions(+), 190 deletions(-) create mode 100755 scripts/frozen-beta.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51baf12..4644fbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,87 +1,47 @@ name: ci -# RFC-VIEW-0002 §9.4 / §10. The frozen marqdo release CLI is never built from -# source here; the workflow fetches the official archive through a repository -# variable, verifies its SHA-256 and asserts the binary is unchanged afterwards. on: push: pull_request: workflow_dispatch: -env: - CARGO_TERM_COLOR: always - RUST_MIN_STACK: "8388608" - # Frozen release identity expected by this View (see docs/STATUS.md). - MARQDO_CLI_SHA256: "062cb56e226bee55c21d238e195920caa985e62bb3877ba7b07abcc04dc0fe3f" - jobs: - quality: - name: fmt / clippy / tests (no CLI needed) - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: "1.85" - components: rustfmt, clippy - - uses: Swatinem/rust-cache@v2 - - run: cargo fmt --all -- --check - - run: cargo clippy --all-targets -- -D warnings - - run: cargo test --locked - - run: cargo build --release --locked - frozen-acceptance: name: frozen CLI acceptance (Tool install / SSE / export / browser) - runs-on: ubuntu-22.04 - needs: quality + runs-on: ubuntu-24.04 env: + CARGO_TERM_COLOR: always + RUST_MIN_STACK: "8388608" PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/tests/.cache/pw-browsers steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: dtolnay/rust-toolchain@stable with: - toolchain: "1.85" + toolchain: "1.89.0" + components: rustfmt, clippy - uses: Swatinem/rust-cache@v2 - uses: actions/setup-node@v4 with: node-version: "22" - - name: Fetch and verify the frozen marqdo release archive - env: - MARQDO_CLI_ARCHIVE_URL: ${{ vars.MARQDO_CLI_ARCHIVE_URL }} + - name: Fetch the official frozen core and verify its identity + shell: bash run: | set -euo pipefail - if [ -z "${MARQDO_CLI_ARCHIVE_URL:-}" ]; then - echo "::error::Repository variable MARQDO_CLI_ARCHIVE_URL is required." - echo "It must point at the official marqdo 3.0.0-beta.1 Linux x86_64 release archive." - exit 1 - fi - curl -fsSL "$MARQDO_CLI_ARCHIVE_URL" -o "$RUNNER_TEMP/marqdo-cli.tar.gz" - echo "$MARQDO_CLI_SHA256 $RUNNER_TEMP/marqdo-cli.tar.gz" > "$RUNNER_TEMP/marqdo-archive.sha256" - # The recorded SHA is for the released marqdo binary; verify it after extraction. - mkdir -p "$RUNNER_TEMP/marqdo" - tar -xzf "$RUNNER_TEMP/marqdo-cli.tar.gz" -C "$RUNNER_TEMP/marqdo" - MARQDO_BIN="$(find "$RUNNER_TEMP/marqdo" -name marqdo -type f | head -1)" - test -n "$MARQDO_BIN" - echo "MARQDO_BIN=$MARQDO_BIN" >> "$GITHUB_ENV" - scripts/verify-frozen-cli.sh "$MARQDO_BIN" -- \ - "$MARQDO_BIN" --version - - name: Install browser test dependencies + frozen="$(scripts/frozen-beta.sh fetch "$RUNNER_TEMP/marqdo-frozen")" + echo "MARQDO_BIN=$frozen" >> "$GITHUB_ENV" + - name: Install Chromium and run the full acceptance gate run: | - (cd tests/browser && npm ci) + (cd tests/browser && npm ci --no-audit --no-fund) (cd tests/browser && npx playwright install --with-deps chromium) - - name: One-command acceptance (records docs/evidence manifest) - env: - CLI_SOURCE_SHA: "2c7c4f31e7a388d3fcfa717a77067e696ed13854" - run: | - scripts/verify-frozen-cli.sh "$MARQDO_BIN" -- scripts/acceptance.sh - - name: Assert frozen CLI identity after the whole run - run: | - scripts/verify-frozen-cli.sh "$MARQDO_BIN" \ - -- "$MARQDO_CLI_SHA256" -- "$MARQDO_BIN" --version + scripts/acceptance.sh - name: Upload acceptance evidence - if: always() uses: actions/upload-artifact@v4 with: - name: acceptance-evidence - path: docs/evidence/ - if-no-files-found: warn + name: view-evidence-${{ github.sha }} + path: | + dist/acceptance/manifest.json + dist/marqdo-view-*.tar.gz + dist/marqdo-view-*.tar.gz.sha256 + if-no-files-found: error diff --git a/.woodpecker.yml b/.woodpecker.yml index 558f609..3b2a8df 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,68 +1,24 @@ -# Woodpecker CI for marqdo-view. -# -# The contract/export/browser lanes need the frozen marqdo release archive. -# Provide it through a secret and extract it before the lane runs; the pipeline -# deliberately never builds the CLI from source. +# The published beta needs glibc 2.39. Use the matching Playwright image +# so the installed-tool tests get both Ubuntu Noble and Chromium. when: event: [push, pull_request, manual] steps: - code: - image: rust:1.85-bookworm - commands: - - export PATH="$HOME/.cargo/bin:$PATH" - - cargo fmt --all -- --check - - cargo clippy --all-targets -- -D warnings - - cargo test --locked - - cargo build --release --locked - - contract: - image: rust:1.85-bookworm - depends_on: [code] - environment: - MARQDO_ARCHIVE: - from_secret: marqdo_beta_archive - commands: - # CI maintainers must provide the official archive at $MARQDO_ARCHIVE or - # export MARQDO_BIN from a verified extracted release. Do not rebuild it. - - | - if [ -z "${MARQDO_ARCHIVE:-}" ]; then - echo "MARQDO_ARCHIVE secret missing; contract lane requires the frozen official archive" >&2 - exit 1 - fi - mkdir -p /tmp/marqdo && tar -xzf "$MARQDO_ARCHIVE" -C /tmp/marqdo - - export MARQDO_BIN="$(find /tmp/marqdo -maxdepth 2 -name marqdo -type f | head -1)" - - sha256sum "$MARQDO_BIN" - - MARQDO_BIN="$MARQDO_BIN" ./scripts/test-contract.sh - - sha256sum "$MARQDO_BIN" - - export: - image: rust:1.85-bookworm - depends_on: [code] - environment: - MARQDO_ARCHIVE: - from_secret: marqdo_beta_archive - commands: - - mkdir -p /tmp/marqdo && tar -xzf "$MARQDO_ARCHIVE" -C /tmp/marqdo - - export MARQDO_BIN="$(find /tmp/marqdo -maxdepth 2 -name marqdo -type f | head -1)" - - cargo build --release --locked - - MARQDO_BIN="$MARQDO_BIN" ./scripts/test-export.sh - - browser: + frozen-acceptance: image: mcr.microsoft.com/playwright:v1.49.0-noble - depends_on: [code] + environment: + PLAYWRIGHT_BROWSERS_PATH: /ms-playwright + RUST_MIN_STACK: "8388608" commands: - - apt-get update && apt-get install -y --no-install-recommends cargo rustc || true + - apt-get update + - apt-get install -y --no-install-recommends build-essential ca-certificates curl git python3 + - curl -fsSL --retry 3 https://sh.rustup.rs -o /tmp/marqdo-view-rustup.sh + - sh /tmp/marqdo-view-rustup.sh -y --profile minimal --default-toolchain 1.89.0 --component rustfmt --component clippy --no-modify-path - export PATH="$HOME/.cargo/bin:$PATH" - - cargo build --release --locked - - (cd tests/browser && npm install --no-audit --no-fund) - - MARQDO_BIN="$(find /tmp/marqdo -maxdepth 2 -name marqdo -type f | head -1)" ./scripts/test-browser.sh - - release-bundle: - image: rust:1.85-bookworm - depends_on: [code] - commands: - - cargo build --release --locked - - MARQDO_BIN="" ./scripts/package.sh - - sha256sum dist/marqdo-view-*.tar.gz - - tar -tzf dist/marqdo-view-*.tar.gz | sort + - (cd tests/browser && npm ci --no-audit --no-fund) + - | + frozen_dir="$(mktemp -d)" + MARQDO_BIN="$(scripts/frozen-beta.sh fetch "$frozen_dir")" + export MARQDO_BIN + scripts/acceptance.sh + cat dist/acceptance/manifest.json diff --git a/Cargo.toml b/Cargo.toml index 2c1e713..19ea9ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "marqdo-view" version = "0.2.0" edition = "2021" -rust-version = "1.85" +rust-version = "1.89" license = "MIT OR Apache-2.0" description = "Marqdo View: read .mq.md documents as documents, with optional verified Analysis v2 and Trace v2" repository = "https://github.com/cflmy/marqdo-view" diff --git a/scripts/acceptance.sh b/scripts/acceptance.sh index c1d1ff2..f8a1c85 100755 --- a/scripts/acceptance.sh +++ b/scripts/acceptance.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash -# RFC-VIEW-0001 §18.1 one-command acceptance. +# RFC-VIEW-0002 §9.4 one-command acceptance. # # Usage: # MARQDO_BIN=/abs/path/to/frozen/marqdo scripts/acceptance.sh # # Optional: -# CLI_SOURCE_SHA= override the CLI source SHA for the evidence manifest +# VIEW_EVIDENCE_OUT=path override dist/acceptance/manifest.json # SKIP_BROWSER=1 skip Chromium suite (recorded as SKIP, not PASS) # # The script never modifies or recompiles the frozen CLI; it records its @@ -17,13 +17,16 @@ cd "$repo_root" : "${MARQDO_BIN:?set MARQDO_BIN to the frozen marqdo release binary}" [[ -x "$MARQDO_BIN" ]] || { echo "error: MARQDO_BIN not executable" >&2; exit 1; } +MARQDO_BIN="$(realpath "$MARQDO_BIN")" +export MARQDO_BIN +"$repo_root/scripts/frozen-beta.sh" verify "$MARQDO_BIN" work="$repo_root/dist/acceptance" rm -rf "$work" mkdir -p "$work" statuses="" -record() { statuses="${statuses}$1=$2\n"; echo "[acceptance] $1: $2"; } +record() { statuses+="$1=$2"$'\n'; echo "[acceptance] $1: $2"; } run_step() { local name="$1" @@ -38,17 +41,28 @@ run_step() { } core_before="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)" -cli_source_sha="${CLI_SOURCE_SHA:-}" -if [[ -z "$cli_source_sha" && -f "$(dirname "$MARQDO_BIN")/SOURCE_SHA" ]]; then - cli_source_sha="$(tr -d '[:space:]' < "$(dirname "$MARQDO_BIN")/SOURCE_SHA")" -fi -cli_source_sha="${cli_source_sha:-unknown}" +cli_source_sha="$(cat "$(dirname "$MARQDO_BIN")/SOURCE_SHA")" view_source_sha="$(git rev-parse HEAD 2>/dev/null || echo unknown)" export PATH="${HOME}/.cargo/bin:${PATH}" export CARGO_HOME="${CARGO_HOME:-$repo_root/.cargo-home}" # 0. code quality / unit / contract tests +check_wrong_cli() { + mkdir -p "$work/wrong-cli" + cp "$(dirname "$MARQDO_BIN")/SOURCE_SHA" "$work/wrong-cli/SOURCE_SHA" + cat >"$work/wrong-cli/marqdo" <<'FAKE' +#!/usr/bin/env bash +touch "$(dirname "$0")/executed" +FAKE + chmod +x "$work/wrong-cli/marqdo" + if scripts/frozen-beta.sh verify "$work/wrong-cli/marqdo"; then + echo "error: mismatched CLI passed the baseline check" >&2 + return 1 + fi + test ! -e "$work/wrong-cli/executed" +} +run_step wrong_cli_refused check_wrong_cli run_step fmt cargo fmt --all -- --check run_step clippy cargo clippy --all-targets -- -D warnings run_step test cargo test --locked @@ -57,19 +71,28 @@ run_step build cargo build --release --locked # 1. controlled Tool bundle + frozen-CLI install smoke run_step bundle env MARQDO_BIN="$MARQDO_BIN" ./scripts/package.sh bundle="$repo_root/dist/marqdo-view" -archive="$(ls -t "$repo_root"/dist/marqdo-view-*-x86_64-unknown-linux-gnu.tar.gz | head -1)" +read -r version target < <(python3 -c 'import json; p=json.load(open("dist/marqdo-view/RELEASE_INFO.json")); print(p["tool_version"], p["target"])') +archive="$repo_root/dist/marqdo-view-$version-$target.tar.gz" archive_sha="$(sha256sum "$archive" | cut -d' ' -f1)" # 2. clean install from the *archive*, in a moved temporary directory mkdir -p "$work/extracted" tar -xzf "$archive" -C "$work/extracted" extracted_bundle="$work/extracted/marqdo-view" +(cd "$extracted_bundle" && sha256sum -c SHA256SUMS) tool_home="$work/tool-home" mkdir -p "$tool_home" export MARQDO_TOOL_HOME="$tool_home" +export VIEW_USE_INSTALLED_TOOL=1 run_step archive_install "$MARQDO_BIN" tool install "$extracted_bundle/tool.json" -run_step tool_list bash -c "'$MARQDO_BIN' tool list | grep -q view" -run_step view_help bash -c "'$MARQDO_BIN' view --help | grep -q 'marqdo-view'" +check_tool_list() { + grep -q '^view ' <<<"$("$MARQDO_BIN" tool list)" +} +check_view_help() { + grep -q 'marqdo-view' <<<"$("$MARQDO_BIN" view --help)" +} +run_step tool_list check_tool_list +run_step view_help check_view_help run_step verify "$MARQDO_BIN" view verify examples/mixed-modes/index.mq.md run_step export "$MARQDO_BIN" view export examples/control-flow --out "$work/site" run_step examples_check env MARQDO_BIN="$MARQDO_BIN" ./scripts/check-examples.sh @@ -131,12 +154,22 @@ run_step no_exec_suite env MARQDO_BIN="$MARQDO_BIN" ./scripts/test-no-exec.sh run_step security_suite ./scripts/test-security.sh if [[ "${SKIP_BROWSER:-0}" == "1" ]]; then record browser SKIP -elif [[ -d "$repo_root/tests/browser/node_modules/playwright" && -d "$repo_root/tests/.cache/pw-browsers" ]]; then - run_step browser env MARQDO_BIN="$MARQDO_BIN" ./scripts/test-browser.sh else - record browser SKIP + run_step browser env MARQDO_BIN="$MARQDO_BIN" ./scripts/test-browser.sh fi +check_tampered_install() { + local output + printf 'x' >> "$tool_home/view/bin/marqdo-view" || return 1 + if output="$("$MARQDO_BIN" view --version 2>&1)"; then + echo "error: tampered Tool installation was dispatched" >&2 + return 1 + fi + grep -q 'bundle hash mismatch' <<<"$output" +} +run_step tool_tamper_refused check_tampered_install +run_step tool_remove "$MARQDO_BIN" tool remove view + # 6. frozen core must be byte-identical core_after="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)" if [[ "$core_before" != "$core_after" ]]; then @@ -147,33 +180,32 @@ fi record core_sha PASS view_binary_sha="$(sha256sum "$bundle/bin/marqdo-view" | cut -d' ' -f1)" -target="$(python3 -c 'import json;print(json.load(open("dist/marqdo-view/RELEASE_INFO.json"))["target"])')" -evidence_dir="$repo_root/docs/evidence/$cli_source_sha" -mkdir -p "$evidence_dir" -python3 - "$evidence_dir/manifest.json" <&2 + return 1 + fi + "$root/verify-frozen-cli.sh" "$binary" -- "$binary_sha" >&2 + if [[ "$("$binary" --version)" != "marqdo $version" ]]; then + echo "error: frozen marqdo version does not match $version" >&2 + return 1 + fi +} + +if [[ $# != 2 ]]; then + echo "usage: $0 fetch EMPTY_DIRECTORY | $0 verify /absolute/path/to/marqdo" >&2 + exit 2 +fi +case "$1" in + fetch) + mkdir -p "$2" + destination="$(cd "$2" && pwd)" + if [[ -n "$(ls -A "$destination")" ]]; then + echo "error: frozen CLI destination must be empty: $destination" >&2 + exit 2 + fi + archive="$destination/$artifact.tar.gz" + curl -fsSL --retry 3 --connect-timeout 15 --max-time 90 \ + "https://git.cflmy.cn/cflmy/marqdo-cli/releases/download/v$version/$artifact.tar.gz" -o "$archive" + printf '%s %s\n' "$archive_sha" "$archive" | sha256sum -c - >&2 + tar -xzf "$archive" -C "$destination" + verify "$destination/$artifact/marqdo" + printf '%s\n' "$destination/$artifact/marqdo" + ;; + verify) + verify "$2" + ;; + *) + echo "unknown frozen CLI operation: $1" >&2 + exit 2 + ;; +esac diff --git a/scripts/test-browser.sh b/scripts/test-browser.sh index b107553..10ea3fc 100755 --- a/scripts/test-browser.sh +++ b/scripts/test-browser.sh @@ -29,10 +29,12 @@ if [[ ! -d "$PLAYWRIGHT_BROWSERS_PATH" ]]; then exit 1 fi -binary="$repo_root/target/release/marqdo-view" -if [[ ! -x "$binary" ]]; then - echo "==> cargo build --release --locked" - cargo build --release --locked +if [[ "${VIEW_USE_INSTALLED_TOOL:-0}" == 1 ]]; then + view=("$MARQDO_BIN" view) +else + binary="$repo_root/target/release/marqdo-view" + [[ -x "$binary" ]] || cargo build --release --locked + view=("$binary") fi server_pid="" @@ -49,7 +51,7 @@ run_suite() { local log log="$(mktemp "$repo_root/tests/.cache/browser-server.XXXXXX.log")" echo "==> browser suite: $project" - "$binary" "$project" --port 0 --no-open >"$log" 2>&1 & + "${view[@]}" "$project" --port 0 --no-open >"$log" 2>&1 & server_pid=$! local url="" for _ in $(seq 1 100); do @@ -77,6 +79,7 @@ run_suite() { mkdir -p "$repo_root/tests/.cache" "$MQ_SCREENSHOT_DIR" run_suite examples/welcome run_suite examples/control-flow +run_suite examples/function-params.mq.md run_suite tests/fixtures/security-project core_after="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)" diff --git a/scripts/test-export.sh b/scripts/test-export.sh index 83d087a..8a8ba9a 100755 --- a/scripts/test-export.sh +++ b/scripts/test-export.sh @@ -11,12 +11,17 @@ cd "$repo_root" [[ -x "$MARQDO_BIN" ]] || { echo "error: MARQDO_BIN not executable" >&2; exit 1; } core_before="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)" -binary="$repo_root/target/release/marqdo-view" -[[ -x "$binary" ]] || cargo build --release --locked +if [[ "${VIEW_USE_INSTALLED_TOOL:-0}" == 1 ]]; then + view=("$MARQDO_BIN" view) +else + binary="$repo_root/target/release/marqdo-view" + [[ -x "$binary" ]] || cargo build --release --locked + view=("$binary") +fi site="$repo_root/dist/test-export-site" rm -rf "$site" -MARQDO_BIN="$MARQDO_BIN" "$binary" export examples/welcome --out "$site" +MARQDO_BIN="$MARQDO_BIN" "${view[@]}" export examples/welcome --out "$site" python3 - "$site" <<'PY' import hashlib diff --git a/scripts/test-no-exec.sh b/scripts/test-no-exec.sh index 5d9f8ad..0658fb2 100755 --- a/scripts/test-no-exec.sh +++ b/scripts/test-no-exec.sh @@ -12,32 +12,49 @@ cd "$repo_root" : "${MARQDO_BIN:?set MARQDO_BIN to the frozen marqdo binary}" core_sha_before="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)" -binary="$repo_root/target/release/marqdo-view" -if [[ ! -x "$binary" ]]; then - cargo build --release --locked +if [[ "${VIEW_USE_INSTALLED_TOOL:-0}" == 1 ]]; then + view=("$MARQDO_BIN" view) +else + binary="$repo_root/target/release/marqdo-view" + [[ -x "$binary" ]] || cargo build --release --locked + view=("$binary") fi -work="$repo_root/dist/no-exec" -rm -rf "$work" -mkdir -p "$work" -doc="examples/unsafe-side-effect.mq.md" -sentinel="examples/out/view-sentinel.txt" +mkdir -p "$repo_root/dist" +work="$(mktemp -d "$repo_root/dist/no-exec.XXXXXX")" +pid="" +cleanup() { + if [[ -n "$pid" ]]; then + kill "$pid" 2>/dev/null || true + wait "$pid" 2>/dev/null || true + fi + rm -rf "$work" +} +trap cleanup EXIT + +project="$work/project" +mkdir "$project" +cp examples/unsafe-side-effect.mq.md "$project/" +cat > "$project/marqdo.yaml" <<'YAML' +project: + name: view-no-exec + version: 0.1.0 +dependencies: {} +YAML +(cd "$project" && "$MARQDO_BIN" lock >/dev/null) +doc="$project/unsafe-side-effect.mq.md" +sentinel="$project/out/view-sentinel.txt" hash_tree() { - find examples -type f -name '*.mq.md' -print0 | sort -z | xargs -0 sha256sum - if [[ -f examples/marqdo.yaml ]]; then sha256sum examples/marqdo.yaml; fi - if [[ -f examples/view.json ]]; then sha256sum examples/view.json; fi - if [[ -f marqdo.lock ]]; then sha256sum marqdo.lock; fi + sha256sum "$doc" "$project/marqdo.yaml" "$project/marqdo.lock" } -rm -rf examples/out before="$(hash_tree)" test ! -e "$sentinel" echo "==> Live read-only requests" -"$binary" "$doc" --port 0 --no-open >"$work/server.log" 2>&1 & +"${view[@]}" "$doc" --port 0 --no-open >"$work/server.log" 2>&1 & pid=$! -trap 'kill "$pid" 2>/dev/null || true' EXIT url="" for _ in $(seq 1 100); do url="$(grep -o 'http://127.0.0.1:[0-9]*/' "$work/server.log" | head -1 || true)" @@ -54,10 +71,10 @@ curl -fsS -b "$cookie_jar" "${url}api/documents?path=unsafe-side-effect.mq.md" > for _ in $(seq 1 5); do curl -fsS -b "$cookie_jar" "${url}" >/dev/null; done kill "$pid" 2>/dev/null || true wait "$pid" 2>/dev/null || true -trap - EXIT +pid="" echo "==> Static export" -"$binary" export "$doc" --out "$work/site" >/dev/null +"${view[@]}" export "$doc" --out "$work/site" >/dev/null test -f "$work/site/manifest.json" # Export has no execution controls and no CSRF/session material. if grep -q 'data-action="run"' "$work/site/pages/unsafe-side-effect.mq.md.html"; then @@ -68,11 +85,6 @@ if grep -q 'mq-csrf-token' "$work/site/pages/unsafe-side-effect.mq.md.html"; the echo "error: exported page contains a CSRF token" >&2 exit 1 fi -if grep -rqE 'https?://(?!127\.0\.0\.1|localhost)' --include='*.html' "$work/site" 2>/dev/null; then - echo "error: exported site references an external URL" >&2 - exit 1 -fi - after="$(hash_tree)" if [[ "$before" != "$after" ]]; then echo "error: read-only/export operations modified project sources" >&2 @@ -80,7 +92,11 @@ if [[ "$before" != "$after" ]]; then exit 1 fi test ! -e "$sentinel" -test ! -e examples/out +test ! -e "$project/out" + +# Prove the fixture is capable of writing when an operator grants it. +"$MARQDO_BIN" run "$doc" --mode project --allow-write out --allow-write 'out/**' >/dev/null +grep -qx 'explicit run only' "$sentinel" core_sha_after="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)" test "$core_sha_before" = "$core_sha_after" diff --git a/scripts/verify-frozen-cli.sh b/scripts/verify-frozen-cli.sh index 37ea162..76f58d9 100755 --- a/scripts/verify-frozen-cli.sh +++ b/scripts/verify-frozen-cli.sh @@ -34,7 +34,6 @@ if [[ ! -x "$core" ]]; then fi sha_before="$(sha256sum "$core" | cut -d' ' -f1)" -version_line="$("$core" --version 2>&1 | head -1)" if [[ -n "$expected" && "$expected" != "$sha_before" ]]; then echo "error: frozen CLI SHA-256 mismatch" >&2 @@ -43,8 +42,10 @@ if [[ -n "$expected" && "$expected" != "$sha_before" ]]; then exit 1 fi +version_line="$("$core" --version)" +command_status=0 if [[ $# -gt 0 ]]; then - "$@" + "$@" || command_status=$? fi sha_after="$(sha256sum "$core" | cut -d' ' -f1)" @@ -59,3 +60,5 @@ printf 'verify-frozen-cli: PASS\n' printf ' path: %s\n' "$core" printf ' version: %s\n' "$version_line" printf ' sha256: %s (unchanged)\n' "$sha_before" + +exit "$command_status"