-
Notifications
You must be signed in to change notification settings - Fork 1
fix(FLEETMDM-002-2): CU-86akj32d7 3 review findings across 3 files #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,9 @@ func (c *Client) getRawBody(endpoint string) ([]byte, error) { | |
| if err == nil && len(body) > 0 { | ||
| return nil, fmt.Errorf("get %s received status %d: %s", endpoint, response.StatusCode, body) | ||
| } | ||
| if err != nil { | ||
| return nil, fmt.Errorf("get %s received status %d, read response body: %w", endpoint, response.StatusCode, err) | ||
| } | ||
| return nil, fmt.Errorf("get %s received status %d", endpoint, response.StatusCode) | ||
| } | ||
|
|
||
|
Comment on lines
20
to
28
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π getRawBody swallows the read error on non-200 responses instead of wrapping it In getRawBody (server/service/client_debug.go), the non-200 branch now checks the io.ReadAll error separately: if err != nil, the error is wrapped with %w into a new error message that also includes the status code, instead of being silently discarded and replaced by a generic status-only message. The success path (empty body, no error) still falls through to the generic status-only message unchanged. π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ func sync( | |
| ) error { | ||
| remote, url, err := ghClient.MacOfficeReleaseNotes(ctx) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π sync() in macoffice/sync.go returns errors from ghClient/fsClient calls without wrapping context In sync() (server/vulnerabilities/macoffice/sync.go), wrapped all four bare π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
| if err != nil { | ||
| return err | ||
| return fmt.Errorf("get remote release notes: %w", err) | ||
| } | ||
|
|
||
| // Nothing published yet on remote repo, so we do nothing. | ||
|
|
@@ -42,12 +42,12 @@ func sync( | |
|
|
||
| local, err := fsClient.MacOfficeReleaseNotes() | ||
| if err != nil { | ||
| return err | ||
| return fmt.Errorf("get local release notes: %w", err) | ||
| } | ||
|
|
||
| if len(local) == 0 { | ||
| if _, err := ghClient.Download(url); err != nil { | ||
| return err | ||
| return fmt.Errorf("download release notes: %w", err) | ||
| } | ||
| return nil | ||
| } | ||
|
|
@@ -58,15 +58,15 @@ func sync( | |
|
|
||
| if local[0].Before(remote) { | ||
| if _, err := ghClient.Download(url); err != nil { | ||
| return err | ||
| return fmt.Errorf("download release notes: %w", err) | ||
| } | ||
| } | ||
|
|
||
| // Clean up out of date files | ||
| for _, l := range local { | ||
| if l.Before(remote) { | ||
| if err := fsClient.Delete(l); err != nil { | ||
| return err | ||
| return fmt.Errorf("delete out of date release notes: %w", err) | ||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𦩠π machineId header injection swallows a nil machineIdProvider silently without any wrapped error or log context
In
requestWithExternal(client/orbit_client.go), added anelsebranch to theif oc.machineIdProvider != nilcheck that logslog.Debug().Msg("machineIdProvider is nil, not adding x-machine-id header"), mirroring the existing Debug log used in the authToken-empty branch just above it. This gives log parity between the two header-injection paths without altering control flow, header behavior, or any other logic.π€ Prompt for AI agents
fix confidence: π’ 92 high β react π/π to teach the reviewer