ESD-1676: Fix NAT gateway diagnostics poll treating in-progress 400 as fatal - #175
Open
Phil-Browne wants to merge 4 commits into
Open
ESD-1676: Fix NAT gateway diagnostics poll treating in-progress 400 as fatal#175Phil-Browne wants to merge 4 commits into
Phil-Browne wants to merge 4 commits into
Conversation
…s fatal
The async route-diagnostics operation endpoint reports "still processing"
with an HTTP 400 whose body is
{"message":"The polling result for async mode is not ready yet"} and
reports completion with a 200 carrying a data array that may legitimately
be empty. The poll treated the in-progress 400 as fatal and returned on
the first iteration, and treated an empty 200 as "still processing", the
reverse of the real contract.
Add IsDiagnosticsInProgressError (mirroring IsServiceNotFoundError) and
have pollDiagnosticsRoutes keep polling on that signal, return any other
error, and treat a 200 as the completed result including an empty slice.
Add poll-cadence override fields on the service (mirroring the MCR
looking-glass poll) so the transition is unit-tested deterministically.
Match the mcr_looking_glass sibling's per-field comment style.
…tion Cover the pollDoneErr caller-context path (returns context.Canceled, not the timeout sentinel) and assert the timeout test tolerated at least one in-progress poll.
Phil-Browne
requested review from
a team and
mp1-tomclancy
and removed request for
a team
July 21, 2026 22:58
The check matches a message substring on the non-standard 400 the NAT gateway routes operation endpoint returns while a result is not ready. There is no error code behind that signal, and other diagnostics endpoints report the same state differently, so it should not be public SDK surface. Renames IsDiagnosticsInProgressError to isNATGatewayDiagnosticsInProgress.
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.
While a NAT gateway route-diagnostics operation is still processing, the API returns an HTTP 400 with
{"message":"The polling result for async mode is not ready yet"}; completion is a 200 with adataarray that may legitimately be empty. The poll treated that in-progress 400 as fatal and bailed on the first iteration, and treated an empty 200 as "still processing" (the reverse of the real contract), so anything slower than the 2s initial delay failed.isNATGatewayDiagnosticsInProgresshelper to detect the in-progress 400. It stays unexported on purpose: the signal is a message substring with no error code behind it, and other diagnostics endpoints report the same state differently, so it should not become public SDK surface.pollDiagnosticsRoutesnow keeps polling on that signal, returns any other error unchanged, and treats a 200 as the completed result including an empty slice.Unit tests cover in-progress-then-complete, empty-complete, other-error-fatal, timeout, and caller-cancellation.
Contract verification
Verified against the megalith backend source (not just the SDK/spec):
DiagnosticsRoutesClientthrowsRoutesNotAvailableException("The polling result for async mode is not ready yet")on NetAuto statusPENDING/RUNNING; the v3 NAT gateway controller re-throws it, and the global handler maps any unannotatedRuntimeExceptionto HTTP 400 with that string in themessagefield. So the 400 + message match is the real contract.COMPLETEstatus returns a 200, and an empty route list is a successful empty result, not "still processing".message, noterrorCode/data(no errorCode is set on this path).What I could not verify
errorCodebehind it, and it is not in the OpenAPI spec (the endpoint documents only a 200 and a catch-all4XX). A future wording change would silently break the substring match; keying on a stableerrorCodewould be more robust if the backend ever exposes one.