feat(engine): semantic trace diff#49
Merged
Merged
Conversation
Add src/ocpp/diff.zig: compare two parsed traces, mirroring the toolkit's core/diff.ts. Match events by OCPP UniqueId; report field-level differences (timestamp / direction / action / payload / errorCode) for shared ids, added/removed events, a failure-set delta by code, and a first-session summary comparison with human-readable difference lines. Includes a recursive JSON deep-equality check (numbers compare by value across representations, as in the toolkit) and a compact-JSON renderer for the changed payload values. Pure and headless; the result borrows from the input traces' arena. Closes #43.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
feat(engine): semantic trace diff (S4 #43) — compare two parsed traces.Closes #43.
Changes
src/ocpp/diff.zig—diffTraces(a, b)mirroring the toolkit'score/diff.ts:message_id);only_in_a/only_in_bpartition the unmatched.
EventDiffper differing field(
timestamp/direction/action/payload/error_code).toolkit's exact difference lines (event/failure count, status, duration,
transaction id).
representations, matching JS
===) and a compact-JSON renderer for changedpayload values.
ocpp.zig; CURRENT_STATE updated.Notes
gpa(arena-oriented, like therest of the engine).
EventDiffvalues are rendered to display strings (Zig has nounknown); thediff is a reporting artifact consumed by the CLI (feat(cli): headless CLI subcommands + parity table #45).
occurrence of each id to B's k-th.
Tests
109/109 headless tests pass (
native test -Dplatform=null);native check --strictclean;zig fmtclean. New coverage: identical → empty diff,added/removed partitioning, each modified field with rendered values, nested
deep-equal vs nested-different payloads, and a failure-set + summary delta over
failed-auth vs normal-session.