topmark.diagnostic.machine.envelopes¶
topmark / diagnostic / machine / envelopes
NDJSON envelope builders for diagnostic machine-readable output.
This module defines shared helpers for emitting diagnostics as NDJSON records according to TopMark's machine-readable output contract.
Scope
- Build one NDJSON record per diagnostic (
kind="diagnostic"). - Attach shared
metainformation and a stabledomainidentifier (e.g."config"or"pipeline"). - Remain independent of any concrete diagnostic container by relying on
the structural
DiagnosticsLikeprotocol.
Design notes
- This module operates on internal diagnostics
(
Diagnostic) and is intentionally decoupled from JSON payload schemas such asMachineDiagnosticEntry, which are used only for JSON envelopes. - NDJSON records are yielded as plain mappings; serialization to strings is handled at a higher layer.
- The helpers here are reused by multiple domains (config, pipeline, etc.) to guarantee consistent diagnostic streaming semantics.
iter_diagnostic_ndjson_records ¶
Yield one NDJSON diagnostic record per internal diagnostic.
Notes
This helper is shared across multiple domains (config, pipeline, etc.) to ensure diagnostic streaming is consistent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
meta
|
MetaPayload
|
Shared metadata payload. |
required |
domain
|
str
|
Stable domain identifier (e.g. |
required |
diagnostics
|
DiagnosticsLike
|
Diagnostic container yielding internal
|
required |
Yields:
| Type | Description |
|---|---|
dict[str, object]
|
One mapping per diagnostic. Each mapping is shaped as an NDJSON record with |
dict[str, object]
|
|
dict[str, object]
|
keys |