ci/woodpecker/push/woodpecker Pipeline was successful
Replace the retired rc.2 Analysis v2/Trace v2/Execution Events v1 stack with the
single current contract family:
- Analysis v3 (ADR-0069 public boundary): one check --emit artifact carries the
exact source, Markdown AST, heading scopes (heading_span + complete span),
anchors, state-bearing references, calls, resources and diagnostics; the old
revision-3 shape is rejected with a rebuild hint.
- Observation v1: one run/call --output jsonl stream (+ atomic
--observation-file snapshot) decoded by one decoder and projected into the
reader/SSE/export layers; stale/malformed/truncated/incomplete never render
as success.
- CLI Tool revision 1: requires {api_revision:1, analysis:3, observation:1},
product range >=3.0.0-rc.3,<4.0.0, only MARQDO_BIN and
MARQDO_API_REVISION are consumed.
- Remove compatibility branches, retired flags/env vars and duplicate decoders;
re-record Analysis v3 and Observation v1 fixtures; rewrite contract,
integration and security tests (173 passing locally).
- Add check-no-legacy/check-docs/check-observation gates, rc.4 pins in the
CI pipelines, 0.3.0 Tool bundle and evidence manifest support.
See issues #4, #5 and #6; acceptance baseline is CLI source
452e9a32bd9e40dba427d4180691c58bab74449e, archive
9c3f166b5e5b8840d39d10019074e4e1c42432fc23e26c69670e64fdcf4e15d8.
104 lines
3.5 KiB
Bash
Executable File
104 lines
3.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Opening, searching, switching and exporting must never execute a document
|
|
# (zero-execution baseline, current rc.4 contracts). Uses the unsafe-side-effect fixture and checks
|
|
# source/lock hashes plus the absence of any write sentinel around the whole
|
|
# read-only operation set.
|
|
#
|
|
# Usage: MARQDO_BIN=/abs/path/marqdo scripts/test-no-exec.sh
|
|
set -euo pipefail
|
|
|
|
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$repo_root"
|
|
|
|
: "${MARQDO_BIN:?set MARQDO_BIN to the frozen marqdo binary}"
|
|
core_sha_before="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)"
|
|
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
|
|
|
|
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() {
|
|
sha256sum "$doc" "$project/marqdo.yaml" "$project/marqdo.lock"
|
|
}
|
|
|
|
before="$(hash_tree)"
|
|
test ! -e "$sentinel"
|
|
|
|
echo "==> Live read-only requests"
|
|
setsid "${view[@]}" "$doc" --port 0 --no-open >"$work/server.log" 2>&1 &
|
|
pid=$!
|
|
url=""
|
|
for _ in $(seq 1 100); do
|
|
url="$(grep -o 'http://127.0.0.1:[0-9]*/' "$work/server.log" | head -1 || true)"
|
|
[[ -n "$url" ]] && break
|
|
sleep 0.1
|
|
done
|
|
test -n "$url"
|
|
cookie_jar="$work/cookies.txt"
|
|
curl -fsS -c "$cookie_jar" "${url}" > "$work/page.html"
|
|
curl -fsS -c "$cookie_jar" -b "$cookie_jar" "${url}file?path=unsafe-side-effect.mq.md" >/dev/null
|
|
curl -fsS -b "$cookie_jar" "${url}api/documents" >/dev/null
|
|
curl -fsS -b "$cookie_jar" "${url}api/documents?path=unsafe-side-effect.mq.md" >/dev/null
|
|
# Reloading the page multiple times must remain side-effect free.
|
|
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
|
|
pid=""
|
|
|
|
echo "==> Static export"
|
|
"${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
|
|
echo "error: exported page contains a run control" >&2
|
|
exit 1
|
|
fi
|
|
if grep -q 'mq-csrf-token' "$work/site/pages/unsafe-side-effect.mq.md.html"; then
|
|
echo "error: exported page contains a CSRF token" >&2
|
|
exit 1
|
|
fi
|
|
after="$(hash_tree)"
|
|
if [[ "$before" != "$after" ]]; then
|
|
echo "error: read-only/export operations modified project sources" >&2
|
|
diff <(printf '%s\n' "$before") <(printf '%s\n' "$after") >&2 || true
|
|
exit 1
|
|
fi
|
|
test ! -e "$sentinel"
|
|
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"
|
|
echo "no-exec: PASS (sources/lock unchanged, no sentinel from read-only operations, explicit write control passed, no run control in export; core sha unchanged)"
|