errors/5 resource delete problem - #97
Merged
Merged
Conversation
JosteinGj
added this pull request to stack #99
September 15, 2026 09:17
olavgg
force-pushed
the
errors/5-resource-delete-problem
branch
from
September 15, 2026 13:26
bcde487 to
1ac4edc
Compare
JosteinGj
force-pushed
the
errors/5-resource-delete-problem
branch
from
September 16, 2026 07:40
1ac4edc to
8e675bb
Compare
JosteinGj
force-pushed
the
errors/5-resource-delete-problem
branch
from
September 16, 2026 07:50
8e675bb to
48e4ede
Compare
JosteinGj
marked this pull request as ready for review
September 16, 2026 07:51
olavgg
approved these changes
Sep 16, 2026
stack merge was automatically disabled
September 16, 2026 07:57
Pull Request is not mergeable
JosteinGj
force-pushed
the
errors/5-resource-delete-problem
branch
from
September 16, 2026 08:02
48e4ede to
8bf329f
Compare
JosteinGj
force-pushed
the
errors/5-resource-delete-problem
branch
from
September 16, 2026 08:11
8bf329f to
0af1de0
Compare
JosteinGj
force-pushed
the
errors/5-resource-delete-problem
branch
from
September 16, 2026 08:14
0af1de0 to
7460a09
Compare
…ailure
ResourceDeleteException was the last exception in the API still answering
in the ResponseError envelope. Seven controllers caught it and returned
the body it carried, so a client that had moved to problem+json for
everything else still had to special-case delete.
An eighth never caught it: POST /policies/delete reaches the same graph
guards through PolicyService.deletePolicies, so a refused policy delete
came back as a bare 500 naming nothing. That is what handling it in one
place fixes, rather than writing the missing catch.
The status moves 400 -> 409. Nothing is wrong with the request: it is
well-formed, the ids exist, and it will succeed verbatim once the
subscription is removed or the stranded nodes are included. That is a
conflict with the current state, and it puts a refused delete next to the
API's other 409s — a taken external id, a lost optimistic lock — which
are the same "retry once the world changes" answer. A 400 told clients to
fix a payload that was never the problem.
The exception now carries the facts instead of a rendered body: a type
URI (referenced / would-strand — the two guards want different things
from the caller), the detail, and the blockers. The blockers keep their
own `blockedBy` member rather than going through the field -> message
bridge, which would turn one subscription into four unrelated field
errors and lose the external id the caller needs to go and delete.
{"error":{"code":400,"message":"...","fields":[{"type":"subscription",...}]}}
becomes
{"type":"https://intellistream.ai/errors/referenced",
"title":"Delete refused","status":409,"detail":"...",
"blockedBy":[{"subscriptionId":"9","subscriptionExternalId":"sub_a",
"timeseriesId":"5"}]}
The OpenAPI moves with it. Seven delete endpoints now document a single
409 covering both the refusal and the optimistic-lock conflict, told
apart by `type`; /resources/delete and /timeseries/delete lose the 400
that described the refusal with a BadRequestError example.
EventController is the exception: EventService.delete is ClickHouse,
KVRocks and Pulsar only and never reaches the graph guards, so its catch
was dead code and its docs need no 409.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: jgjesdal <jostein@intellistream.ai>
JosteinGj
force-pushed
the
errors/5-resource-delete-problem
branch
from
September 16, 2026 08:24
7460a09 to
7fbbb56
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
How it was verified
Checklist
git commit -s), per CONTRIBUTING.md./gradlew buildpasses(see AGENTS.md for which of the two documentation sites it belongs in)