Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/scenarios-package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@ocpp-debugkit/scenarios': minor
---

Create scenarios package with 5 initial scenarios.

- Scenario registry with `getScenario()` lookup
- 5 scenarios: normal-session, failed-auth, connector-fault,
station-offline, unexpected-stop-reason
- Each scenario's expectedFailures aligns with v0.1 detection rules
- 21 tests (registry, engine integration, synthetic data policy)
22 changes: 18 additions & 4 deletions CURRENT_STATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,34 @@ report exported. CLI and web inspector.
- ✅ `packages/core/src/validator.ts` — `validateMessage()` / `validateMessages()` checking OCPP 1.6 JSON structural compliance
- ✅ 40 additional tests (10 timeline + 11 detection + 5 summarizer + 14 validator)

### Core Package — Public API Export + Package Config (in progress — this PR)
### Core Package — Public API Export + Package Config (PR #35)

- ✅ Barrel export complete (types, schemas, parser, normalizer, timeline, detection, summarizer, validator, fixtures)
- ✅ `sideEffects: false` for tree-shaking
- ✅ `files` field limits published content to `dist/` + docs
- ✅ `keywords`, `repository`, `homepage`, `bugs` fields for npm discoverability
- ✅ Package is npm-publish-ready (`access: public`)

### CI Fixes (PR #36, #37)

- ✅ Bumped `actions/checkout` and `actions/setup-node` to v5 (Node.js 20 deprecation)
- ✅ Pinned `changesets/action` to `v1.9.0`
- ✅ Fixed root `changeset` script: `"changeset add"` → `"changeset"` (was causing release workflow failures)

### Scenarios Package (in progress — this PR)

- ✅ `packages/scenarios/` — new package
- ✅ 5 scenarios: normal-session, failed-auth, connector-fault, station-offline, unexpected-stop-reason
- ✅ Scenario registry with `getScenario()` lookup
- ✅ Each scenario's `expectedFailures` aligns with v0.1 detection rules
- ✅ 21 tests (registry, engine integration, synthetic data policy)

## What's Next

1. **Issue #20** → complete (PR #33): data model + parser + normalizer
2. **Issue #21** → complete (PR #34): timeline + detection + summarizer + validator
3. **Issue #22** (this PR) → complete: public API export + package config
4. **Issue #23**: Scenarios package (format + 5 initial scenarios)
3. **Issue #22** → complete (PR #35): public API export + package config
4. **Issue #23** (this PR) → complete: scenarios package (format + 5 initial scenarios)
5. **Issue #24**: Reporter package (Markdown report generator)
6. **Issue #25**: CLI package (scaffold + inspect + report + scenario commands)

