Skip to content

Implement case-insensitive sorting for Acknowledgement#38

Closed
Copilot wants to merge 3 commits into
feature/bug-fixes-and-testsfrom
copilot/sub-pr-31
Closed

Implement case-insensitive sorting for Acknowledgement#38
Copilot wants to merge 3 commits into
feature/bug-fixes-and-testsfrom
copilot/sub-pr-31

Conversation

Copilot AI commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

The Acknowledgement type's Comparable implementation was case-sensitive, conflicting with the intended case-insensitive behavior and causing inconsistency with documentation examples.

Changes:

  • Acknowledgement.Comparable: Use localizedStandardCompare(_:) for case-insensitive comparison (more performant than .lowercased())
  • Acknowledgement.all(): Simplify to use .sorted() directly, delegating to Comparable
  • Tests: Rename testSortingIsCaseSensitivetestSortingIsCaseInsensitive with updated expectations
  • Documentation: Update improvement-plan.md example to reflect case-insensitive behavior

Before:

extension Acknowledgement: Comparable {
    public static func < (lhs: Acknowledgement, rhs: Acknowledgement) -> Bool {
        lhs.title < rhs.title  // Case-sensitive: "Zebra" < "apple"
    }
}

After:

extension Acknowledgement: Comparable {
    public static func < (lhs: Acknowledgement, rhs: Acknowledgement) -> Bool {
        lhs.title.localizedStandardCompare(rhs.title) == .orderedAscending  // "apple" < "Zebra"
    }
}

Sorting now correctly orders: ["apple", "Banana", "Zebra"] regardless of capitalization.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 7, 2026 04:18
Co-authored-by: MartinP7r <2669027+MartinP7r@users.noreply.github.com>
Co-authored-by: MartinP7r <2669027+MartinP7r@users.noreply.github.com>
Copilot AI changed the title [WIP] Update for case-insensitive handling based on review feedback Implement case-insensitive sorting for Acknowledgement Feb 7, 2026
Copilot AI requested a review from MartinP7r February 7, 2026 04:20
MartinP7r added a commit that referenced this pull request Mar 8, 2026
Replace inconsistent sorting: Comparable used case-sensitive comparison
while all() used .lowercased(). Now both use localizedStandardCompare
via the Comparable conformance, which handles locale-specific ordering.

Closes #38
@MartinP7r

Copy link
Copy Markdown
Owner

Closing in favor of #41 which applies the same fix rebased onto current main (the target branch feature/bug-fixes-and-tests was already merged via #31). All 16 tests pass.

@MartinP7r MartinP7r closed this Mar 8, 2026
MartinP7r added a commit that referenced this pull request Mar 8, 2026
Replace inconsistent sorting: Comparable used case-sensitive comparison
while all() used .lowercased(). Now both use localizedStandardCompare
via the Comparable conformance, which handles locale-specific ordering.

Closes #38
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