Skip to content

Drain Mobilithek delta buffers and apply charging status packets in order - #30

Merged
pjeweb merged 1 commit into
mainfrom
fix/mobilithek-delta-drain
Oct 30, 2026
Merged

pjeweb merged 1 commit into
mainfrom
fix/mobilithek-delta-drain

Conversation

@pjeweb

@pjeweb pjeweb commented Oct 30, 2026

Copy link
Copy Markdown
Member

Mobilithek's delta pull returns the next buffered packet after If-Modified-Since. A consumer fetching one response per minute falls progressively behind a feed delivering multiple packets per minute; the daily snapshot then makes most charging points appear frozen at its publication time.

Add PulpMobilithek::drainMobilithek() to bootstrap from the buffered snapshot and drain up to 200 ordered packets until 304/204. A final ETag-deduplicated head probe mitigates same-second collisions without advancing the sequential cursor or skipping an unfinished backlog. HTTP errors and invalid/non-advancing cursors fail the run.

Apply status packets individually, recognize full packets through DATEX codedExchangeProtocol even when Type is empty, and reject older point timestamps. Commit the accumulator cache atomically only after a successful source run, preserving permissions; expose accumulatorVersion=2 for consumer migrations. Document the remaining historical same-second pull limitation and durable push reception.

Validation: all 217 PHPUnit tests pass on PHP 8.5 (839 assertions), including new drain/accumulator integration, snapshot-in-stream, cursor safety, failed-run rollback, and file permissions. Used the existing dependency installation with worktree source autoload overrides because a fresh dependency installation exceeded the /tmp quota; no dependency lock changes. PHP CS Fixer and git diff --check pass.

Proposed releases after merge: pulp-mobilithek 1.1.0 and pulp-datex-energy 1.1.2. Braunschweig adoption remains a draft until those packages are released and its Composer lock is refreshed. No production changes.

Protocol reference: Mobilithek TSSB, sections 4.3, 4.7.2 and 4.8.

@pjeweb
pjeweb merged commit 6cf25cb into main Oct 30, 2026
7 checks passed
@pjeweb
pjeweb deleted the fix/mobilithek-delta-drain branch October 30, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant