Skip to content

PCX: AI Review of code example for aws-sdk-kotlin#27926

Closed
Oxyjun wants to merge 3 commits intoproductionfrom
r2-kotlin
Closed

PCX: AI Review of code example for aws-sdk-kotlin#27926
Oxyjun wants to merge 3 commits intoproductionfrom
r2-kotlin

Conversation

@Oxyjun
Copy link
Copy Markdown
Contributor

@Oxyjun Oxyjun commented Jan 28, 2026

Summary

  • Fix S3Client resource leak by using .use {} block for proper resource cleanup
  • Align placeholder naming (ACCESS_KEY_ID/SECRET_ACCESS_KEY) with other AWS SDK examples

Follow-up to #27702

sh-cho and others added 2 commits January 24, 2026 21:21
Signed-off-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>
@github-actions github-actions bot added product:r2 R2 object storage: https://developers.cloudflare.com/r2 size/m labels Jan 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/r2/ @oxyjun, @elithrar, @jonesphillip, @aninibread, @harshil1712, @cloudflare/workers-docs, @cloudflare/pcx-technical-writing

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 28, 2026

@elithrar
Copy link
Copy Markdown
Collaborator

elithrar commented Feb 5, 2026

/bonk review this PR and ensure it is valid and idiomatic Kotlin code

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Feb 5, 2026

Failed to parse response. Part types found: [step-start, step-finish]

github run

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Feb 5, 2026

Bonk workflow failed. Check the logs for details.

View workflow run

@elithrar
Copy link
Copy Markdown
Collaborator

elithrar commented Feb 6, 2026

/bonk try again. make sure you leave a comment.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Feb 6, 2026

Review comment posted on PR #19227. Here's the summary:

The Kotlin code is valid and idiomatic. The core patterns — S3Client.fromEnvironment, .use {} for resource cleanup, StaticCredentialsProvider, and the presigner API — are all correct.

Two items worth addressing:

  1. Unused imports in Basic Usage block — Lines 19–22 and 26 import presigner-related classes that are only used in the second code block. This would produce compiler warnings if someone copies just the first example. The presigned URLs snippet also references r2Client and bucketName which are scoped inside the .use {} lambda, so some restructuring or a clarifying note would help.

  2. listObjects vs listObjectsV2 — The example uses the older v1 API. listObjectsV2 is the recommended modern API and is what other SDK examples in these docs tend to use.

github run

@elithrar
Copy link
Copy Markdown
Collaborator

elithrar commented Feb 6, 2026

/bonk fix the examples so they are self-contained and use listObjectsV2

Co-authored-by: elithrar <elithrar@users.noreply.github.com>
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Feb 6, 2026

The file looks correct. Here's a summary of the changes made:

Basic Usage block (lines 15-50):

  • Removed unused presigner imports (GetObjectRequest, PutObjectRequest, presignGetObject, presignPutObject, Duration.Companion.minutes) that would cause compiler warnings if someone copies just this example
  • Replaced listObjects (v1 API) with listObjectsV2 (recommended modern API), using ListObjectsV2Request — consistent with other SDK examples in the docs (Java, Rust, Go, JS v3, PHP all use listObjectsV2)

Presigned URLs block (lines 66-114):

  • Made fully self-contained with its own imports, credential placeholders, main() function, and S3Client setup inside a .use {} block
  • Previously referenced r2Client and bucketName that were scoped inside the Basic Usage .use {} lambda and wouldn't be accessible — copying that snippet alone would not compile

github run

@github-actions
Copy link
Copy Markdown
Contributor

Hey there, we've marked this pull request as stale because there's no recent activity on it. This label is helps us identify PRs that might need updates (or to be closed out by our team if no longer relevant).

@github-actions github-actions bot added the stale label Feb 21, 2026
@Oxyjun Oxyjun closed this Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:r2 R2 object storage: https://developers.cloudflare.com/r2 size/m stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants