feat(engine): canonical types & value boundary#15
Merged
Conversation
Bring up the pure-Zig OCPP engine's foundational data model under `src/ocpp/` — headless and UI-free, discovered by `native test`. - `Direction` / `MessageType` / `Status` enums with wire-string and type-id conversions. - `Event`, `TraceEventInput`, `Trace` (+ metadata), `ParseWarning`, `ParseResult`, and `Session`, mirroring the toolkit's conformance contract model (the shared behavior, not its source). - A `std.json.Value` payload / raw-message boundary over a per-parse arena, behind a version-tagged decode seam (ADR-0005) so OCPP 2.0.1 lands additively. - Engine test discovery wired into the root test block. Closes #11
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
First slice of S1 — Engine core: the pure-Zig OCPP engine's foundational
data model under
src/ocpp/. This is the headless, UI-free contract every laterengine module (normalizer, parser, timeline, detection) builds on.
It mirrors the toolkit's
core/types.ts— the shared conformance contract —rather than reimplementing its prose: the shapes and enums match so Studio can
later prove byte-for-byte parity against the same fixtures.
Changes
src/ocpp/types.zig—Direction/MessageType/Statusenums (withwire-string ⇄ value and MessageTypeId conversions), plus
Event,TraceEventInput,Trace(+TraceMetadata),ParseWarning,ParseResult,and
Session.are carried as
std.json.Valueover a single per-parse arena, behind aversion-tagged decode seam so OCPP 2.0.1 is additive, not a rewrite.
src/ocpp/ocpp.zig— engine aggregate root; test discovery wired into theroot
testblock sonative testexercises engine tests.CURRENT_STATE.mdandAGENTS.mdupdatedin-PR (S1 now in progress;
src/ocpp/added to the tree).Scope boundaries
Detection types (
Failure/FailureCode/FailureSeverity),SessionSummary,and scenario/assertion types are intentionally deferred to the milestone that
produces them (detection is S2). S1 defines only the parse → normalize →
correlate model.
Testing
native test -Dplatform=null→ 8/8 pass (4 new engine-type tests:enum encodings, and a parsed-message-through-
Eventend-to-end model test).native check --strict→ clean.zig fmt --check→ clean.std— nonative_sdk/runner(verified pure).Closes #11