Skip to content

Set return_records to false#75

Open
piceri wants to merge 1 commit intomainfrom
piceri/return-records-false
Open

Set return_records to false#75
piceri wants to merge 1 commit intomainfrom
piceri/return-records-false

Conversation

@piceri
Copy link
Copy Markdown
Contributor

@piceri piceri commented Apr 9, 2026

This changes sets return_records to false when creating deployment records. This will reduce bandwidth as deployment tracker does not use the response body content from creating deployment records.

https://docs.github.com/en/rest/orgs/artifact-metadata?apiVersion=2026-03-10#create-an-artifact-deployment-record

Signed-off-by: Eric Pickard <piceri@github.com>
@piceri piceri marked this pull request as ready for review April 9, 2026 19:36
@piceri piceri requested a review from a team as a code owner April 9, 2026 19:36
Copilot AI review requested due to automatic review settings April 9, 2026 19:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the deployment record creation request to set return_records=false, reducing response payload/bandwidth since the deployment tracker doesn’t use the response body from the create call.

Changes:

  • Replace direct json.Marshal(record) with a helper that injects return_records=false into the request body.
  • Add/extend a request-validation test to assert the new request field is present.
Show a summary per file
File Description
pkg/deploymentrecord/client.go Build request JSON with return_records=false when posting a deployment record.
pkg/deploymentrecord/client_test.go Validate the POST body includes return_records:false.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

}
body, err := io.ReadAll(r.Body)
if err != nil {
t.Fatal("unable to read request body")
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test failure message drops the underlying read error, which makes debugging intermittent test/server issues harder. Include err in the fatal message (or use t.Fatalf) so the failure has actionable context.

Suggested change
t.Fatal("unable to read request body")
t.Fatalf("unable to read request body: %v", err)

Copilot uses AI. Check for mistakes.
Comment on lines +602 to +604
if !bytes.Contains(body, []byte("\"return_records\":false")) {
t.Error("expected '\"return_records\":false' in the request body")
}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a raw substring check on the request body can yield false positives (it doesn't validate JSON structure/typing). Consider unmarshalling the body and asserting return_records is a boolean false to make this test more robust.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@malancas malancas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Copilot suggestions also make sense to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants