Skip to content

Conversation

@overtrue
Copy link
Collaborator

Summary

  • bump s3s to commit f76013a52de2c8d44f6aa43182f1f1a938d2ad03 (upstream PR feat(s3s): typed etag s3s-project/s3s#349) so the SDK natively formats RFC 7232 entity tags; this supersedes the manual quoting we added in Fix ETag format to comply with HTTP standards by wrapping with quotes #592 and fix: normalize ETag comparison in multipart upload and replication #627
  • update crates/ecstore/src/client/object_api_utils.rs:
    • format_etag now returns a typed s3s::dto::ETag, handling both strong ("abc") and weak (W/"abc") tags without double quoting
    • extract_etag keeps the existing precedence (etag metadata → md5Sum) but leaves the stored string untouched; the caller receives the typed ETag
  • update crates/ecstore/src/store_api.rs to preserve backward compatibility:
    • when transforming s3s::dto::CompletedPart, convert ETag::Strong/Weak back to the quoted string format expected by the current metadata/persistence code paths
  • make the networking helpers testable without real DNS:
    • add an injectable resolver (set_mock_dns_resolver / reset_dns_resolver) in crates/utils/src/net.rs
    • unit tests now rely on mock responses instead of hitting the live network, eliminating the flakiness we observed on bare-metal

Type of Change

  • New Feature
  • Bug Fix
  • Documentation
  • Performance Improvement
  • Test/CI
  • Refactor
  • Other:

Related Issues

s3s-project/s3s#349, #592 and #627

Summary of Changes

Checklist

  • I have read and followed the CONTRIBUTING.md guidelines
  • Passed make pre-commit
  • Added/updated necessary tests
  • Documentation updated (if needed)
  • CI/CD passed (if applicable)

Impact

  • Breaking change (compatibility)
  • Requires doc/config/deployment update
  • Other impact:

Additional Notes


Thank you for your contribution! Please ensure your PR follows the community standards (CODE_OF_CONDUCT.md) and sign the CLA if this is your first contribution.

@github-actions
Copy link

github-actions bot commented Oct 15, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@overtrue
Copy link
Collaborator Author

@Nugine Please review these changes.

@overtrue overtrue requested review from Copilot and weisd October 15, 2025 00:21
Copy link
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 adapts the codebase to use s3s library's native typed ETag support, eliminating manual ETag quoting that was previously implemented. The update bumps s3s to a specific commit that provides RFC 7232-compliant entity tag formatting and refactors the DNS resolution utilities to support testable mock resolvers.

  • Updates s3s dependency to use typed ETag support from upstream
  • Refactors ETag handling to use strongly-typed s3s::dto::ETag instead of manual string formatting
  • Adds injectable DNS resolver functionality for improved test reliability

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
Cargo.toml Updates s3s dependency to specific git commit with typed ETag support
crates/ecstore/src/client/object_api_utils.rs Refactors ETag functions to return/handle typed ETag instead of quoted strings
crates/ecstore/src/store_api.rs Adds conversion from typed ETag back to quoted string format for backward compatibility
crates/utils/src/net.rs Adds mock DNS resolver infrastructure for testing and refactors DNS resolution logic

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 170 to 176
pub fn extract_etag(metadata: &HashMap<String, String>) -> String {
let etag = if let Some(etag) = metadata.get("etag") {
etag.clone()
} else {
metadata["md5Sum"].clone()
};
format_etag(&etag)
metadata
.get("etag")
.cloned()
.or_else(|| metadata.get("md5Sum").cloned())
.unwrap_or_default()
}
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

[nitpick] The extract_etag function now returns the raw stored string instead of a formatted ETag, but the function name suggests it should extract and format an ETag. Consider renaming to get_raw_etag or get_stored_etag to clarify that it returns the unprocessed value.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@Nugine Nugine left a comment

Choose a reason for hiding this comment

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

DNS-related changes should be separated from ETag-related changes.
Two commits or two PRs?

@overtrue overtrue merged commit d447b3e into main Oct 15, 2025
16 checks passed
@overtrue overtrue deleted the feat/typed-etag-adaptation branch October 15, 2025 13:27
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