observation: deliver one execution event sequence to stream and snapshot
This commit is contained in:
1 parent
f83d992c61
commit
404d559b86
97 files changed
+2672
-3128
No files matched your search
@@ -0,0 +1,21 @@
|
||||
# Observation fixtures
|
||||
|
||||
These are the minimal executable fixtures from RFC-OBS-0001 §13 plus the
|
||||
schema-validation fixtures used by
|
||||
[`observation_consumer.py`](../../observation_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/observation/basic.mq.md --output jsonl
|
||||
python3 tests/consumers/observation_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 @@
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":3,"kind":"stdout.chunk","payload":{"encoding":"base64","byte_count":13}}
|
||||
@@ -0,0 +1 @@
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":4,"kind":"call.exit","payload":{"frame_id":"f1","status":"return","module_id":"m","span":{"start":1}}}
|
||||
@@ -0,0 +1 @@
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":5,"kind":"run.completed","payload":{"status":"ok"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"","seq":0,"kind":"stream.opened","payload":{"producer":{"name":"marqdo","version":"3.0.0-beta.1"},"protocol":{"name":"marqdo.observation","schema_version":1},"observation":{"level":"structural","values":false,"selected_variables":[],"selected_parameters":[],"allow_text_values":false},"limits":{"max_observation_events":100000,"max_observation_bytes":16777216,"max_value_bytes":256}}}
|
||||
@@ -0,0 +1 @@
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":0,"kind":"stream.opened"}
|
||||
@@ -0,0 +1 @@
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","kind":"stream.opened","payload":{"producer":{"name":"marqdo","version":"3.0.0-beta.1"},"protocol":{"name":"marqdo.observation","schema_version":1},"observation":{"level":"structural","values":false,"selected_variables":[],"selected_parameters":[],"allow_text_values":false},"limits":{"max_observation_events":100000,"max_observation_bytes":16777216,"max_value_bytes":256}}}
|
||||
@@ -0,0 +1 @@
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":-1,"kind":"stream.opened","payload":{"producer":{"name":"marqdo","version":"3.0.0-beta.1"},"protocol":{"name":"marqdo.observation","schema_version":1},"observation":{"level":"structural","values":false,"selected_variables":[],"selected_parameters":[],"allow_text_values":false},"limits":{"max_observation_events":100000,"max_observation_bytes":16777216,"max_value_bytes":256}}}
|
||||
@@ -0,0 +1 @@
|
||||
{"schema":"marqdo.observation","schema_version":2,"run_id":"run-fixture-1","seq":0,"kind":"stream.opened","payload":{"producer":{"name":"marqdo","version":"3.0.0-beta.1"},"protocol":{"name":"marqdo.observation","schema_version":1},"observation":{"level":"structural","values":false,"selected_variables":[],"selected_parameters":[],"allow_text_values":false},"limits":{"max_observation_events":100000,"max_observation_bytes":16777216,"max_value_bytes":256}}}
|
||||
@@ -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,14 @@
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":0,"kind":"stream.opened","payload":{"producer":{"name":"marqdo","version":"3.0.0-beta.1"},"observation":{"level":"values","values":true,"selected_variables":["visible_count"],"selected_parameters":["n"],"allow_text_values":false},"limits":{"max_observation_events":100,"max_observation_bytes":1048576,"max_value_bytes":256}}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":1,"kind":"run.started","payload":{"entry":"root:demo@0.1.0::index.mq.md::main","mode":"project","source":{"root_id":"root:demo@0.1.0","analysis_digest":"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},"started_unix_ms":1763800000000}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":2,"kind":"call.enter","payload":{"frame_id":"f1","parent_frame_id":null,"function_id":"root:demo@0.1.0::index.mq.md::main","module_id":"root:demo@0.1.0::index.mq.md","span":null}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":3,"kind":"parameter.observed","payload":{"frame_id":"f1","name":"n","source":"provided","value_type":"Int","module_id":"root:demo@0.1.0::index.mq.md","span":null,"value_state":"observed","value":{"type":"int","decimal":"5"}}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":4,"kind":"variable.assigned","payload":{"frame_id":"f1","name":"visible_count","value_type":"Int","module_id":"root:demo@0.1.0::index.mq.md","span":{"start":80,"end":100},"value_state":"observed","value":{"type":"int","decimal":"42"}}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":5,"kind":"variable.assigned","payload":{"frame_id":"f1","name":"secret_token","value_type":"Text","module_id":"root:demo@0.1.0::index.mq.md","span":{"start":110,"end":150},"value_state":"redacted"}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":6,"kind":"branch.eval","payload":{"frame_id":"f1","result":true,"module_id":"root:demo@0.1.0::index.mq.md","span":{"start":160,"end":170}}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":7,"kind":"loop.iteration","payload":{"frame_id":"f1","decision":"continue","module_id":"root:demo@0.1.0::index.mq.md","span":{"start":180,"end":190}}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":8,"kind":"effect","payload":{"operation":"print","result_code":"ok","module_id":"root:demo@0.1.0::index.mq.md","span":{"start":200,"end":210},"frame_id":"f1"}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":9,"kind":"stderr.chunk","payload":{"encoding":"base64","data_base64":"AA==","byte_count":1}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":10,"kind":"return","payload":{"frame_id":"f1","value_type":"Int","module_id":"root:demo@0.1.0::index.mq.md","span":{"start":220,"end":230}}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":11,"kind":"call.exit","payload":{"frame_id":"f1","status":"return","module_id":"root:demo@0.1.0::index.mq.md","span":null}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":12,"kind":"observation.truncated","payload":{"reason":"event_budget","limit":100,"written":100,"dropped":null}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":13,"kind":"run.completed","payload":{"status":"ok","value":{"type":"int","decimal":"42"},"value_type":"Int"}}
|
||||
@@ -0,0 +1,6 @@
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":0,"kind":"stream.opened","payload":{"producer":{"name":"marqdo","version":"3.0.0-beta.1"},"observation":{"level":"structural","values":false,"selected_variables":[],"selected_parameters":[],"allow_text_values":false},"limits":{"max_observation_events":100000,"max_observation_bytes":16777216,"max_value_bytes":256}}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":1,"kind":"run.started","payload":{"entry":"root:demo@0.1.0::index.mq.md::main","mode":"project","source":{"root_id":"root:demo@0.1.0","analysis_digest":"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},"started_unix_ms":1763800000000}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":2,"kind":"call.enter","payload":{"frame_id":"f1","parent_frame_id":null,"function_id":"root:demo@0.1.0::index.mq.md::main","module_id":"root:demo@0.1.0::index.mq.md","span":null}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":3,"kind":"stdout.chunk","payload":{"encoding":"base64","data_base64":"5byA5aeL5paH5pysCg==","byte_count":13}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":4,"kind":"call.exit","payload":{"frame_id":"f1","status":"return","module_id":"root:demo@0.1.0::index.mq.md","span":{"start":10,"end":20}}}
|
||||
{"schema":"marqdo.observation","schema_version":1,"run_id":"run-fixture-1","seq":5,"kind":"run.completed","payload":{"status":"ok","value":{"type":"int","decimal":"10"},"value_type":"Int"}}
|
||||
@@ -0,0 +1,9 @@
|
||||
# @knowledge Execution Events fixture D
|
||||
|
||||
## @exec main
|
||||
|
||||
`secret_token = "DO_NOT_LEAK_SENTINEL_1"`
|
||||
|
||||
`visible_count = 42`
|
||||
|
||||
`return visible_count`
|
||||
Reference in new issue
Block a user