feat(m0.6-r4): public Analysis v1 and Trace v1

- add check --emit with a deterministic, read-only semantic projection:
  package-aware modules, signatures, normalized bodies, refs, calls,
  diagnostics and source digests
- remove stale analysis artifacts on compile errors; atomic writes
- add run/call --trace-file with interpreter call/branch/loop/return events
  and host effect events under one sequence; redact values and record error
  status
- add Analysis/Trace v1 specs, ADR-0015 and an independent Python consumer
- add contract tests for determinism, stale artifacts, trace ordering/status
  and secret redaction
This commit is contained in:
cflmy committed 2026-11-20 11:46:37 +08:00
1 parent 25a1faa6ef
commit b5a28a9825
16 files changed
+1365 -13

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env python3
"""Independent Analysis v1 consumer: no Marqdo/Rust imports."""
import json
import sys
if len(sys.argv) != 2:
raise SystemExit("usage: analysis_consumer.py ANALYSIS.json")
with open(sys.argv[1], encoding="utf-8") as handle:
analysis = json.load(handle)
if analysis.get("schema") != "marqdo.analysis":
raise SystemExit("unexpected schema")
if analysis.get("schema_version") != 1:
raise SystemExit("unsupported schema_version")
functions = []
for module in analysis["modules"]:
if not module["id"].startswith("root:default::"):
raise SystemExit("unexpected module identity")
if not isinstance(module["source_digest"], str) or len(module["source_digest"]) != 64:
raise SystemExit("bad source digest")
for function in module["functions"]:
body = json.dumps(function["body"], ensure_ascii=False)
functions.append((function["id"], body))
if not functions:
raise SystemExit("no functions")
print("functions=" + str(len(functions)))