fix: propagate JSON decode errors in TestCallback_sessionsWithoutRefreshCookieName_returns500#154
Merged
Merged
Conversation
…outRefreshCookieName_returns500 Agent-Logs-Url: https://github.com/amalgamated-tools/goauth/sessions/87e2e101-4355-478e-ac12-7c2dc83f1903 Co-authored-by: veverkap <22348+veverkap@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
veverkap
April 28, 2026 18:03
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Improves reliability of the OIDC callback config-validation test by surfacing JSON decode failures instead of silently ignoring them, aligning the test suite with the broader goal of eliminating hidden json.Decode failures.
Changes:
- Replace ignored
json.NewDecoder(...).Decode(...)error withrequire.NoError(...)in the affected test.
Show a summary per file
| File | Description |
|---|---|
handler/oidc_test.go |
Ensures JSON decode errors fail the test immediately for clearer failures in the OIDC callback test. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
Address remaining silently-discarded json.Decode error in auth/middleware_test.go that was missed in the previous fix.
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.
The last of 28 silently-discarded
json.Decodeerrors in the test suite — a failed decode leavesbodyas a zero-value map, sobody["error"]returns""andrequire.Contains(t, "", "configuration")fails with a misleading assertion message instead of surfacing the actual decode failure.Change
handler/oidc_test.go: replace_ = json.NewDecoder(w.Body).Decode(&body)withrequire.NoError(t, ...)so decode failures are immediately surfaced.Greptile Summary
This PR fixes two test functions —
TestCallback_sessionsWithoutRefreshCookieName_returns500andTestMiddleware_invalidToken— where JSON decode errors were silently discarded, causing misleading assertion failures on a zero-value map rather than surfacing the root decode failure. Both changes swap_ = json.NewDecoder(...).Decode(&body)forrequire.NoError(t, ...), which is correct and consistent with the broader cleanup described in the PR.Confidence Score: 5/5
Safe to merge — test-only change with no impact on production code paths
Both changes are mechanically correct, test-only, and improve diagnostic clarity. No production code is touched, and no logic is altered beyond surfacing previously hidden errors.
No files require special attention
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Test makes HTTP request] --> B[Record response via httptest.ResponseRecorder] B --> C{json.NewDecoder.Decode} C -- Before: discard error --> D[Error silently dropped] D --> E[body is zero-value map] E --> F[body error is empty string] F --> G[require.Contains fails with misleading message] C -- After: require.NoError --> H[Decode error surfaces immediately] H --> I[body populated correctly] I --> J[require.Contains passes or fails clearly]Reviews (2): Last reviewed commit: "fix: use require.NoError for JSON decode..." | Re-trigger Greptile