Skip to content

FakeService: Match the real service on update field mask paths - #335

Draft
Marenz wants to merge 5 commits into
frequenz-floss:v1.x.xfrom
Marenz:fix/fake-service-update-mask-and-end-criteria-test
Draft

Marenz wants to merge 5 commits into
frequenz-floss:v1.x.xfrom
Marenz:fix/fake-service-update-mask-and-end-criteria-test

Conversation

@Marenz

@Marenz Marenz commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

FakeService silently ignored unknown update-mask paths and crashed with an IndexError on a bare recurrence path. The real service rejects the former and accepts the latter, so tests could pass against updates that fail in production.

Also adds the missing round-trip coverage for an EndCriteria with neither count nor until set, and fixes the update() docstring. RELEASE_NOTES.md was still the released v1.1.0 text, so it is reset first.

v1.1.0 was released from the previous contents; start a clean file for the
next version.

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Both match statements over the update mask silently ignored unrecognized
paths. The real service rejects them instead: `generate_update_model`
returns `Invalid fields in update_mask` when a path went unhandled, and
`partial_recurrence_update` returns `Invalid recurrence path: {path}`.

That divergence let a test pass against an update that would fail in
production, which is the opposite of what a test double is for. Raise
`INVALID_ARGUMENT` with the same messages, and drop the comments claiming
the silent ignoring was intentional.

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
The handler for the "recurrence" path went straight to `split_path[1]`, so a
bare "recurrence" path raised an `IndexError`. The real service accepts it
to replace the whole recurrence rule (`generate_update_model` handles it
separately from the "recurrence.<field>" paths), so do the same.

`RecurrenceRuleUpdate` is a distinct message from `RecurrenceRule`, so the
fields are copied one by one. `end_criteria` is cleared rather than copied
when unset, as copying it would leave it present but empty, which reads
back as an end criteria with no count and no end time.

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
`EndCriteria.from_protobuf` handles an unset `count_or_until` oneof, but no
test exercised it: the round-trip loop only covered the `count` and
`until_time` cases.

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
`update()` raises `ValueError` for any key that is not an updatable field,
not only for `type` and `dry_run`. Also fixes a "preceeded" typo.

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
@github-actions github-actions Bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:test-utils Affects the test utilities part:dispatcher labels Sep 18, 2026

This branch has not been deployed

No deployments
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:test-utils Affects the test utilities part:tests Affects the unit, integration and performance (benchmarks) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant