Skip to content

Conversation

szokeasaurusrex
Copy link
Member

Split off from #2408

Copy link

@Copilot 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 way projects are passed to the assemble artifact request by replacing allocations via Vec with slice references. The changes affect three files to reduce unnecessary allocations when constructing the projects list.

  • Changed file_upload.rs to use slice literals instead of vectors when calling the API.
  • Updated src/api/mod.rs to accept slice parameters and pass empty slice literals.
  • Modified the ChunkedArtifactRequest in src/api/data_types/chunking/artifact.rs to hold a slice reference instead of a Vec.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/utils/file_upload.rs Replaced vector construction with slice literal for the projects parameter
src/api/mod.rs Adjusted the API method signature and usage to accept a slice, including empty slice usage
src/api/data_types/chunking/artifact.rs Updated the projects field type and its serializer condition for slice references
Comments suppressed due to low confidence (3)

src/utils/file_upload.rs:461

  • Using a slice literal instead of a vector reduces heap allocations. Ensure that the temporary String created by to_string() has a suitable lifetime for the API call.
+                &[context.project.unwrap().to_string()],

src/api/mod.rs:999

  • Switching to an empty slice literal improves efficiency by avoiding unnecessary vector construction. Verify that the changes align with the expected lifetime requirements of the API.
+                projects: &[],

src/api/data_types/chunking/artifact.rs:10

  • Updating the skip_serializing_if condition to use the slice pattern is appropriate for the new type change. Confirm that this serializer condition correctly handles empty slices.
+    #[serde(skip_serializing_if = "<[_]>::is_empty")]

@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/legacy-upload-context branch from 813fa81 to 8a63fec Compare May 8, 2025 11:45
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/chunked-artifact-request-slice branch from 1bb1afc to f540dc1 Compare May 8, 2025 11:47
Base automatically changed from szokeasaurusrex/legacy-upload-context to master May 8, 2025 11:51
@szokeasaurusrex szokeasaurusrex merged commit f540dc1 into master May 8, 2025
16 checks passed
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/chunked-artifact-request-slice branch May 8, 2025 11:52
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.

2 participants