Skip to content

test(python): follow the api's unit catalogue check on timeseries create - #169

Merged
olavgg merged 1 commit into
mainfrom
fix/timeseries-unit-external-id-catalogue
Sep 30, 2026
Merged

olavgg merged 1 commit into
mainfrom
fix/timeseries-unit-external-id-catalogue

Conversation

@JosteinGj

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #166. I wrote that PR from probes against an api that predated platform e93271c8 and 9a8b931a. On current platform main, a unitExternalId, when sent, must name a unit in the catalogue, and it is looked up before the rest of the body is validated. test_timeseries_rejections.py now pins that:

  • Stands in for unit. unit_external_id="pressure_bar" alone is created, with unit filled from the catalogue ("bar"). test(python): pin what timeseries.create refuses #166 pinned the opposite.
  • Refused when blank, short or unknown. "", " ", "ab" and "no_such_unit_xyz" are each a 400 of type bad-request naming only unitExternalId. Before, the first and third were constraint-violations from the size check, and the second and fourth were accepted.
  • Reported first. A bad unitExternalId is reported alone even when other fields are wrong too, because the lookup throws before validation. The several-bad-fields test now uses external_id for its third bad field.
  • Disagreement kept. A unit that disagrees with the id (Celsius on pressure_bar) is stored as sent, as the platform commit says.
  • The error-reading helper takes the expected problem type, and tolerates field entries without a code, which bad-request omits.

With this, #166's "things the api accepts" list reduces to the disagreeing unit, which is intended.

No SDK surface changes, so no docs pages are affected.

Test plan

🤖 Generated with Claude Code

A sent unitExternalId now has to name a catalogue unit, and is looked up
before the body is validated (platform 9a8b931a, e93271c8). So a valid id
stands in for unit, which is filled from the catalogue; a blank, short or
unknown one is a bad-request naming only unitExternalId, even when other
fields are wrong too; and a unit that disagrees with the id is kept.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: jgjesdal <jostein@intellistream.ai>
@JosteinGj
JosteinGj requested a review from olavgg September 30, 2026 08:13
@olavgg
olavgg merged commit ef6336b into main Sep 30, 2026
18 checks passed
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