feat(core): data model + trace parser + event normalizer - #33
Merged
Conversation
- parseTrace() accepts JSON Object, JSONL, and bare array trace formats - normalizeEvents() classifies message types, infers directions (ADR-0004), and normalizes timestamps to epoch milliseconds (ADR-0005) - Zod schemas validate all untrusted input, preventing prototype pollution - Input size limit (10 MB) and event count limit (10,000) enforced - Malformed individual events are skipped with ParseWarning (ADR-0007) - Added Failure, Scenario, SessionSummary, ValidationResult types - 78 new unit tests (46 normalizer + 32 parser) Closes #20
sepehr-safari
added a commit
that referenced
this pull request
Jul 8, 2026
…subpath exports (#55) * feat(toolkit): consolidate packages into @ocpp-debugkit/toolkit with subpath exports - Create packages/toolkit/ with single @ocpp-debugkit/toolkit package - Move core, scenarios, reporter, CLI code into src/ internal modules - Add src/replay/ and src/react/ stub modules - Configure subpath exports: /core, /scenarios, /reporter, /replay, /react, /cli, /fixtures - Configure ESM build with TypeScript declarations, tree-shaking (sideEffects: false) - CLI binary ocpp-debugkit via package.json#bin - Update web app to consume @ocpp-debugkit/toolkit - Delete old package directories (core, scenarios, reporter, cli) - All 196 existing tests pass from new locations - Update AGENTS.md and CURRENT_STATE.md - Add changeset (minor bump) Closes #54 * chore: remove changeset from consolidation PR - will add at release time The changeset with a minor bump would trigger auto-publish of @ocpp-debugkit/toolkit when PR #55 merges via the release workflow. We don't want to publish until all v0.2.0 work is complete. The changeset will be added as part of the release issue (#33).
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.
Summary
Implements the core data model with Zod schemas, the
parseTrace()function accepting JSON Object / JSONL / bare array formats, andnormalizeEvents()that classifies message types, directions, and timestamps.Closes #20
Changes
New files
packages/core/src/schemas.ts— Zod schemas forTrace,TraceEventInput,TraceMetadata,RawOcppMessage(prototype pollution protection)packages/core/src/normalizer.ts—normalizeEvents(), direction inference (ADR-0004), timestamp normalization (ADR-0005)packages/core/src/parser.ts—parseTrace()accepting JSON Object, JSONL, and bare arraypackages/core/src/normalizer.test.ts— 46 testspackages/core/src/parser.test.ts— 32 testsUpdated files
packages/core/src/types.ts— addedFailure,FailureCode,FailureSeverity,Scenario,SessionSummary,ValidationResulttypespackages/core/src/index.ts— updated barrel exportspackages/core/package.json— addedzoddependencyCURRENT_STATE.md— updated to reflect v0.1.0 milestone progressSecurity Checklist
eval(),Function(), or dynamic code execution on untrusted inputconsole.logof sensitive data in production paths.envfiles gitignoredVerification
pnpm lint— ✅pnpm typecheck— ✅pnpm test— ✅ (107 tests, all passing)pnpm build— ✅pnpm format:check— ✅