mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-31 08:27:38 +00:00
Marshalling 2's wagon list was computed from intercityOnBoardView's CURRENT state (boardYardId == null || hasLoaded), which can't tell 'coupled at THIS stop' from 'coupled at a LATER stop that has, by generation time, also already happened' — both read LOADED once the trip has moved on. Reprinting Marshalling 2 (Dire Dawa) after Marshalling 3's stop (Adama) had already run leaked Adama's 5 coupled wagons into Dire Dawa's document (54 wagons became 59), reproduced live on S-2026-00073. marshallingDocumentAt now corrects the on-board list against the adjustment log: a leg-slot wagon belongs on a stop's document only if it has a logged ADD at or before that stop's own timestamp. Extracted as wagonsAsOfStop so it's unit-testable without mocking the DB. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>