Skip to content

feat(engine): session timeline correlation + close out S1#18

Merged
sepehr-safari merged 1 commit into
mainfrom
feat/engine-timeline
Jul 11, 2026
Merged

feat(engine): session timeline correlation + close out S1#18
sepehr-safari merged 1 commit into
mainfrom
feat/engine-timeline

Conversation

@sepehr-safari

Copy link
Copy Markdown
Member

What & why

Final slice of S1 — Engine core: src/ocpp/timeline.zig, which correlates
normalized events into logical charging sessions — and the S1 close-out.
Mirrors the toolkit's core/timeline.ts (the shared conformance contract).

Changes

  • Correlation — group by transactionId (from the StartTransaction
    response, and from StopTransaction / MeterValues request payloads), with
    responses inheriting their Call's id by messageId.
  • Un-keyed distribution — attach connector-matched and connector-less events
    by time proximity (the contract's grace windows), Boot / Heartbeat to the
    first session; a trace with no StartTransaction collapses to one session.
  • Session factsstationId from BootNotification, connectorId from
    StartTransaction, status (completed / aborted / active), start / end
    times, and time-ordered session-0… numbering.
  • End-to-end — vendored src/ocpp/testdata/normal-session.json plus a test
    that drives the whole pipeline parseTrace → normalizeEvents → buildSessionTimeline.

S1 close-out

ROADMAP.md and CURRENT_STATE.md mark S1 — Engine core ✅ complete, with
the ocpp engine 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 (transactionId 100001, connector 1,
station CS-SYNTHETIC-001); the whole engine tests green headlessly on macOS +
Linux.

Testing

  • native test -Dplatform=null33/33 pass (8 new timeline tests: the
    toolkit's timeline.test.ts cases — normal/active/aborted/no-transaction/
    multi-session/empty/station-fallback — plus the end-to-end fixture pipeline).
  • native check --strict and zig fmt --check clean.

Closes #14

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
@sepehr-safari sepehr-safari added this to the S1 — Engine core milestone Jul 11, 2026
@sepehr-safari sepehr-safari added type:feature New capability area:engine Pure Zig OCPP engine priority:high labels Jul 11, 2026
@sepehr-safari
sepehr-safari merged commit 08d9aa3 into main Jul 11, 2026
3 checks passed
@sepehr-safari
sepehr-safari deleted the feat/engine-timeline branch July 11, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:engine Pure Zig OCPP engine priority:high type:feature New capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(engine): session timeline correlation + S1 close-out

1 participant