Skip to content

fix: Raise ValueError for invalid start_time in create()#264

Merged
Marenz merged 2 commits intofrequenz-floss:v1.x.xfrom
Marenz:fix-create-invalid-start-time
Feb 27, 2026
Merged

fix: Raise ValueError for invalid start_time in create()#264
Marenz merged 2 commits intofrequenz-floss:v1.x.xfrom
Marenz:fix-create-invalid-start-time

Conversation

@Marenz
Copy link
Contributor

@Marenz Marenz commented Feb 23, 2026

Passing a non-datetime, non-"NOW" value to create(start_time=...) (e.g. a numpy.datetime64 from an ML TimeSeries index) previously bypassed the isinstance(start_time, datetime) check and silently produced a dispatch with an epoch timestamp (1970-01-01 00:00:00 UTC). It now raises ValueError immediately.

Discovered via frequenz-io/frequenz-actor-electricity-trading#570 — cc @cwasicki.

@Marenz Marenz requested review from a team as code owners February 23, 2026 13:24
@Marenz Marenz requested review from llucax and removed request for a team February 23, 2026 13:24
@github-actions github-actions bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:dispatcher labels Feb 23, 2026
Copy link

@cwasicki cwasicki left a comment

Choose a reason for hiding this comment

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

Some inconsistency in release notes, otherwise LGTM

RELEASE_NOTES.md Outdated
## Upgrading

<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
- `DispatchApiClient.__init__()`: The `key` parameter is now canonical. `auth_key` still works but emits a `DeprecationWarning`. Rename usages to `key=`.

Choose a reason for hiding this comment

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

Not part of this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, that slipped in, sorry

@Marenz Marenz force-pushed the fix-create-invalid-start-time branch from 8a72083 to 77a5f0b Compare February 23, 2026 13:34
@Marenz
Copy link
Contributor Author

Marenz commented Feb 23, 2026

Fixed — RELEASE_NOTES now only covers the start_time fix.

@Marenz Marenz force-pushed the fix-create-invalid-start-time branch from 77a5f0b to 30567fe Compare February 23, 2026 14:07
Passing a non-datetime, non-'NOW' value (e.g. numpy.datetime64) previously
silently produced a dispatch with an epoch timestamp (1970-01-01). It now
raises ValueError immediately, making the bug surface at the call site.

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
@Marenz Marenz force-pushed the fix-create-invalid-start-time branch from 30567fe to 1980a45 Compare February 23, 2026 14:08
Covers: non-datetime types (int, str, object), naive datetime, and
past datetime — all of which should raise ValueError.

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
@Marenz Marenz force-pushed the fix-create-invalid-start-time branch from 1980a45 to e0ae50d Compare February 23, 2026 15:09
@Marenz Marenz enabled auto-merge February 24, 2026 10:55
@Marenz Marenz added this pull request to the merge queue Feb 27, 2026
Merged via the queue into frequenz-floss:v1.x.x with commit 4132e6c Feb 27, 2026
6 checks passed
@Marenz Marenz deleted the fix-create-invalid-start-time branch February 27, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:dispatcher part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants