Files
marqdo-cli/spec/schemas/trace-v2.schema.json
cflmy d890686a2b feat(trace): Trace v2 identity, module-owned events and capacity bounds (B-16)
- bind traces to the logical project identity and the exact emitted Analysis
  digest; every span-bearing event carries module_id
- add host TraceState budgets (100k events / 32 MiB defaults), CLI
  --trace-max-events/--trace-max-bytes, terminal trace.truncated events, and a
  final serialized byte cap; budgets never change run.status
- disable semantic recording when no trace is requested
- cap worker frames at 8 MiB, align request/result/capability wire caps, make
  clean EOF distinct from protocol errors, and mark/kill a worker after a
  transport failure instead of reusing it
- add trace-v2 spec/schema, independent trace consumer, CI check and tests
- record the S2/C state in STATUS
2026-11-20 13:01:22 +08:00

87 lines
2.7 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://marqdo.dev/schemas/trace-v2.schema.json",
"title": "Marqdo Trace v2",
"type": "object",
"required": ["schema", "schema_version", "run", "source", "limits", "truncated", "events"],
"properties": {
"schema": {"const": "marqdo.trace"},
"schema_version": {"const": 2},
"run": {
"type": "object",
"required": ["id", "entry", "status"],
"properties": {
"id": {"type": "string", "minLength": 1},
"entry": {"type": "string", "minLength": 1},
"status": {"type": "string", "minLength": 1}
},
"additionalProperties": true
},
"source": {
"type": "object",
"required": ["root_id", "analysis_digest"],
"properties": {
"root_id": {"type": "string", "pattern": "^(root:|sha256:[0-9a-f]{64}$)"},
"analysis_digest": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"}
},
"additionalProperties": true
},
"limits": {
"type": "object",
"required": ["max_events", "max_bytes"],
"properties": {
"max_events": {"type": "integer", "minimum": 0},
"max_bytes": {"type": "integer", "minimum": 0}
},
"additionalProperties": false
},
"truncated": {
"oneOf": [
{"type": "null"},
{
"type": "object",
"required": ["reason", "limit", "written"],
"properties": {
"reason": {"enum": ["event_budget", "byte_budget"]},
"limit": {"type": "integer", "minimum": 0},
"written": {"type": "integer", "minimum": 0}
},
"additionalProperties": true
}
]
},
"events": {
"type": "array",
"items": {
"type": "object",
"required": ["seq", "kind", "module_id", "span", "detail"],
"properties": {
"seq": {"type": "integer", "minimum": 0},
"kind": {"type": "string", "minLength": 1},
"function_id": {"type": ["string", "null"]},
"module_id": {"type": ["string", "null"]},
"span": {
"oneOf": [
{"type": "null"},
{
"type": "object",
"required": ["start", "end"],
"properties": {
"start": {"type": "integer", "minimum": 0},
"end": {"type": "integer", "minimum": 0}
},
"additionalProperties": true
}
]
},
"detail": {"type": ["string", "null"]},
"operation": {"type": "string"},
"duration_micros": {"type": "integer", "minimum": 0}
},
"additionalProperties": true
}
}
},
"additionalProperties": true
}