Syntax K complexity telemetry (WebIR + emit)
This page defines the repository-wide method for tracking syntax K complexity of Vox output programs.
Scope
- Measure complexity of compiler outputs, not Rust source complexity.
- Primary object: canonical WebIR JSON.
- Secondary object: canonicalized emitted output bundle (for current tests: TSX preview emit bundle).
- Collection points: compiler golden/parity tests and eval-matrix benchmark classes.
Mathematics
K is uncomputable; Vox uses practical compression-based proxies:
- Absolute estimate:
K_est(x) = min_z |z(x)|over fixed compressorsz = {zstd,bzip2,gzip}with pinned profiles.
- Relative drift:
NCD_z(x,y) = (|z(xy)| - min(|z(x)|,|z(y)|)) / max(|z(x)|,|z(y)|).
- Support metrics:
- structural counts from
WebIrLowerSummaryandWebIrValidateMetrics.
- structural counts from
Event contract
Events are written to research_metrics with:
session_id = syntaxk:<repository_id>metric_type = syntax_k_eventmetadata_jsonpayload conforming to:contracts/eval/syntax-k-event.schema.json
Core payload fields:
schema_versionfixture_idsource_hashweb_ir_hashtarget_kindraw_bytescompressor_resultsk_est_bytesncd_vs_baseline(optional)support_metrics(optional): may includerepresentability,llm_surface, andruntime_projectionsummaries (canonical SHA-3 of runtime projection JSON, policy counts, host-probe flag whenVOX_RUNTIME_PROJECTION_INCLUDE_HOST_PROBE=1, and whether module-level task hints were inferred fromdb.*.using/.scopemetadata). Shape is forward-compatible (additionalPropertiesallowed in eval schema).toolchain_fingerprint
Reproducibility protocol
- Canonicalize output bytes before compression.
- Keep compressor set/profile fixed.
- Use deterministic concatenation policy for NCD (
len(x)||x||len(y)||y). - Record toolchain/profile fingerprint in every event.
- Start with observe-only tracking; avoid immediate hard fail gates.
Integration surfaces
- Compiler estimators:
crates/vox-compiler/src/syntax_k.rs - Compiler test artifacts:
target/benchmarks/syntax-k/golden/*.jsontarget/benchmarks/syntax-k/parity/*.json
- VoxDB API:
VoxDb::record_syntax_k_eventVoxDb::list_syntax_k_events
- Eval matrix classes:
vox_compiler_syntax_k_webirvox_compiler_syntax_k_emitvox_compiler_syntax_k_regression_gate
- MCP tools:
vox_benchmark_list/vox_benchmark_recordwithmetric_type = syntax_k_event
Rollout gates
VOX_SYNTAX_K_TELEMETRY=1|true- Enables writing syntax-K telemetry rows from CLI benchmark paths.
- If unset, falls back to
VOX_BENCHMARK_TELEMETRY.
VOX_SYNTAX_K_GATEobserve(default): track and emit artifacts only.enforce: enables threshold assertion in the regression-gate benchmark test.
VOX_SYNTAX_K_MAX_BYTES- Optional byte threshold used only when gate mode is
enforce.
- Optional byte threshold used only when gate mode is