Skip to content

♻️ Modernize concurrency, tests and service conventions + Claude Code setup - #47

Merged
olejnjak merged 14 commits into
mainfrom
refactoring
Aug 24, 2026
Merged

♻️ Modernize concurrency, tests and service conventions + Claude Code setup#47
olejnjak merged 14 commits into
mainfrom
refactoring

Conversation

@olejnjak

@olejnjak olejnjak commented Aug 20, 2026

Copy link
Copy Markdown
Member

Changes

Concurrency & tests

  • Migrate tests from XCTest to Swift Testing
  • Add comprehensive test coverage for core localization logic
  • Introduce a FileSystem protocol to decouple file I/O from tests
  • Replace internal Combine usage with async/await and remove leftover Combine extensions

Service conventions

  • Surface RequestError from SheetsAPIService using typed throws
  • Rename service protocols and implementations to new convention (plain protocol name + Impl)
  • Hide service implementations behind public factory functions
  • Remove file header comments

Claude Code setup

  • Add CLAUDE.md project guidance and code style / service convention rules
  • Add project .claude/settings.json (permissions, sandbox rules, plugins) and .mcp.json with Xcode MCP server

Closes #43
Closes #19

olejnjak and others added 6 commits March 19, 2026 18:19
Replace XCTest with Swift Testing framework across all test files,
using @suite structs, @test functions, and #expect macros. Remove
XCTestManifests.swift as macro-based test discovery makes it obsolete.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cover previously untested areas: multi-language transforms, configuration
decoding/migration, file I/O with plist prefix routing, ValueRange edge
cases, GoogleError detection, and LocRow formatting edge cases (91 tests total).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract filesystem operations behind an internal FileSystem protocol
so SaveMappedValuesTests can use an in-memory mock instead of writing
to temp directories on disk.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move Combine API out of protocol definitions and core class into a
dedicated CombineExtensions.swift that forwards to async/sync
implementations. SheetsAPIServicing now defines only async methods,
run() is fully async, and URLSessionExtensions.swift is removed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@olejnjak
olejnjak requested a lite review from Copilot August 20, 2026 17:50
@olejnjak olejnjak self-assigned this Aug 20, 2026

This comment was marked as outdated.

@olejnjak olejnjak changed the title ♻️ Modernize concurrency and test infrastructure ♻️ Modernize concurrency, tests and service conventions + Claude Code setup Aug 21, 2026
@olejnjak
olejnjak requested a lite review from Copilot August 21, 2026 00:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Suppressed comments (3)

Sources/ACKLocalizationCore/ACKLocalization.swift:38

  • run() only handles LocalizationError explicitly; RequestError (thrown by SheetsAPIService) and other errors fall into the generic catch and get printed to stdout without the existing formatting / missing-sheet-tab mapping. This is a behavior regression compared to the previous pipeline where request failures were surfaced as LocalizationError.
        } catch let error as LocalizationError {
            displayError(error)
            exit(1)
        } catch {
            print(error)

Tests/ACKLocalizationCoreTests/Mocks/FileSystemMock.swift:5

  • createdDirectories is an array, but the doc comment says it is "keyed by path" (which would imply a dictionary). This is misleading for future test authors.
    Sources/ACKLocalizationCore/Services/SheetsAPIServiceImpl.swift:38
  • Force-unwrapping the percent-encoded sheet name and the URL (addingPercentEncoding(...)!, urlComponents.url!) can crash the process on malformed input. Since this is user-supplied data (sheet/tab names), prefer failing with RequestError instead of crashing.
        let sheetName = sheetName ?? spreadsheet.sheets.first?.properties.title ?? ""
        var urlComponents = URLComponents(string: "https://sheets.googleapis.com/v4/spreadsheets/" + spreadsheet.spreadsheetId + "/values/" + sheetName.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed)!)!
        urlComponents.queryItems = [URLQueryItem(name: "valueRenderOption", value: "UNFORMATTED_VALUE")]
        var request = URLRequest(url: urlComponents.url!)
        credentials?.addToRequest(&request)

Comment thread Sources/ACKLocalization/main.swift

Copilot AI commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

@olejnjak Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 0e972ce6-4004-4f8b-93c6-fbb859fccf51

Sorry for the inconvenience!

@IgorRosocha IgorRosocha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks for taking your time @olejnjak! 🙌

@babacros babacros left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🕵️ ✅

@olejnjak
olejnjak merged commit eb9eda6 into main Aug 24, 2026
5 checks passed
@olejnjak
olejnjak deleted the refactoring branch August 24, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor to Swift Concurrency Improve dependency injection to improve testability

6 participants