rpc: answer GetWorkload for a missing workload with codes.NotFound - #757
Merged
Merged
Conversation
Clients had to string-match the error text to tell a missing workload from a failure (agent's WorkloadExists). GetWorkload now returns the standard NotFound code when the error chain holds ErrWorkloadNotExists; other failures keep the per-RPC code. The ErrInvaildCount mark on the etcd not-found error added in #756 is dropped: nothing reads it (resource-extend's nodestore uses the raw etcd client and its own ErrNodeNotExists).
This was referenced Sep 29, 2026
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.
Follow-up to #756. This lets clients recognise a missing workload from the gRPC status instead of from the error text.
GetWorkload returns
codes.NotFoundtypes.ErrWorkloadNotExists,GetWorkloadnow answerscodes.NotFound. Every other failure keeps the per-RPC codeGetWorkload(1051).WorkloadExistshad to string-matchbad \Count` valueorworkload not existsin the status message. The companion agent PR switches it tostatus.Code(err) == codes.NotFound`.The
ErrInvaildCountmark from #756 is removedErrKeyNotFound.nodestore.CheckAbsentneeded the mark. That was wrong.nodestorereads through the raw etcd client and raises its ownErrNodeNotExistson zero matches, so it never sees core'sGetOneerrors.ErrInvaildCountfinds no other consumer of core's not-found error. The companion resource-extend PR also cleans up its side.Deploy order
workload not exists.Tests
TestGetWorkloadReportsAMissingWorkloadAsNotFoundchecks that a missing workload maps tocodes.NotFoundand that any other error keeps code 1051.ErrInvaildCount.Gates (
GOWORK=off)make fmt-checkpasses.make lintreports 0 issues on linux and darwin.aslis clean on linux and darwin.make testandmake buildpass.