feat: migrate View 0.3.0 to marqdo 3.0.0-rc.4 contracts
ci/woodpecker/push/woodpecker Pipeline was successful
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.
This commit is contained in:
1 parent
7b34199c96
commit
340ecb035f
108 files changed
+13928
-6461
No files matched your search
+63
-41
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# RFC-VIEW-0002 §13.3/§13.4: prove the five 3.0 example documents against the
|
||||
# frozen released CLI. Never rebuilds the Core; runs in a copied temp project so
|
||||
# the repository examples are never modified.
|
||||
# Prove the five 3.0 example documents against the frozen released CLI using
|
||||
# the current public contracts: one `check --emit` Analysis v3 source and one
|
||||
# Observation v1 sequence per `run`/`call`. Never rebuilds the Core; runs in a
|
||||
# copied temp project so the repository examples are never modified.
|
||||
#
|
||||
# Usage: MARQDO_BIN=/abs/path/marqdo scripts/check-examples.sh
|
||||
set -euo pipefail
|
||||
@@ -10,7 +11,8 @@ 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)"
|
||||
core="${MARQDO_BIN}"
|
||||
core_sha_before="$(sha256sum "$core" | cut -d' ' -f1)"
|
||||
|
||||
work="$repo_root/dist/examples-check"
|
||||
rm -rf "$work"
|
||||
@@ -21,71 +23,91 @@ cp examples/view.json "$work/"
|
||||
|
||||
cd "$work"
|
||||
|
||||
echo "==> check all five example documents (no execution)"
|
||||
echo "==> check all five example documents (one static source: check --emit)"
|
||||
for file in welcome.mq.md branch-loop.mq.md function-params.mq.md knowledge-only.mq.md unsafe-side-effect.mq.md; do
|
||||
if ! "$MARQDO_BIN" check "$file" --emit "analysis-$file.json" --json > "check-$file.json"; then
|
||||
if ! "$core" check "$file" --emit "analysis-$file.json" --json > "check-$file.json"; then
|
||||
echo "error: frozen CLI refused $file" >&2
|
||||
cat "check-$file.json" >&2
|
||||
exit 1
|
||||
fi
|
||||
test -s "analysis-$file.json"
|
||||
done
|
||||
|
||||
echo "==> call function-params.double(n=5) -> 10"
|
||||
call_json="$("$MARQDO_BIN" call function-params.mq.md double --arg n=5 --mode pure --json --trace-file call.trace.json)"
|
||||
python3 - "$call_json" <<'PY'
|
||||
import json, sys
|
||||
data = json.loads(sys.argv[1])
|
||||
assert data["success"] is True, data
|
||||
assert data["value"] == {"type": "int", "decimal": "10"}, data["value"]
|
||||
print("call double(5): PASS (Int 10)")
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
for name in ("welcome", "branch-loop", "function-params", "knowledge-only", "unsafe-side-effect"):
|
||||
artifact = json.load(open(f"analysis-{name}.mq.md.json"))
|
||||
assert artifact["schema"] == "marqdo.analysis", artifact["schema"]
|
||||
assert artifact["schema_version"] == 3, artifact["schema_version"]
|
||||
assert artifact["modules"] and artifact["modules"][0]["source"], name
|
||||
assert artifact["modules"][0]["document"], name
|
||||
assert artifact["project"]["entry_module_id"], name
|
||||
print("Analysis v3: PASS (schema_version 3, exact source/document/entry present)")
|
||||
PY
|
||||
|
||||
echo "==> run branch-loop main -> Int 0 with loop/return trace"
|
||||
run_json="$("$MARQDO_BIN" run branch-loop.mq.md --mode pure --json --trace-file run.trace.json)"
|
||||
python3 - "$run_json" "run.trace.json" <<'PY'
|
||||
import json, sys
|
||||
data = json.loads(sys.argv[1])
|
||||
assert data["success"] is True, data
|
||||
assert data["value"] == {"type": "int", "decimal": "0"}, data["value"]
|
||||
trace = json.load(open(sys.argv[2]))
|
||||
kinds = {event["kind"] for event in trace["events"]}
|
||||
echo "==> call function-params.double(n=5) -> 10 via Observation v1"
|
||||
"$core" call function-params.mq.md double --arg n=5 --mode pure --output json > call.json
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
snapshot = json.load(open("call.json"))
|
||||
assert snapshot["schema"] == "marqdo.observation" and snapshot["schema_version"] == 1
|
||||
assert snapshot["run"]["status"] == "ok", snapshot["run"]
|
||||
terminal = snapshot["events"][-1]
|
||||
assert terminal["kind"] == "run.completed", terminal
|
||||
assert terminal["payload"]["value"] == {"type": "int", "decimal": "10"}, terminal["payload"]
|
||||
print("call double(5): PASS (Observation v1, Int 10)")
|
||||
PY
|
||||
|
||||
echo "==> run branch-loop main -> Int 0 with loop/return events"
|
||||
"$core" run branch-loop.mq.md --mode pure --output json > run.json
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
snapshot = json.load(open("run.json"))
|
||||
assert snapshot["run"]["status"] == "ok", snapshot["run"]
|
||||
terminal = snapshot["events"][-1]
|
||||
assert terminal["kind"] == "run.completed", terminal
|
||||
assert terminal["payload"]["value"] == {"type": "int", "decimal": "0"}, terminal["payload"]
|
||||
kinds = [event["kind"] for event in snapshot["events"]]
|
||||
assert "loop.iteration" in kinds and "return" in kinds, kinds
|
||||
print("run branch-loop: PASS (value 0, events: %s)" % ",".join(sorted(kinds)))
|
||||
seqs = [event["seq"] for event in snapshot["events"]]
|
||||
assert seqs == list(range(len(seqs))), seqs
|
||||
assert len({event["run_id"] for event in snapshot["events"]}) == 1
|
||||
print("run branch-loop: PASS (Int 0, contiguous seq, kinds: %s)" % ",".join(kinds))
|
||||
PY
|
||||
|
||||
echo "==> knowledge-only has no main (truthful failure, no fallback)"
|
||||
echo "==> knowledge-only has no main (truthful rejection, no fallback)"
|
||||
set +e
|
||||
"$MARQDO_BIN" run knowledge-only.mq.md --mode pure --json > knowledge.json 2>&1
|
||||
"$core" run knowledge-only.mq.md --mode pure --output json > knowledge.json 2>/dev/null
|
||||
status=$?
|
||||
set -e
|
||||
test "$status" -ne 0
|
||||
python3 - knowledge.json <<'PY'
|
||||
import json, sys
|
||||
data = json.load(open(sys.argv[1]))
|
||||
assert data["success"] is False, data
|
||||
assert data["code"] == "sem.no_entry_function", data
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
snapshot = json.load(open("knowledge.json"))
|
||||
terminal = snapshot["events"][-1]
|
||||
assert terminal["kind"] == "run.rejected", terminal
|
||||
assert terminal["payload"]["error"]["code"] == "sem.no_entry_function", terminal["payload"]
|
||||
print("knowledge-only: PASS (explicit sem.no_entry_function)")
|
||||
PY
|
||||
|
||||
echo "==> unsafe-side-effect writes nothing in pure mode"
|
||||
set +e
|
||||
"$MARQDO_BIN" run unsafe-side-effect.mq.md --mode pure --json > unsafe-pure.json 2>&1
|
||||
"$core" run unsafe-side-effect.mq.md --mode pure --output json > unsafe-pure.json 2>/dev/null
|
||||
status=$?
|
||||
set -e
|
||||
test "$status" -ne 0
|
||||
test ! -e out/view-sentinel.txt
|
||||
python3 - unsafe-pure.json <<'PY'
|
||||
import json, sys
|
||||
data = json.load(open(sys.argv[1]))
|
||||
assert data["success"] is False, data
|
||||
assert data["error"]["code"] == "permission.denied", data["error"]
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
snapshot = json.load(open("unsafe-pure.json"))
|
||||
terminal = snapshot["events"][-1]
|
||||
assert terminal["kind"] == "run.failed", terminal
|
||||
assert terminal["payload"]["error"]["code"] == "permission.denied", terminal["payload"]
|
||||
print("unsafe-side-effect pure: PASS (permission.denied, no file)")
|
||||
PY
|
||||
|
||||
echo "==> unsafe-side-effect writes only with explicit project grants"
|
||||
"$MARQDO_BIN" run unsafe-side-effect.mq.md --mode project \
|
||||
--allow-write out --allow-write 'out/**' --json --trace-file unsafe.trace.json >/dev/null
|
||||
"$core" run unsafe-side-effect.mq.md --mode project \
|
||||
--allow-write out --allow-write 'out/**' --output json >/dev/null
|
||||
test -f out/view-sentinel.txt
|
||||
python3 - <<'PY'
|
||||
content = open("out/view-sentinel.txt", "rb").read()
|
||||
@@ -94,6 +116,6 @@ print("unsafe-side-effect project+grants: PASS (sentinel written explicitly)")
|
||||
PY
|
||||
rm -rf out
|
||||
|
||||
core_sha_after="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)"
|
||||
core_sha_after="$(sha256sum "$core" | cut -d' ' -f1)"
|
||||
test "$core_sha_before" = "$core_sha_after"
|
||||
echo "examples: PASS (frozen CLI sha256 $core_sha_before unchanged)"
|
||||
Reference in new issue
Block a user