{{ message }}
Repository navigation
[bugfix] validate ServerChan notification response codes - #4472
Open
9184290-cpu wants to merge 1 commit into
Open
9184290-cpu wants to merge 1 commit into
9184290-cpu wants to merge 1 commit into
Conversation
Signed-off-by: Gumouer <2663769371@qq.com>
9184290-cpu
marked this pull request as ready for review
October 18, 2026 06:48
zqr10159
approved these changes
Oct 21, 2026
zqr10159
left a comment
Member
There was a problem hiding this comment.
Reviewed against master 6ca9022. Requiring an explicit code == 0 matches the configured sctapi.ftqq.com response contract. All 13 ServerChan tests passed locally, covering JSON conversion, nonzero/missing code, empty/malformed responses, HTTP errors and transport failures; Checkstyle passed. No live delivery was performed. Compatible custom endpoints must return the same explicit code contract. Code review passes; Backend CI and License Checker are action_required (awaiting maintainer approval to run), not failed tests. Please complete those checks before merging.
3 of 4 tasks
This branch has not been deployed
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's changed?
The ServerChan handler currently treats every HTTP 200 response as success, even when the response contains a nonzero business code or no success code. This lets a rejected or invalid response return without an
AlertNoticeException.Require a non-null response body and an explicit
code == 0before logging success. Report missing codes and nonzero codes through the existing exception path. The ServerChan FAQ documents nonzerocodeas an error.Correct the existing success fixture to use
code, and add regression tests using a realRestTemplatewithMockRestServiceServer. These exercise JSON conversion, positive/negative business errors, empty/null/missing-code responses, malformed JSON, HTTP errors and transport failures. The HTTP responses are synthetic fixtures, not observations from a live delivery.Only the ServerChan handler and its tests change; the shared response DTO and other channels are unchanged.
Validation
Windows, Zulu OpenJDK 25.0.4.1, Maven 3.9.16; baseline
d823f2dcd52903c01d2f79b93019d379208584dc.git diff --checkpassed.These local runs disable coverage instrumentation; the repository POM is unchanged. Full-repository tests, packaging and live ServerChan delivery were not tested.
AI-assisted contribution
codewill now fail. Custom compatible endpoints must provide the same response contract. Existing URL handling and retry behavior are unchanged.Checklist
Add or update API
Not applicable: no public API added or changed.