Skip to content

feat(core,cli): export traces to the Open OCPP Trace format#126

Merged
sepehr-safari merged 1 commit into
mainfrom
feat/open-ocpp-trace-export
Jul 17, 2026
Merged

feat(core,cli): export traces to the Open OCPP Trace format#126
sepehr-safari merged 1 commit into
mainfrom
feat/open-ocpp-trace-export

Conversation

@sepehr-safari

Copy link
Copy Markdown
Member

Writes the vendor-neutral Open OCPP Trace interchange format from DebugKit, the producer counterpart of #124: any trace the toolkit can parse becomes a file other OCPP tools can consume.

What's in it

  • toOpenOcppTraceRecords() / toOpenOcppTraceJsonl() export parsed events as v1.1 records:
    • raw on every record - serialized from the stored frame, decoding to exactly the fields the record decomposes.
    • response action back-fill - derived by messageId correlation, so it always equals the correlated CALL's action.
    • skip-and-flag - events the format cannot represent (no timestamp, or an unknown direction, as the bare-array input format produces) are skipped with a warning rather than invented.
    • connectorId lifted from request payloads; trace-level ocppVersion / chargePointId supplied via an options bag.
  • ocpp-debugkit convert <file> [--output] emits the JSONL from the command line: data on stdout, warnings on stderr, and trace-level metadata carried over from JSON Object inputs.

Conformance

For each of the 15 vendored fixtures: exporting the parsed events reproduces the fixture's expected.json consumer view, every exported record validates against the specification's published JSON Schema (vendored alongside the fixtures), and re-parsing the export yields the same events. The installed-package smoke test covers the new exports and a real convert run.

Notes

  • API shape refined from the issue sketch: the exporters take Event[] plus an options bag and return { records, warnings }, since skip-and-flag needs a warnings channel and the internal event model carries no trace-level metadata (the known scope note from feat(core): parse the Open OCPP Trace interchange format #124).
  • ajv / ajv-formats are test-only devDependencies; nothing ships in the package.
  • The changeset folds into the 0.4.0 release already staged by chore: version packages #125.

Closes #122

toOpenOcppTraceRecords() and toOpenOcppTraceJsonl() emit any parsed trace
as Open OCPP Trace v1.1 records: raw serialized from the stored frame,
response action back-filled by messageId correlation, connectorId lifted
from request payloads, and trace-level ocppVersion/chargePointId supplied
via options. Events the format cannot represent (no timestamp, unknown
direction) are skipped with a warning rather than invented.

A new CLI command, ocpp-debugkit convert <file> [--output], writes the
JSONL with data on stdout and warnings on stderr, carrying trace-level
metadata over from JSON Object inputs.

Conformance: every exported record is validated against the vendored
specification JSON Schema, and per-fixture round-trip tests prove that
export-then-reparse reproduces the expected consumer view and the exact
events.
@sepehr-safari
sepehr-safari merged commit 0115e85 into main Jul 17, 2026
2 checks passed
@sepehr-safari
sepehr-safari deleted the feat/open-ocpp-trace-export branch July 17, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(core,cli): export traces to Open OCPP Trace v1.1

1 participant