Claims surface failure reasons in status rather than HTTP errors#28
Open
scotwells wants to merge 1 commit into
Open
Claims surface failure reasons in status rather than HTTP errors#28scotwells wants to merge 1 commit into
scotwells wants to merge 1 commit into
Conversation
…or async allocation When a claim cannot be satisfied (pool exhausted, no matching pool, prefix length out of bounds), the claim is now persisted with an Allocated=False condition rather than returning a transport-level error. Callers can observe the failure reason from status.conditions without special error handling. This prepares the service for federated edge deployments where allocation happens asynchronously via a reconciler rather than synchronously in the request path — both models converge on the same final resource state. E2e tests updated to assert on final resource state (status conditions and capacity fields) rather than HTTP response codes, making the suite runnable against both the current hub implementation and future edge deployments. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 does
When a claim can't be satisfied — because a pool is full, no pool matches a selector, or the requested size exceeds the pool's limits — the claim is now saved with a clear failure reason in its status rather than being rejected outright.
Before this change, a failed claim attempt left no record: the request was rejected and the caller had to interpret the error message to understand why. Now the claim object exists and its status tells the full story:
Callers can check
status.conditionsto see whether their claim succeeded or failed and why, without any special error handling.Why it matters
This change is foundational for the federated edge model described in #27. In that model, allocations happen asynchronously on edge clusters via a reconciler rather than synchronously at request time. Both paths now converge on the same outcome: a claim object with a status condition that reflects what happened.
The test suite has been updated to match — tests now assert on final claim state rather than on whether the HTTP request succeeded or failed. This means the same tests run against both the current implementation and future edge deployments.
Test plan
Allocated=Falseclaims with typed reason codesAllocated=TruewithallocatedCIDRset synchronously in the response🤖 Generated with Claude Code