Expand All @@ -103,7 +117,7 @@ report exported. CLI and web inspector.
| Package | Status | Version |
|---------|--------|---------|
| `@ocpp-debugkit/core` | in progress (package config finalized, ready for downstream) | 0.0.0 |
| `@ocpp-debugkit/scenarios` | not started | — |
| `@ocpp-debugkit/scenarios` | in progress (5 scenarios + registry) | 0.0.0 |
| `@ocpp-debugkit/reporter` | not started | — |
| `@ocpp-debugkit/cli` | not started | — |
| `@ocpp-debugkit/replay` | not started | — |
Expand Down
55 changes: 55 additions & 0 deletions packages/scenarios/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "@ocpp-debugkit/scenarios",
"version": "0.0.0",
"description": "Predefined OCPP trace scenarios for testing the DebugKit analysis engine.",
"license": "Apache-2.0",
"type": "module",
"sideEffects": false,
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"files": [
"dist",
"README.md",
"NOTICE"
],
"keywords": [
"ocpp",
"ocpp1.6",
"ev-charging",
"scenarios",
"test-fixtures",
"trace"
],
"repository": {
"type": "git",
"url": "https://github.com/ocpp-debugkit/ocpp-debugkit.git",
"directory": "packages/scenarios"
},
"homepage": "https://github.com/ocpp-debugkit/ocpp-debugkit/tree/main/packages/scenarios",
"bugs": {
"url": "https://github.com/ocpp-debugkit/ocpp-debugkit/issues"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"clean": "rm -rf dist .turbo"
},
"dependencies": {
"@ocpp-debugkit/core": "workspace:*"
},
"devDependencies": {
"typescript": "^5.7.0",
"vitest": "^3.0.0"
},
"publishConfig": {
"access": "public"
}
}
167 changes: 167 additions & 0 deletions packages/scenarios/src/__scenarios__/station-offline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{
"name": "station-offline",
"description": "Station goes offline during active session: transaction starts but no StopTransaction follows. Expects STATION_OFFLINE_DURING_SESSION failure.",
"trace": {
"traceId": "scenario-station-offline",
"metadata": {
"stationId": "CS-SYNTHETIC-004",
"ocppVersion": "1.6",
"source": "synthetic-scenario",
"description": "Station offline during active session — StartTransaction with no StopTransaction."
},
"events": [
{
"timestamp": "2024-01-15T14:00:00.000Z",
"direction": "CS_TO_CSMS",
"message": [
2,
"msg-001",
"BootNotification",
{
"chargePointVendor": "SyntheticVendor",
"chargePointModel": "SM-100",
"chargePointSerialNumber": "CS-SYNTHETIC-004",
"firmwareVersion": "1.0.0"
}
]
},
{
"timestamp": "2024-01-15T14:00:00.500Z",
"direction": "CSMS_TO_CS",
"message": [
3,
"msg-001",
{
"currentTime": "2024-01-15T14:00:00.500Z",
"interval": 300,
"status": "Accepted"
}
]
},
{
"timestamp": "2024-01-15T14:01:00.000Z",
"direction": "CS_TO_CSMS",
"message": [
2,
"msg-002",
"StatusNotification",
{
"connectorId": 0,
"status": "Available",
"errorCode": "NoError"
}
]
},
{
"timestamp": "2024-01-15T14:01:00.500Z",
"direction": "CSMS_TO_CS",
"message": [3, "msg-002", {}]
},
{
"timestamp": "2024-01-15T14:02:00.000Z",
"direction": "CS_TO_CSMS",
"message": [
2,
"msg-003",
"Authorize",
{
"idTag": "SYNTHETIC-TAG-004"
}
]
},
{
"timestamp": "2024-01-15T14:02:00.500Z",
"direction": "CSMS_TO_CS",
"message": [
3,
"msg-003",
{
"idTagInfo": {
"status": "Accepted",
"expiryDate": "2024-12-31T23:59:59.000Z"
}
}
]
},
{
"timestamp": "2024-01-15T14:02:30.000Z",
"direction": "CS_TO_CSMS",
"message": [
2,
"msg-004",
"StartTransaction",
{
"connectorId": 1,
"idTag": "SYNTHETIC-TAG-004",
"meterStart": 0,
"timestamp": "2024-01-15T14:02:30.000Z"
}
]
},
{
"timestamp": "2024-01-15T14:02:30.500Z",
"direction": "CSMS_TO_CS",
"message": [
3,
"msg-004",
{
"transactionId": 100004,
"idTagInfo": {
"status": "Accepted"
}
}
]
},
{
"timestamp": "2024-01-15T14:02:31.000Z",
"direction": "CS_TO_CSMS",
"message": [
2,
"msg-005",
"StatusNotification",
{
"connectorId": 1,
"status": "Charging",
"errorCode": "NoError"
}
]
},
{
"timestamp": "2024-01-15T14:02:31.500Z",
"direction": "CSMS_TO_CS",
"message": [3, "msg-005", {}]
},
{
"timestamp": "2024-01-15T14:15:00.000Z",
"direction": "CS_TO_CSMS",
"message": [
2,
"msg-006",
"MeterValues",
{
"connectorId": 1,
"transactionId": 100004,
"meterValue": [
{
"timestamp": "2024-01-15T14:15:00.000Z",
"sampledValue": [
{
"value": "2000",
"measurand": "Energy.Active.Import.Register",
"unit": "Wh"
}
]
}
]
}
]
},
{
"timestamp": "2024-01-15T14:15:00.500Z",
"direction": "CSMS_TO_CS",
"message": [3, "msg-006", {}]
}
]
},
"expectedFailures": ["STATION_OFFLINE_DURING_SESSION"]
}
Loading
Loading