Expand description
NDJSON event schema, trace file naming, and artifact bundle helpers (bd-1t58q).
This module defines the unified NDJSON (newline-delimited JSON) event format for all test suites, standardized trace file naming conventions, and artifact bundle directory layout helpers.
§NDJSON Schema (v1)
Every test event can be serialized as one JSON line for CI parsing, log
aggregation, and failure triage. Enable streaming output via
ASUPERSYNC_TEST_NDJSON=1.
§Standard Fields
| Field | Type | Description |
|---|---|---|
v | u32 | Schema version (NDJSON_SCHEMA_VERSION) |
ts_us | u64 | Microseconds since test start |
level | string | Log level: ERROR/WARN/INFO/DEBUG/TRACE |
category | string | Event category: reactor/io/waker/task/timer/etc. |
event | string | Specific event type (e.g., TaskSpawn) |
test_id | string? | Test identifier from TestContext |
seed | u64? | Root seed for deterministic replay |
subsystem | string? | Subsystem tag (scheduler, obligation, etc.) |
invariant | string? | Invariant being verified |
thread_id | u64 | OS thread ID |
message | string | Human-readable description |
data | object | Event-specific key-value pairs |
§Trace File Naming
{subsystem}_{scenario}_{seed:016x}.trace — binary replay trace
{subsystem}_{scenario}_{seed:016x}.ndjson — structured event log§Artifact Bundle Layout
$ASUPERSYNC_TEST_ARTIFACTS_DIR/{test_id}/{seed:016x}/
manifest.json — ReproManifest with full reproducibility info
events.ndjson — Structured event log in NDJSON format
summary.json — TestSummary from the harness
environment.json — EnvironmentMetadata snapshot
*.trace — Binary trace files (if recording enabled)
failed_assertions.json — Assertion details (on failure)§Example
ⓘ
use asupersync::test_ndjson::{NdjsonLogger, write_artifact_bundle};
use asupersync::test_logging::{TestLogLevel, TestEvent, TestContext, ReproManifest};
let ctx = TestContext::new("my_test", 0xDEAD_BEEF).with_subsystem("scheduler");
let logger = NdjsonLogger::enabled(TestLogLevel::Info, Some(ctx.clone()));
logger.log(TestEvent::TaskSpawn { task_id: 1, name: Some("worker".into()) });
let manifest = ReproManifest::from_context(&ctx, true).with_env_snapshot();
let bundle = write_artifact_bundle(&manifest, Some(&logger), None).unwrap();Structs§
- Ndjson
Event - A single NDJSON (newline-delimited JSON) event line.
- Ndjson
Logger - An NDJSON log writer that wraps
TestLoggerand optionally streams structured JSON lines to stderr for CI log parsing.
Constants§
- NDJSON_
SCHEMA_ VERSION - NDJSON schema version for structured test event lines.
Functions§
- artifact_
base_ dir - Resolve the artifact base directory from the environment.
- artifact_
bundle_ dir - Generate the standard artifact bundle directory path.
- ndjson_
file_ name - Generate a standardized NDJSON log file name.
- trace_
file_ name - Generate a standardized trace file name.
- write_
artifact_ bundle - Write a complete artifact bundle for a test execution.