feat(core): session timeline + failure detection + summarizer + validator - #34
Merged
Merged
Conversation
…ator - buildSessionTimeline() correlates events into sessions by transactionId (ADR-0006) - detectFailures() implements 3 rules: FAILED_AUTHORIZATION, CONNECTOR_FAULT, STATION_OFFLINE_DURING_SESSION - summarizeSession()/summarizeSessions() produce overview statistics - validateMessage()/validateMessages() check OCPP 1.6 JSON structural compliance - 40 new unit tests (10 timeline + 11 detection + 5 summarizer + 14 validator) Closes #21
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 session timeline builder, three failure detection rules, session summarizer, and OCPP message validator.
Closes #21
Changes
New files
packages/core/src/timeline.ts—buildSessionTimeline()correlating events bytransactionId(ADR-0006), withconnectorIdandstationIdas secondary groupingspackages/core/src/detection.ts—detectFailures()implementing 3 rules:FAILED_AUTHORIZATION— Authorize response withidTagInfo.status = "Invalid"CONNECTOR_FAULT— StatusNotification withstatus = "Faulted"during active sessionSTATION_OFFLINE_DURING_SESSION— session has StartTransaction but no StopTransaction, or connector transitions to Unavailable/Offline during active transactionpackages/core/src/summarizer.ts—summarizeSession()/summarizeSessions()producing overview stats (event count, duration, failure count, action sequence)packages/core/src/validator.ts—validateMessage()/validateMessages()checking OCPP 1.6 JSON message structure complianceUpdated files
packages/core/src/index.ts— barrel exports for all new modulesCURRENT_STATE.md— updated to reflect v0.1.0 progressTest Coverage
Verification
pnpm lint— ✅pnpm typecheck— ✅pnpm test— ✅ (147 tests, all passing)pnpm build— ✅pnpm format:check— ✅