fix: Report the real error when the flag push request cannot be built - #71
Merged
Conversation
keelerm84
added a commit
that referenced
this pull request
Aug 31, 2026
The retry loop kept the fixed string this site used before, which discards what http.NewRequest said about the URI. #71 replaces that same string on main, and this branch rewrote the surrounding block, so a merge would have put the two in conflict with the fixed string as one of the candidate resolutions. Carrying the change here instead makes the merge order stop mattering: both sides now agree, so nothing is left for a resolution to drop.
jsonbailey
approved these changes
Aug 31, 2026
featureLoop builds its push request from a URI assembled at run time, so construction can fail on a malformed SALESFORCE_URL. It answered that with a fixed string of its own -- misspelled as "Failed constructiong flag push request" -- and discarded the error http.NewRequest produced, which for a malformed URL is the only thing worth knowing. The loop's poll already returns the underlying error, so the push now agrees with it. The log line stays alongside the return, and that is deliberate rather than redundant. run() reads one error from each loop and returns only the first to arrive, so an error from this site reaches the operator only when featureLoop wins that race. Measured with a malformed SALESFORCE_URL and a 200ms flag poll latency, eventLoop won 40 of 40 and the parse error appeared nowhere at all. A comment records this so the line is not removed again on the reasoning that the return already carries it. Also fixes the neighbouring log line, which read "failed pushings flags to salesforce". That one prints a client.Do error, which net/http redacts, so its content is unchanged. eventLoop's push had the same defect. That half landed with the event push retry work, which rewrote the surrounding block, so only featureLoop remains here. The test covering eventLoop is kept: it now guards the version of that code which arrived by the other route. A test per loop. A control character is what url.Parse refuses, which is how each forces the failure, and each asserts the failure is reached before asserting anything about it, so a future stdlib that accepts these URLs fails loudly rather than passing vacuously. Verified discriminating against the fixed strings, and against a same-base error with a different suffix -- the assertion pins which URI is named, not just that an error occurred.
keelerm84
force-pushed
the
mk/SDK-2822/push-request-errors
branch
from
August 31, 2026 18:38
eef15a2 to
2c3239f
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.
Summary
featureLoopbuilds its push request from a URI assembled at run time, so construction canfail on a malformed
SALESFORCE_URL. It answered that failure with a fixed string of itsown -- misspelled as
Failed constructiong flag push request-- and discarded the errorhttp.NewRequestproduced, which for a malformed URL is the only thing worth knowing. Theloop's poll already returns the underlying error, so the push now agrees with it.
The log line stays alongside the return, deliberately.
run()reads one error from eachloop and returns only the first to arrive, so an error from this site reaches the operator
only when
featureLoopwins that race. Measured with a malformedSALESFORCE_URLand a200ms flag poll latency,
eventLoopwon 40 of 40 runs and the parse error appeared nowhereat all. A comment records this, so the line is not removed again on the reasoning that the
return already carries it. (It was removed on exactly that reasoning in an earlier revision
of this PR, and a review caught it.)
Also fixes the neighbouring log line, which read
failed pushings flags to salesforce. Thatone prints a
client.Doerror, whichnet/httpredacts viastripPassword, so its contentis unchanged.
Scope reduced since the first review
eventLoop's push had the same defect, and that half has since landed with #69, whichrewrote the surrounding block. Only
featureLoopremains here.The test covering
eventLoopis kept rather than dropped: it now guards the version of thatcode which arrived by the other route, and it still passes.
Tests
A test per loop. A control character is what
url.Parserefuses, which is how each forcesthe failure, and each asserts the failure is reached before asserting anything about it --
so a future stdlib that accepts these URLs fails loudly rather than passing vacuously.
Verified discriminating three ways: against the original fixed strings; against a same-base
parse error with a different suffix, so the assertion pins which URI is named rather than
merely that an error occurred; and against mutating only the
returnwhile keeping the logline, which confirms the assertion is on the returned error rather than the log.
The expected text is derived from a live
http.NewRequestcall rather than hard-coded,because the two toolchains render a DEL byte differently in
%qoutput -- Go 1.15 uses theUnicode escape form and 1.26 uses the hex form, and CI pins 1.15. Green on both, and under
-race -count=20and-shuffle=on.Information disclosure
Returning
http.NewRequest's error means the raw URL reacheslog.Fatal, andurl.Parsedoes not redact userinfo the way
client.Dodoes. This was reviewed specifically and foundimmaterial: the variables whose parse failures can leak all pre-set
Authorization, souserinfo in them is discarded by Go and that configuration cannot work; the one variable
where userinfo is functional (
OAUTH_URI) has no reachable leak path; and the categoryalready exists on
mainindependent of this change. Nothing more sensitive than theconfigured URL can reach these errors -- the parse happens before the body is even
type-asserted, and every
Header.Setruns after construction succeeds.