eventhub/README_PATCH.md

61 lines
1.8 KiB
Markdown

# Patch: Reusable Esper runtime execution-state cleanup
## Purpose
Prevent retained Esper state from leaking between pipeline executions when `DriverWorkingTimeReusableProjectionBuilder` reuses a pooled runtime.
## Runtime lifecycle
A pooled runtime now follows this lifecycle:
```text
acquire runtime
-> clear execution state before sending events
-> execute the complete derived-projection module
-> detach result listeners
-> clear execution state again in finally
-> return only a clean runtime to the pool
```
If execution or cleanup fails, the runtime is marked unsafe and destroyed instead of being pooled.
## Resettable input retention
The statement-local usages of:
```epl
TachographVehicleUsageIntervalInputEvent#keepall
```
have been replaced with the public named window:
```epl
TachographVehicleUsageIntervalInputWindow#keepall
```
The window is populated from `TachographVehicleUsageIntervalInputEvent` and is part of the cleanup contract. This prevents odometer and vehicle-usage evidence from a previous execution from participating in a later execution.
The earlier `VuCardAbsentIntervalWindow` fix is retained.
## Cleanup contract
All public named windows in `driver-working-time-derived-projections.epl`, including the context-scoped `PreviousVehicleUsageInterval`, have corresponding fire-and-forget delete queries.
A regression test scans the EPL and fails when a newly introduced public named window is not added to the cleanup contract.
## Metrics
Runtime logging now reports separate values:
- `runtimeResetBeforeMs`
- `runtimeResetAfterMs`
## Tests
Added/retained tests for:
- identical results when a warm runtime is reused;
- no doubled card-absent coverage and coverage not exceeding 100%;
- no retained vehicle-usage/odometer evidence in the next execution;
- cleanup-query coverage for every public named window.