Skip to content

fix(binary): decide the stale-series retry from the problem document - #131

Closed
JosteinGj wants to merge 2 commits into
mainfrom
fix/binary-stale-series-problem
Closed

JosteinGj wants to merge 2 commits into
mainfrom
fix/binary-stale-series-problem

Conversation

@JosteinGj

Copy link
Copy Markdown
Contributor

Builds on #130 — main does not compile without it, so this branch carries that commit too. Once #130 merges, the diff here shrinks to the one commit.

insert_datapoints_binary retries once, after re-resolving, when the server says a cached series is gone or renamed. is_stale_series_rejection decided that by searching the raw body for "unknown-timeseries" / "external-id-mismatch", the idiom from before ResponseError::problem() existed (the branch predates #128).

That had a real false positive: the SDK's own client-side 404 — Could not find following timeseries: <ids> — names the series it could not resolve, so an external id spelling one of those tokens earned a pointless second attempt.

Change

It now reads the problem document. The api answers every binary refusal with one type, https://intellistream.ai/errors/datapoint-block-rejected, and carries the cause in a reason extension — so unlike every other endpoint, problem_slug() alone does not discriminate. The check is type and reason, which is also what datahub-sdk-docs' binary-datapoints.md already documents. README and AGENTS.md say so too; AGENTS.md also drops a stale "not in the Python bindings yet", which #123 made untrue.

Tests

  • Unit (binary::tests::only_a_stale_series_problem_rebuilds_the_request): both stale reasons retry; value-type-mismatch, unknown-timeseries under a foreign type, and the SDK-raised 404 above do not.
  • Live (test_insert_datapoints_binary_re_resolves_a_recreated_series): the retry had no live coverage, because the SDK resolves series before sending. This deletes and recreates a series under the same external id, so the server refuses the cached id with a real unknown-timeseries problem and the call must still answer 204. Mutation-checked: with unknown-timeseries removed from the match it fails on the server's 404.

🤖 Generated with Claude Code

JosteinGj and others added 2 commits September 17, 2026 09:41
#123 was branched before #128 gave ResponseError a content_type field
and merged after it, so main stopped compiling at the three places the
binary path builds one. All three are raised by the SDK with no server
response behind them (a 204 that fails to deserialize, a value refused
locally, a series /byids cannot find), so each carries None.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: jgjesdal <jostein@intellistream.ai>
is_stale_series_rejection searched the raw body for "unknown-timeseries"
or "external-id-mismatch", the idiom from before ResponseError::problem()
existed. That also matched the SDK's own client-side 404, which names the
series it could not resolve, so an external id spelling one of those
tokens earned a pointless second attempt.

It now reads the problem: the api answers every binary refusal with the
one type datapoint-block-rejected and puts the cause in a `reason`
extension, so the slug alone does not discriminate here the way it does
on every other endpoint. README and AGENTS.md say so, and AGENTS.md
drops a stale "not in the Python bindings yet" — #123 added them.

The retry had no live coverage because the SDK resolves every series
before sending. test_insert_datapoints_binary_re_resolves_a_recreated_series
deletes and recreates a series under the same external id, so the server
refuses the cached id; it fails if unknown-timeseries stops matching.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: jgjesdal <jostein@intellistream.ai>
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.

1 participant