feat(analysis): consume the current public Analysis v3 contract

- add the process boundary for the core CLI: explicit MARQDO_BIN/--marqdo-bin
  only (never PATH), argv-only invocation of check ENTRY --emit, bounded
  timeout, private temp artifact, exit checks and absolute-path sanitisation
- deserialize every Analysis record with closed serde shapes and validate
  semantic invariants that JSON Schema cannot express: identities, source
  digests, UTF-8 spans, unit tree/order/mode ancestry, anchors, functions and
  signatures, references states, calls, resources, diagnostics and budgets
- validate statement/expression trees structurally with depth and span checks
- convert accepted modules into DocumentFacts, preserving honest upstream
  reference states and one node per Exec unit/function
- merge modules across entry contexts only when identity and source agree,
  otherwise report knowledge.analysis_context_conflict
- add the real rc.4 Analysis positive fixture (with provenance and regeneration
  script), tamper negative tests and optional real-binary integration tests
This commit is contained in:
marqdo-knowledge committed 2026-11-26 00:29:19 +08:00
1 parent 682717a610
commit 59d5afe10b
14 files changed
+3474 -57

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
# Analysis fixture provenance
`mechanics.json` is a real `marqdo.analysis` revision-3 artefact captured from
the upstream release candidate, not a hand-written example. Tests use it as the
positive fixture for the closed-shape and semantic validator and for the
`DocumentFacts` conversion.
- Producer: `marqdo 3.0.0-rc.4` (`4bbefc92449ee480c8a2c89b0308feb4cda8d0e7`),
Linux x86_64.
- Command (captured from the project directory):
```sh
"$MARQDO_BIN" check physics/mechanics.mq.md --emit analysis.json
```
- Source project: a minimal `marqdo.yaml` plus one document with a namespace,
a Knowledge H2, an Exec H2 with parameters, a Markdown link to an anchor, a
formula, a table and a front matter block.
- Fixture SHA-256: see `mechanics.json.sha256`.
- Regenerate with `scripts/regenerate-analysis-fixture.sh SHA256_OF_CORE_BINARY`
and record the new producer version and binary digest if the contract changes.
A revision that cannot be consumed by the current validator must be treated as
a broken producer/consumer pair, never patched into the tests.