fixup: give required presigned headers directly to the client#334
fixup: give required presigned headers directly to the client#334cole-h wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughS3 upload headers are deserialized from stage metadata, passed through the release flow, merged with required tarball headers, validated, and used in the upload request. ChangesS3 header upload flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ReleaseFlow
participant FlakeHub
participant upload_release_to_s3
participant S3
ReleaseFlow->>FlakeHub: Request release-stage metadata
FlakeHub-->>ReleaseFlow: Return upload URL and headers
ReleaseFlow->>upload_release_to_s3: Pass URL, headers, and tarball
upload_release_to_s3->>S3: PUT tarball with validated headers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/flakehub_client.rs`:
- Line 25: Add the serde default attribute to the StageResult::s3_upload_headers
field so deserialization supplies an empty HashMap when the server omits it,
preserving compatibility with older responses.
In `@src/s3.rs`:
- Around line 45-66: Update build_headers so it inserts every caller-provided
header and then unconditionally inserts all entries from overrides, ensuring
required values such as Content-Length, Content-Type, and x-amz-checksum-sha256
are present even when absent from the caller map. Preserve case-insensitive
matching and allow override entries to replace caller values without duplicating
headers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8c466f06-a10d-4437-a872-6667748eccda
📒 Files selected for processing (3)
src/flakehub_client.rssrc/main.rssrc/s3.rs
| #[derive(serde::Deserialize)] | ||
| pub(crate) struct StageResult { | ||
| pub(crate) s3_upload_url: String, | ||
| pub(crate) s3_upload_headers: HashMap<String, String>, |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the target file and nearby definitions.
wc -l src/flakehub_client.rs
cat -n src/flakehub_client.rs | sed -n '1,220p'
# Find all serde-related usage for the type and response path.
rg -n "s3_upload_headers|Decoding release metadata POST response|serde(default)|Deserialize|response\.json|flakehub_client" srcRepository: DeterminateSystems/flakehub-push
Length of output: 6044
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the response handling and the release stage flow.
cat -n src/main.rs | sed -n '130,220p'
# Check whether StageResult is used anywhere else or transformed before deserialization.
rg -n "StageResult|release_stage\(|release_publish\(|Decoding release metadata POST response|s3_upload_headers" srcRepository: DeterminateSystems/flakehub-push
Length of output: 4656
Add a default for StageResult::s3_upload_headers src/flakehub_client.rs/src/main.rs
If a server response ever omits s3_upload_headers, response.json() will fail with a missing-field error and abort the release. Add #[serde(default)] so older responses can still decode cleanly.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/flakehub_client.rs` at line 25, Add the serde default attribute to the
StageResult::s3_upload_headers field so deserialization supplies an empty
HashMap when the server omits it, preserving compatibility with older responses.
We still override ones with what we calculated (so if something went wrong, the upload will fail because of that), but there could be some additional headers that are unknowable to the client that we just have to send along verbatim.
bcff340 to
0e0f0c1
Compare
We still override ones with what we calculated (so if something went wrong, the upload will fail because of that), but there could be some additional headers that are unknowable to the client that we just have to send along verbatim.
Summary by CodeRabbit