- add an independent schema job with a pinned Draft 2020-12 validator that validates real Analysis v2/Trace v2/Tool artifacts and negative mutations - tighten the tool schema (SemVer, package-relative entrypoint, non-empty protocol arrays) - run cargo test --workspace plus portable CLI/analysis/trace smoke and a strict-refusal assertion on Windows and macOS - record honestly that Tool/C-ABI/worker runtime coverage remains Unix-only
Marqdo conformance and integration test corpus
This directory holds the P0/P1 conformance corpus required by
docs/DEVELOPMENT_BLUEPRINT.md §13/§14. The Rust harnesses live in
crates/cli/tests/ (they use the workspace libraries directly and the
marqdo binary via CARGO_BIN_EXE_marqdo); the fixtures are plain files here
so they can be rendered, diffed and reviewed like Markdown documents.
Everything here is data. Nothing in this directory modifies the repository, and no test commits, copies or rewrites files outside a throw-away temp directory.
Layout
tests/
├── conformance/
│ ├── ast/ 150 × *.mq.md + sibling *.ast.json goldens
│ └── semantics/ 36 × *.mq.md + sibling *.expected.json goldens
├── negative/
│ ├── *.mq.md 48 × compile-time hard-error fixtures + *.expected.json
│ ├── warnings/ 6 × inert-executable warning fixtures + *.expected.json
│ └── runtime/ 10 × runtime-error fixtures + *.expected.json
└── README.md this file
Rust harnesses (all in crates/cli/tests/):
| Harness | What it proves |
|---|---|
conformance_ast.rs |
The frozen marqdo.md.v1 profile parses each fixture into exactly the checked-in AST (node kinds, attributes, literals, byte spans, order). |
conformance_semantics.rs |
Each semantic fixture compiles through marqdo_frontend, is assembled into marqdo_ir::Program and executed with marqdo_runtime + marqdo_host::StdHost; returned wire value and program stdout match. |
negative.rs |
Invalid executable shapes are hard errors (never prose fallbacks), exact sorted diagnostic-code lists; warnings and runtime error codes are asserted in their own suites. |
properties.rs |
Blueprint §14.2 prose invariance: inserting/removing pure narration paragraphs never changes the executable function IR (modulo source spans) and diagnostics stay error-free. |
integration_cli.rs |
Real CLI contract: init, check, run, call, inspect, fmt, multi-module imports/cycles, lock/sync --locked, plugin inspection and explicitly trusted plugin invocation. |
Running
Use the workspace cargo cache/target as documented in AGENTS.md:
export PATH=/root/.cargo/bin:$PATH
export CARGO_HOME=/root/work/marqdo-cli/.cache/cargo
export CARGO_TARGET_DIR=/root/work/marqdo-cli/.cache/target
cargo test -p marqdo-cli # all conformance + integration harnesses
cargo test --workspace # whole workspace (includes crate unit tests)
Individual harnesses:
cargo test -p marqdo-cli --test conformance_ast
cargo test -p marqdo-cli --test conformance_semantics
cargo test -p marqdo-cli --test negative
cargo test -p marqdo-cli --test properties
cargo test -p marqdo-cli --test integration_cli
Fixture discovery is directory-based and sorted by file name, so the order is deterministic on every platform. The AST and semantic suites fail loudly if the corpus shrinks below 100 / 25 fixtures, and the negative suite fails below 30 compile-time hard-error fixtures.
AST goldens and UPDATE_GOLDENS
*.ast.json files are the pretty-printed canonical AST view
(marqdo_markdown::parse(source).root), exactly as marqdo inspect --ast --json
would print it. They pin parser version, extension flags and span arithmetic.
Regenerate only for an intentional, ADR-backed profile change (the profile
is frozen in spec/markdown-profile.md):
UPDATE_GOLDENS=1 cargo test -p marqdo-cli --test conformance_ast
The update run rewrites every golden, prints how many it rewrote and passes. Re-run without the variable to verify, and review the golden diff: a golden change is a language change, not a bug fix.
A fixture without a golden is an error, and a golden without a fixture is an error (stale corpus output), so add/remove both together.
Semantic goldens
Each *.expected.json has the shape:
{
"function": "<name passed to marqdo_runtime::run>",
"args": { "<name>": <wire value> },
"value": <wire value>,
"stdout": "..."
}
argsandvalueuse the typed wire encoding frommarqdo_value::to_wire({"type":"int","decimal":"42"},{"type":"text","value":"…"}, …).stdoutis the program output captured from the host (never diagnostics).- Optional
"grants": ["foreign"]enablesforeign.call; that fixture is skipped with a printed notice whenpython3is unavailable.
All values were produced by running the implementation and then checked by
hand against the fixture source. UPDATE_SEMANTICS_GOLDENS=1 exists for
authoring convenience, but it must not be used blindly: rewriting a semantic
golden without verifying the value would defeat the purpose of the corpus.
Negative fixtures
Compile-time (tests/negative/*.mq.md):
{"codes": ["markdown.invalid_construct"]}
The expected list is the exact sorted multiset of error diagnostic codes
produced by marqdo_frontend::analyze_source. Warnings emitted by the same
document are ignored here. Every listed code is additionally asserted to have
error severity, and every fixture must produce at least one error — invalid
executable shapes never fall back to prose.
Warnings (tests/negative/warnings/*.mq.md):
{"severity": "warning", "codes": ["markdown.inert_executable"]}
These documents must compile without errors; the sorted multiset of warning
codes must match exactly. return/strong/lists/block quotes outside a
function body are inert content (warning), not hard errors.
Runtime (tests/negative/runtime/*.mq.md):
{"function": "main", "args": {}, "codes": ["runtime.division_by_zero"]}
These documents compile, then must fail at runtime with the expected stable
error code. Optional keys: "grants": ["foreign"] and "stack_limit": 24
(used for the recursion-depth fixture so the budget — not the host process
stack — is what fails).
CLI integration notes
integration_cli.rs never leaves the repository dirty:
- temporary projects are created under
std::env::temp_dir()and removed on drop; - the demo C plugin is built in a temp copy of
examples/plugin-demo(cc -shared -fPIC -I <repo>/include), and thesha256in the copiedplugin.yamlis refreshed there. The repo copy and its.so(gitignored) are never touched; - tests that need
python3orccprint a skip notice and return when the tool is unavailable.
Notes discovered while authoring (all since fixed)
The fixtures initially pinned three observations that were reported and then fixed in the implementation; the goldens below reflect the fixed behaviour:
- wire floats round-trip exactly (
serde_json/float_roundtripis enabled), so Pythonmath.pi * 9keeps28.274333882308138; - the default interpreter stack budget is 128 frames so a deeply recursive
document returns a structured
resource.exhaustedinstead of exhausting the native debug-build stack (--stackcan raise it deliberately); - an external-link call form (
> [x](https://example.com)()) is rejected withref.unresolved, the same code used for other unresolvable call targets.