obs(03-05): fixtures, black-box schema test, CI/consumer gate and protocol docs

This commit is contained in:
cflmy committed 2026-11-22 16:04:54 +08:00
1 parent e6e497e68b
commit 2d51f08340
21 files changed
+467 -13

No files matched your search

+16
View File
@@ -51,6 +51,7 @@ Rust harnesses (all in `crates/cli/tests/`):
| `negative.rs` | Current-syntax diagnostics are **hard errors** (never prose fallbacks): exact sorted `sem.*`/`symbol.*`/`call.*`/`frontmatter.*` code lists, the `sem.inferred_signature` warning model with inert-knowledge controls, and runtime error codes — each asserted in its own suite. |
| `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. |
| `execution_events.rs` | Execution Events v1 black-box contract: pure JSONL, seq/terminal ordering, byte-exact base64 chunks, live delivery before exit, value redaction/selection, trace coexistence, truncation, output budget and broken-pipe failure. |
## Running
@@ -75,6 +76,21 @@ cargo test -p marqdo-cli --test properties
cargo test -p marqdo-cli --test integration_cli
```
Execution Events v1 (RFC-OBS-0001, ADR-0059) is pinned by:
* `crates/cli/tests/execution_events.rs` — real-binary NDJSON contract, the
checked-in JSON Schema fixtures, the structure fixture, live output, values,
trace coexistence and a broken pipe;
* `crates/marqdo-host/tests/observation.rs` — real commit-point chunks, frame
pairing, budget truncation and the broken-sink failure boundary;
* `crates/marqdo-runtime/tests/observation.rs` — recursive/repeated call frames,
branch/loop/assignment attribution and exact value selection;
* `tests/consumers/execution_events_consumer.py` and
`tests/consumers/fixtures/execution-events/` — the independent Python consumer
and the RFC §13 fixtures. `python3` + `jsonschema` enable the schema test and
the Woodpecker lane runs the consumer against a real `--event-stream jsonl`
invocation.
The power/control-flow slice is pinned by:
* AST fixtures 151–160: code-span vs tight/spaced `**`, multi-backtick spans,
@@ -0,0 +1,21 @@
# Execution Events v1 fixtures
These are the minimal executable fixtures from RFC-OBS-0001 §13 plus the
schema-validation fixtures used by
[`execution_events_consumer.py`](../../execution_events_consumer.py).
| File | Purpose |
|---|---|
| `basic.mq.md` | Fixture A: live stdout ordering and return value. |
| `realtime.mq.md` | Fixture B: `READY` must be observable before the run exits. |
| `structure.mq.md` | Fixture C: `main -> f -> g`, repeated calls, branch, loop. |
| `values.mq.md` | Fixture D: default privacy and exact value selection. |
| `valid/*.jsonl` | Schema-valid streams (minimal and full event table). |
| `invalid/*.json` | One-object negative fixtures: unknown major, missing/`negative` seq, bad chunk/span/terminal. |
The `.mq.md` files are inputs to the released CLI:
```bash
marqdo run tests/consumers/fixtures/execution-events/basic.mq.md --event-stream jsonl
python3 tests/consumers/execution_events_consumer.py /tmp/events.jsonl
```
@@ -0,0 +1,11 @@
# @knowledge Execution Events fixture A
## @exec main
`打印("START")`
`n = 10`
`打印("DONE")`
`return n`
@@ -0,0 +1,17 @@
# @knowledge Execution Events fixture B
## @exec main
`打印("READY")`
`i = 0`
`while i < 2000000`
`i = i + 1`
`end`
`打印("FINISH")`
`return i`
@@ -0,0 +1,35 @@
# @knowledge Execution Events fixture C
## @exec g
`params(n: Int)`
`return n + 1`
## @exec f
`params(n: Int)`
`if n > 0`
`return g(n=n)`
`end`
`return n`
## @exec main
`i = 0`
`while i < 2`
`i = i + 1`
`end`
`a = f(n=2)`
`b = f(n=0)`
`return a + b`
@@ -0,0 +1,9 @@
# @knowledge Execution Events fixture D
## @exec main
`secret_token = "DO_NOT_LEAK_SENTINEL_1"`
`visible_count = 42`
`return visible_count`