Conversation
Signed-off-by: Ewuji John <johnseyi51@gmail.com>
✅ Deploy Preview for pipecd-site canceled.
|
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
There’s an edge-case correctness issue where an expectedResponse larger than the 1 MiB read limit can never succeed and should fail fast with a clear configuration error.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR fixes a functional gap in the pipedv1 analysis HTTP provider by enforcing expectedResponse at runtime (in addition to expectedCode), aligning behavior with the existing configuration surface and the reported issue #7396.
Changes:
- Adds exact response-body validation when
expectedResponseis non-empty, while preserving status-code-only behavior when it is empty. - Limits response-body reads to 1 MiB to avoid unbounded memory usage.
- Adds unit tests covering status-code checks, body match/mismatch, and response-size limiting.
| File | Description |
|---|---|
| pkg/app/pipedv1/plugin/analysis/config/condition.go | Documents expectedResponse semantics (exact match; empty disables body validation). |
| pkg/app/pipedv1/plugin/analysis/analysisprovider/http/http.go | Implements bounded response-body reading and exact-match validation when expectedResponse is set. |
| pkg/app/pipedv1/plugin/analysis/analysisprovider/http/http_test.go | Adds test coverage for the new expectedResponse enforcement and max-body-size behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Ewuji John <johnseyi51@gmail.com>
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 this PR does
Makes HTTP analysis enforce a configured
expectedResponse. After the HTTP status code succeeds, the provider reads the response body and requires an exact match withexpectedResponse. An emptyexpectedResponsepreserves the existing status-code-only behavior.The response body read is limited to 1 MiB to prevent unbounded memory use.
Why we need it
expectedResponsewas accepted in HTTP analysis configuration but ignored at runtime. As a result, an analysis could succeed when an endpoint returned the expected status code but an unhealthy or otherwise unexpected response body.Which issue(s) this PR fixes
Fixes #7396
Does this PR introduce a user-facing change?
Yes.
expectedResponsenow fail when the response body does not exactly match the configured value. Configurations withoutexpectedResponseretain their current behavior.expectedResponseif they only want to validate the HTTP status code.Screenshots/Videos (for documentation or website changes)
Not applicable. This PR does not modify documentation or website files.