feat(engine): session timeline correlation + close out S1#18
Merged
Conversation
Add `src/ocpp/timeline.zig` — the final S1 engine module — correlating normalized events into logical charging sessions, and close out the milestone. Mirrors the toolkit's `core/timeline.ts` (the shared conformance contract), not its source. - Correlate by transactionId (StartTransaction response; StopTransaction / MeterValues request payloads), with responses inheriting their Call's id. - Distribute un-keyed events by connectorId and time proximity; Boot / Heartbeat attach to the first session; a trace with no StartTransaction collapses to a single session. - Session status (completed / aborted / active), start / end times, and time-ordered, renumbered sessions. - Vendor the `normal-session` fixture and add an end-to-end pipeline test (parse -> normalize -> correlate); the toolkit's timeline cases are ported. - Mark S1 complete in ROADMAP.md and CURRENT_STATE.md. Closes #14
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 & why
Final slice of S1 — Engine core:
src/ocpp/timeline.zig, which correlatesnormalized events into logical charging sessions — and the S1 close-out.
Mirrors the toolkit's
core/timeline.ts(the shared conformance contract).Changes
transactionId(from the StartTransactionresponse, and from StopTransaction / MeterValues request payloads), with
responses inheriting their Call's id by
messageId.by time proximity (the contract's grace windows), Boot / Heartbeat to the
first session; a trace with no StartTransaction collapses to one session.
stationIdfrom BootNotification,connectorIdfromStartTransaction, status (
completed/aborted/active), start / endtimes, and time-ordered
session-0…numbering.src/ocpp/testdata/normal-session.jsonplus a testthat drives the whole pipeline
parseTrace → normalizeEvents → buildSessionTimeline.S1 close-out
ROADMAP.mdandCURRENT_STATE.mdmark S1 — Engine core ✅ complete, withthe
ocppengine area done for S1 and S2 (Detection + conformance) next.S1 exit criteria met: the vendored fixture parses (22 events, 0 warnings) and
correlates into one completed session (
transactionId100001, connector 1,station
CS-SYNTHETIC-001); the whole engine tests green headlessly on macOS +Linux.
Testing
native test -Dplatform=null→ 33/33 pass (8 new timeline tests: thetoolkit's
timeline.test.tscases — normal/active/aborted/no-transaction/multi-session/empty/station-fallback — plus the end-to-end fixture pipeline).
native check --strictandzig fmt --checkclean.Closes #14