Skip to content

Fix Distro day-ahead submissions rejected with 400 - #106

Merged
denniskuijs merged 7 commits into
mainfrom
fix/distro-dayahead-payload
Sep 28, 2026
Merged

denniskuijs merged 7 commits into
mainfrom
fix/distro-dayahead-payload

Conversation

@Miggets7

Copy link
Copy Markdown
Contributor

Distro rejected every day-ahead submission with a 400. The payload did not match their API spec: the order array was sent as submissionData instead of data, creationTimestamp was in milliseconds instead of seconds, days up to 14 ahead were posted where the API allows five, and volumes were not rounded to 0.01.

Volumes were also wrong in value. We sent average kW per quarter-hour, and the API expects kWh, so every order was four times too large. The sign was inverted as well, since import is a buy and Distro signs buys negative.

The base URL now includes /api/v1, and the submission is logged before posting. Details per change are in the commits.

The day-ahead endpoint lives under /api/v1 on the Distro host, so the
default base URL without it hit the wrong path.
Log the day, interval count and creationTimestamp at FINE, and the full
JSON payload at FINEST, so a rejected request can be compared against
the API spec.
The API rejected every submission with a 400:

- The order array was serialised as submissionData; the API requires
  it as data.
- creationTimestamp was sent in epoch milliseconds; the API expects
  seconds and must not be in the future.
- Days up to 14 ahead were submitted; the API accepts at most five days
  after today. The window is now the API limit rather than a defensive
  ceiling, so reaching it is no longer a warning.
- Volumes carried full double precision; the API only accepts
  multiples of 0.01.
The forecast is the average net power in kW over each quarter-hour,
but the API expects the energy in kWh, so every volume was four times
too large. The sign was also inverted: positive powerNet is import,
which is a buy, and the API signs buys negative.

The fill tests keep reasoning in forecast kW through a volume() helper;
a separate test pins the conversion itself.
@Miggets7 Miggets7 added the Bug Error or issue in the system label Sep 24, 2026
@Miggets7
Miggets7 requested a review from wborn September 24, 2026 19:24
@Miggets7
Miggets7 requested a review from igorrutka September 25, 2026 09:56
@denniskuijs denniskuijs self-assigned this Sep 28, 2026
@denniskuijs
denniskuijs added this pull request to the merge queue Sep 28, 2026
Merged via the queue into main with commit b1be6ab Sep 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Error or issue in the system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants