Skip to content

Backward-compatibilty for forecasting/ingestion endpoints, QA workflow works with older clients - #2432

Open
nhoening wants to merge 26 commits into
mainfrom
feat/ci/qa-workflow-works-with-older-clients
Open

Backward-compatibilty for forecasting/ingestion endpoints, QA workflow works with older clients#2432
nhoening wants to merge 26 commits into
mainfrom
feat/ci/qa-workflow-works-with-older-clients

Conversation

@nhoening

@nhoening nhoening commented Aug 21, 2026

Copy link
Copy Markdown
Member

Description

We want to ensure backward-compatibility with older clients also for forecasting and data ingestion endoints which went to the 202 route. Their function would still work as normal, but fm-clients expect not just 2xx but specifically 200 and could break flows on the client side.

This PR dos that, and also improves the ability to signal legancy clients on assets or per QA run, and works on the QA/Release workflow to let us test legacy clients there.

  • add beackwards-compatible responses also for forecasting and ingestion (basically let them respond with 200 as before, ingestion would also stop being asynchronous), so older clients can get the responses they expect.
  • The legacy clients are adhered to with the asset attribute we introduced in fix: keep legacy 200/400 codes for older clients in schedule-related endpoints #2429. It is now renamed to indicate its wider scope and it can also be forced from config withut altering assets (only to be used in QA)
  • skip steps that older versions are not be able to run, like the ingestion tutorial or HEMS script - or enable them in QA/Release workflow if possible.
  • installation of packaged clients works differently than from branches
  • our recent work on backwards-compatibility should be baked into the FM assets / config we run
  • Added changelog item in documentation/changelog.rst

Here is an overview over the features we are now testing with legacy clients:

Client Ingestion Forecasting Scheduling Reporting
main ✅ API: file + JSON + read-back ✅ API via HEMS ✅ API: trigger + retrieve via HEMS ⚠️ CLI only
v0.9.4 ✅ API: file + JSON + read-back ✅ API via HEMS ✅ API: trigger + retrieve via HEMS ⚠️ CLI only
v0.9.0 ✅ API: file + JSON + read-back ✅ API via HEMS¹ ✅ API: trigger + retrieve via HEMS¹ ⚠️ CLI only
v0.8.0 ✅ API: file + JSON + read-back 🚫 No client API² 🧪 API: trigger + retrieve via HEMS¹ ⚠️ CLI only²
v0.7.0 ✅ API: JSON + read-back³ 🚫 No client API ❌ Not covered⁴ 🚫 No client API
  • ✅ Client API compatibility is tested.
  • 🧪 Coverage is implemented; successful workflow run still needs confirmation.
  • ⚠️ Exercised through the server CLI, not through a client API.
  • ❌ Potentially supported, but not covered by this workflow.
  • 🚫 The relevant client API did not exist.
  1. Uses legacy job-response compatibility.
  2. Client has no forecasting and/or reporting support yet. HEMS exercises the server CLI, but this does not test a client API.
  3. Uses legacy post_measurements(); file ingestion is unavailable.
  4. v0.7.0 has no HEMS example, so scheduling is not exercised.

The server CLI tutorials run in every workflow, but they are not counted as client backward-compatibility coverage.

How to test

Run the QA/release workflow with this branch, and try various client versions or branches

I ran these fm-clients successfully:

Note: 0.7.0 has no HEMS script yet, as mentioned above.

Here is example output (from the Determine client QA capabilities):

=== Client QA plan ===
Requested client ref:              v0.8.0
Resolved client version:           0.8.0
Client source:                     PyPI release package
Data-ingestion tutorial:           true
HEMS example:                      true
Legacy job responses:              true
Legacy CLI wrapper:                true
v0.8.0 HEMS simulation shim:       true
Ingestion API support:             yes (file and JSON uploads)
Planned client ingestion:          API file and JSON uploads with read-back (tutorial)
Forecasting API support:           no
Planned client forecasting:        server CLI (HEMS; no client API)
Scheduling API support:            yes
Planned client scheduling:         API trigger and power/SoC retrieval (HEMS)
Reporting API support:             no (planned for FlexMeasures 1.1)
Planned client reporting:          server CLI (HEMS; no client API)
Server CLI tutorials 1-5:          run (not client-specific)
==============================

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@read-the-docs-community

read-the-docs-community Bot commented Aug 21, 2026

Copy link
Copy Markdown

@nhoening nhoening self-assigned this Aug 21, 2026
@nhoening nhoening added this to the 1.1.0 milestone Aug 21, 2026
…rsion as ENV variable (for HEMS script to pick up) and in the new backward-compatibility config setting

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…e, which the ingestion tutorial uses; add a config setting to assume a client version which the HEMS script uses

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@Flix6x Flix6x changed the title Feat/ci: QA orkflow works with older clients Feat/ci: QA workflow works with older clients Aug 22, 2026
@nhoening nhoening changed the title Feat/ci: QA workflow works with older clients Backward-compatibilty for forecasting/ingestion endpoints, QA workflow works with older clients Aug 24, 2026
Context:
- Release QA skipped the ingestion tutorial for clients older than v0.9.4 even though earlier clients expose compatible ingestion methods.

Change:
- Install pinned releases from PyPI, adapt v0.7 post_measurements calls, skip only its unsupported file upload, and configure legacy responses before ingestion.
Context:
- Client v0.7.0 exposes post_measurements while later clients expose post_sensor_data.

Change:
- Verify current methods remain untouched and legacy clients receive a working alias.
Move the v0.8.0 HEMS fixtures to the next calendar year so uploaded prices remain visible at the simulation prior, and permit its play-mode loop to replace overlapping measurements.

Fail QA when older HEMS scripts catch scheduling errors or do not confirm that power and SoC schedules were retrieved.
Use standard find and grep commands to locate v0.8.0 HEMS fixture dates because ripgrep is not available on every Actions runner.
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@nhoening nhoening modified the milestones: 1.1.0, 1.0.0 Aug 25, 2026
@nhoening
nhoening requested a review from BelhsanHmida August 25, 2026 22:09
The file-upload example moved into a conditional branch, which indented it by four more spaces.
Sphinx strips exactly as many characters as `dedent` names, so the rendered snippet kept a stray indent.

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
FLEXMEASURES_LEGACY_SCHEDULEACCEPTED_STATUS_MAX_INCOMPATIBLE_CLIENT_VERSION shipped in v1.0.0rc5.
Renaming it to FLEXMEASURES_LEGACY_JOB_RESPONSES_MAX_INCOMPATIBLE_CLIENT_VERSION left hosts that configured it without any signal, since unknown settings are not reported.
Those hosts would have started answering 202 to exactly the old clients the setting protects.
The former name is now read as a fallback, and logs a deprecation warning once per process asking for the rename.

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
The cutoff was 0.9.1, which is the v2g-liberty version from the setting's documented example, not a flexmeasures-client version.
Client 0.9.4 is the first which accepts any 2xx from a data upload, so 0.9.2 and 0.9.3 reject the 202 that a connected ingestion worker produces.
QA pointed at those two versions therefore ran without the compatibility config it was meant to exercise, and their ingestion failed.
This also brings the cutoff in line with the CLI wrapper gate a few lines below, which already keys off 0.9.4.

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
The failure check listed three exact phrases, and every released HEMS script reports a failed forecast as "Forecast job <id> failed for ...", which matches none of them.
Report failures were missed for the same reason.
A run could therefore stay green on a forecasting failure, since the only success assertion covered schedule retrieval.
Match any reported failure instead of named ones, because the wording differs per client release, and treat a missing CLI as fatal because that silently skips forecasting and reporting.
Also require forecasting to confirm itself, accepting both the server-CLI wording used up to 0.8.x and the client-API wording used since 0.9.0.

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>

@BelhsanHmida BelhsanHmida left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, @nhoening one question before I sign off.

The PR renames FLEXMEASURES_LEGACY_SCHEDULEACCEPTED_STATUS_MAX_INCOMPATIBLE_CLIENT_VERSION to FLEXMEASURES_LEGACY_JOB_RESPONSES_MAX_INCOMPATIBLE_CLIENT_VERSION. The old name shipped in rc5, tagged 20 Aug six days. FlexMeasures doesn't report unknown settings at startup, so anyone who configured the old name silently drops back to 202 responses on upgrade, for exactly the clients the setting protects.

I pushed 01c899b for that, which reads the old name as a fallback and logs a deprecation warning. I also have a revert ready locally, since six days in one rc may be thin grounds for carrying a deprecated alias into 1.0. Should I push the revert, or leave the fallback in? Comes down to whether any deployment actually set the old name during rc5.

@nhoening

Copy link
Copy Markdown
Member Author

Thanks @BelhsanHmida .
That is the one I also thought about.
I vote for the revert. The price of added code weighs heavier for me. And it was not an official release yet.

This reverts commit 01c899b.

The old setting name landed on main on 2026-08-20 and shipped in v1.0.0rc5, tagged the same day, so it existed under that name for six days in a single release candidate.
Carrying a deprecated alias out of that window into 1.0 would imply that configuration names are stable across release candidates, and would leave a removal obligation behind for a setting almost nobody can have configured.
It was not an official release, and the weight of the extra code outweighs the narrow protection it offers.

Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Context:
- flexmeasures-client v0.9.0 passes runner-absolute report config paths to the server-side CLI wrapper

Change:
- Map absolute HEMS config paths to the existing /hems-configs mount while preserving v0.8.0 relative-path handling
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.

2 participants