Files
marqdo-view/scripts/gen-golden.sh
T
Marqdo View 340ecb035f
ci/woodpecker/push/woodpecker Pipeline was successful
feat: migrate View 0.3.0 to marqdo 3.0.0-rc.4 contracts
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.
2026-11-25 22:12:51 +08:00

54 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Regenerate committed Analysis v3 / Observation v1 goldens from the frozen CLI
# release binary.
#
# The current public contracts have exactly one static source (`check --emit`
# Analysis v3) and one runtime sequence (Observation v1, either `--output jsonl`
# or the atomic `--observation-file` snapshot of the same execution).
#
# Usage: MARQDO_BIN=/abs/path/marqdo scripts/gen-golden.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}"
if [[ ! -x "$MARQDO_BIN" ]]; then
echo "error: MARQDO_BIN is not executable: $MARQDO_BIN" >&2
exit 1
fi
echo "golden core sha256: $(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)"
out="tests/golden/analysis-v3"
mkdir -p "$out"
"$MARQDO_BIN" check examples/mixed-modes/index.mq.md --emit "$out/mixed-modes.json"
"$MARQDO_BIN" check examples/control-flow/index.mq.md --emit "$out/control-flow.json"
"$MARQDO_BIN" check examples/tables-math/index.mq.md --emit "$out/tables-math.json"
"$MARQDO_BIN" check examples/welcome/00-welcome.mq.md --emit "$out/welcome.json"
"$MARQDO_BIN" check examples/unicode-spans/index.mq.md --emit "$out/unicode-spans.json"
"$MARQDO_BIN" check examples/unicode-spans/crlf.mq.md --emit "$out/unicode-spans-crlf.json"
# Observation v1 goldens come from the same frozen binary (pure mode, no grants).
out_obs="tests/golden/observation-v1"
mkdir -p "$out_obs"
( cd examples/control-flow \
&& "$MARQDO_BIN" run index.mq.md --mode pure --output jsonl --observation-file "$repo_root/$out_obs/control-flow.snapshot.json" \
> "$repo_root/$out_obs/control-flow.jsonl" )
( cd examples/control-flow \
&& "$MARQDO_BIN" run index.mq.md --mode pure --observe-max-events 5 \
--output jsonl --observation-file "$repo_root/$out_obs/control-flow.truncated.snapshot.json" \
> "$repo_root/$out_obs/control-flow.truncated.jsonl" )
if ( cd examples/mixed-modes \
&& "$MARQDO_BIN" run index.mq.md --mode pure --output jsonl \
--observation-file "$repo_root/$out_obs/mixed-modes.arity.snapshot.json" \
> "$repo_root/$out_obs/mixed-modes.arity.jsonl" 2>/dev/null ); then
echo "error: mixed-modes without params unexpectedly ran" >&2
exit 1
fi
# Diagnostics fixture must fail: verify the failure shape stays as expected.
if "$MARQDO_BIN" check examples/diagnostics/index.mq.md --json >/dev/null 2>&1; then
echo "error: examples/diagnostics unexpectedly passed check" >&2
exit 1
fi
echo "goldens: PASS (Analysis v3 + Observation v1 stream/snapshot)"