Skip to content

Fix/thread safety sendable#146

Merged
leogdion merged 2 commits intov3.0.0-alpha.4from
fix/thread-safety-sendable
Jan 23, 2026
Merged

Fix/thread safety sendable#146
leogdion merged 2 commits intov3.0.0-alpha.4from
fix/thread-safety-sendable

Conversation

@leogdion
Copy link
Copy Markdown
Member

No description provided.

leogdion and others added 2 commits January 23, 2026 11:23
- Replace DateFormatter with modern Date.ParseStrategy for thread-safe RFC 2822 parsing
- Add Sendable conformance to FileManagerHandler per coding guidelines
- Fix async test in DataSourceTests to properly await Task execution
- Add comprehensive test coverage for invalid RFC 2822 date formats

Resolves #134, #135, #136, #137

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add swiftlint:disable:next line_length directive for RFC 2822 format string
- The format string cannot be easily broken due to Date.FormatString constraints
- Functionality remains unchanged with modern thread-safe Date.ParseStrategy

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 23, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@claude
Copy link
Copy Markdown

claude bot commented Jan 23, 2026

Code Review: Fix/thread safety sendable

This PR effectively addresses critical thread safety issues and improves code quality. Overall, this is a well-executed fix that resolves all four related issues.


Strengths

1. Excellent Thread Safety Improvement (Date+RFC2822.swift)

The migration from DateFormatter to Date.ParseStrategy is the correct solution - thread-safe by design, modern Swift API, properly documented, with correct fallback handling.

2. Proper Sendable Conformance (FileManagerHandler.swift)

Simple, correct addition of Sendable conformance that aligns with project coding guidelines.

3. Fixed Async Test (DataSourceTests.swift)

Properly awaits the Task result ensuring assertions execute and prevents false positives in CI.

4. Comprehensive Test Coverage (FormattersTests.swift)

Excellent addition of 16 negative test cases covering edge cases with clear inline documentation.


Observations & Considerations

Formatters.swift Still Uses DateFormatter

Sources/BushelFoundation/Formatters.swift still exposes a DateFormatter as lastModifiedDateFormatter with nonisolated(unsafe).

Recommendation: Consider updating this to use the thread-safe Date.ParseStrategy or deprecate in favor of Date(rfc2822String:).

Format String Hardcoding

The RFC 2822 format now hardcodes GMT instead of zzz. This is actually MORE CORRECT for HTTP Last-Modified headers, which always use GMT.


Performance & Security

  • Improved performance: ParseStrategy is faster than DateFormatter for one-off parsing
  • No lock overhead: Zero synchronization overhead
  • Input validation: Safely rejects invalid inputs
  • No injection risks: Format string is compile-time constant

Test Coverage

Excellent additions - Valid RFC 2822 parsing (existing), 16 invalid input test cases (new), Async/Sendable verification (fixed)


Summary

Recommendation: APPROVE

This PR successfully resolves all four critical issues with high-quality implementations. The code follows Swift best practices, is well-documented, and includes thorough test coverage. Great work!

@leogdion leogdion merged commit 5907061 into v3.0.0-alpha.4 Jan 23, 2026
21 checks passed
@leogdion leogdion deleted the fix/thread-safety-sendable branch January 23, 2026 18:46
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.

1 participant