Skip to content

[M0] Foundation clean-room baseline#34

Merged
Peerapat-J merged 12 commits into
mainfrom
PJ/m0-foundation-clean-room
Jun 5, 2026
Merged

[M0] Foundation clean-room baseline#34
Peerapat-J merged 12 commits into
mainfrom
PJ/m0-foundation-clean-room

Conversation

@Peerapat-J
Copy link
Copy Markdown
Owner

@Peerapat-J Peerapat-J commented Jun 4, 2026

Summary

Implement the M0 foundation baseline for the clean-room LinguistMac rewrite, with LinguistMac.xcodeproj as the canonical project entrypoint.

This PR intentionally keeps the open M0 issues together because they are one reviewable foundation slice: clean-room docs, core architecture boundaries, test/mocking baseline, and app identity/permission posture. Commits are split by issue or review/correction so review can still inspect each concern separately.

Scope

  • Add clean-room rewrite rules, feature inventory, parity roadmap, and contribution notes.
  • Add a checked-in Xcode project with app, LinguistMacCore static library, and LinguistMacCoreTests unit test targets.
  • Remove the Swift Package Manager entrypoint so the project is Xcode-project-first.
  • Add core domain models and service protocols for capture, OCR, translation, settings, history, permissions, clipboard, and shortcuts.
  • Add LinguistServices as the first dependency container for future feature implementation.
  • Add test doubles and focused tests for defaults, permission baseline, provider descriptors, session states, and mock service flow.
  • Add app identity constants, checked-in Info.plist, sandbox entitlement baseline, and permission posture docs.
  • Update CI and the package helper to build/test/package through xcodebuild -project LinguistMac.xcodeproj.

Base Branch Note

The requested dev branch does not exist on the remote. The repository default branch is main, so this branch was created from the latest origin/main.

Clean-Room Notes

  • No source code, assets, UI text, scripts, tests, or architecture were copied from the GPL reference project.
  • The reference feature inventory is based on public README/CHANGELOG-level behavior only.
  • Word Card and voice work are explicitly kept as post-parity planning items.

Commits

  • bbb12a0 Document clean-room M0 baseline
  • 22bcf6a Add M0 core architecture boundaries
  • 0941024 Add M0 service mocks and tests
  • 725e282 Add M0 app identity and permissions baseline
  • 2a10df8 Format M0 service mock imports
  • de558a7 Fix M0 SwiftLint analyzer import finding
  • 90ba558 Convert M0 baseline to Xcode project

Validation

  • git diff --check
  • rg -n "SwiftPM|Swift Package|Package\\.swift|swift build|swift test|LinguistMac-Package" . --glob "!/.git/**" --glob "!/.build/**" --glob "!dist/**" returned no matches
  • xcodebuild -list -project LinguistMac.xcodeproj
  • swiftlint lint --strict --no-cache
  • swiftformat --lint . --config .swiftformat --cache ignore
  • plutil -lint Configuration/LinguistMac/Info.plist Configuration/LinguistMac/LinguistMac.entitlements
  • bash -n script/build_and_run.sh
  • xcodebuild -project LinguistMac.xcodeproj -scheme LinguistMac -configuration Debug -destination "platform=macOS" -derivedDataPath /private/tmp/linguistmac-xcode-debug CODE_SIGNING_ALLOWED=NO build
  • xcodebuild -quiet -project LinguistMac.xcodeproj -scheme LinguistMac -configuration Release -destination "platform=macOS" -derivedDataPath /private/tmp/linguistmac-xcode-release CODE_SIGNING_ALLOWED=NO build
  • xcodebuild -quiet -project LinguistMac.xcodeproj -scheme LinguistMac -configuration Debug -destination "platform=macOS" -derivedDataPath /private/tmp/linguistmac-xcode-debug-test CODE_SIGNING_ALLOWED=NO ENABLE_TESTABILITY=YES test
  • xcodebuild -quiet -project LinguistMac.xcodeproj -scheme LinguistMac -configuration Release -destination "platform=macOS" -derivedDataPath /private/tmp/linguistmac-xcode-release-test CODE_SIGNING_ALLOWED=NO ENABLE_TESTABILITY=YES test
  • xcodebuild -project LinguistMac.xcodeproj -scheme LinguistMac -configuration Debug -destination "platform=macOS" -derivedDataPath /private/tmp/linguistmac-swiftlint-xcode CODE_SIGNING_ALLOWED=NO clean build > /private/tmp/linguistmac-swiftlint-xcode.log 2>&1
  • swiftlint analyze --strict --compiler-log-path /private/tmp/linguistmac-swiftlint-xcode.log
  • xcodebuild -quiet -project LinguistMac.xcodeproj -scheme LinguistMac -configuration Debug -destination "platform=macOS" -derivedDataPath /private/tmp/linguistmac-xcode-strict CODE_SIGNING_ALLOWED=NO SWIFT_TREAT_WARNINGS_AS_ERRORS=YES GCC_TREAT_WARNINGS_AS_ERRORS=YES build
  • xcodebuild -quiet -project LinguistMac.xcodeproj -scheme LinguistMac -configuration Debug -destination "platform=macOS" -derivedDataPath /private/tmp/linguistmac-xcode-analyze CODE_SIGNING_ALLOWED=NO SWIFT_TREAT_WARNINGS_AS_ERRORS=YES GCC_TREAT_WARNINGS_AS_ERRORS=YES CLANG_ANALYZER_NONNULL=YES analyze
  • ./script/build_and_run.sh --package
  • plutil -extract CFBundleIdentifier raw dist/LinguistMac.app/Contents/Info.plist
  • plutil -extract LSMinimumSystemVersion raw dist/LinguistMac.app/Contents/Info.plist

Closes #2
Closes #3
Closes #5
Closes #6

Summary by CodeRabbit

  • New Features

    • Introduced Quick Translate feature for rapid translations.
    • Added support for multiple translation providers with configurable settings.
    • Introduced keyboard shortcuts for translation actions.
    • Added translation language support including English, Thai, Japanese, Korean, and Chinese.
    • Implemented permission management for required system capabilities.
  • Chores

    • Updated build system configuration and CI/CD workflows.
    • Added project configuration files and documentation.

@Peerapat-J Peerapat-J added the enhancement New feature or request label Jun 4, 2026
@Peerapat-J Peerapat-J self-assigned this Jun 4, 2026
@Peerapat-J Peerapat-J added documentation Improvements or additions to documentation type: clean-room Clean-room rewrite, license-risk, provenance, and no-copy guardrails. type: architecture Module boundaries, state flow, dependency injection, and platform structure. type: tests Unit, integration, UI, and regression validation. type: privacy Privacy, permissions, API keys, and data-handling concerns. area: docs Documentation and implementation handoff material. area: app App target, app identity, lifecycle, and platform integration. area: ci Continuous integration and local validation parity. area: permissions Accessibility, screen recording, sandbox, and permission prompts. priority: p0 Critical path for initial parity. labels Jun 4, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

Warning

Review limit reached

@Peerapat-J, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 45 minutes and 38 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2b46c365-4a38-44fe-a46f-8ad7ddaf916f

📥 Commits

Reviewing files that changed from the base of the PR and between 8b5453e and fc9b53a.

📒 Files selected for processing (3)
  • LinguistMac.xcodeproj/project.pbxproj
  • docs/ci-cd.md
  • script/build_and_run.sh
📝 Walkthrough

Walkthrough

The PR establishes the M0 Xcode foundation for LinguistMac, transitioning from Swift Package Manager to a native Xcode project, and introducing core domain models, service protocols, test infrastructure, and clean-room governance documentation. Package.swift is removed; LinguistMac.xcodeproj becomes canonical.

Changes

M0 foundation and clean-room baseline

Layer / File(s) Summary
Xcode project structure, targets, and build configuration
LinguistMac.xcodeproj/project.pbxproj, LinguistMac.xcodeproj/xcshareddata/xcschemes/LinguistMac.xcscheme
Project defines three native targets (app, core library, test bundle) with build phases, inter-target dependencies, Debug/Release configurations, Swift 6 strict concurrency, and macOS 15.0 deployment target.
App bundle metadata and entitlements
Configuration/LinguistMac/Info.plist, Configuration/LinguistMac/LinguistMac.entitlements
App identity (bundle ID com.peerapatj.LinguistMac, display name, version 1.0.0), minimum macOS 15.0, and App Sandbox entitlement enabled.
Build pipeline and CI migration to xcodebuild
.github/workflows/ci.yml, script/build_and_run.sh, docs/ci-cd.md
CI workflow and local build script converted from SwiftPM swift build/swift test to xcodebuild project/scheme commands; SwiftPM Package.swift removed; CI documentation updated.
Core domain models, permissions, and service protocols
Sources/LinguistMacCore/AppIdentity.swift, Sources/LinguistMacCore/AppSettings.swift, Sources/LinguistMacCore/Permissions.swift, Sources/LinguistMacCore/TranslationModels.swift, Sources/LinguistMacCore/ServiceProtocols.swift, Sources/LinguistMacCore/LinguistServices.swift, Sources/LinguistMacCore/AppFeature.swift
Public types for app metadata, keyboard shortcuts and modifiers, permission kinds/statuses/requirements, translation languages/providers/session states/errors, nine service protocols (capture, OCR, translation, settings, history, permissions, clipboard, shortcuts), dependency-injection container, and quick-translate starter feature entry.
Protocol-based test mocks and in-memory stores
Tests/LinguistMacCoreTests/ServiceMocks.swift
Stub and in-memory actor implementations for all service protocols: screen capture, OCR, translation provider/registry, app settings, translation history, permission checking, clipboard, and shortcut registration.
Unit tests for models, permissions, features, and service orchestration
Tests/LinguistMacCoreTests/AppIdentityTests.swift, Tests/LinguistMacCoreTests/AppSettingsTests.swift, Tests/LinguistMacCoreTests/PermissionBaselineTests.swift, Tests/LinguistMacCoreTests/AppFeatureTests.swift, Tests/LinguistMacCoreTests/TranslationModelsTests.swift, Tests/LinguistMacCoreTests/ServiceMocksTests.swift
Tests for identity defaults, settings/shortcut defaults, permission baseline requirements, quick-translate feature presence, translation model semantics, and mock-driven service orchestration with success and permission-denied error paths.
Clean-room rules, roadmap, and contribution guidance
docs/app-identity-permissions.md, docs/clean-room-rules.md, docs/contribution-notes.md, docs/parity-roadmap.md, docs/reference-feature-inventory.md
M0 app identity and permission documentation, clean-room rewrite guardrails (allowed/disallowed references), contribution workflow, milestone roadmap (M0–M6), and reference feature inventory from public README/CHANGELOG sources.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Peerapat-J/LinguistMac#9: Both PRs migrate CI and build scripts to xcodebuild project/scheme-based workflows, replacing SwiftPM commands.
  • Peerapat-J/LinguistMac#8: Main PR builds on the app-feature scaffolding introduced in #8, adding the "quick-translate" starter feature entry.

Poem

🐰 Thumpty-hop, the stage is set,
Xcode's built where Swift was wet.
Service threads all woven clean,
Mocks to dance where tests convene.
Clean-room rules drawn clear and bright,
Foundation solid, paths in sight.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[M0] Foundation clean-room baseline' clearly and concisely summarizes the primary change—establishing the M0 foundation for a clean-room rewrite, which aligns with the main objectives of the PR.
Linked Issues check ✅ Passed The PR comprehensively addresses all four linked issues: #2 (Xcode project structure, protocols, mocks), #3 (app identity, entitlements, permissions), #5 (clean-room docs), and #6 (test target with mocks and fixtures).
Out of Scope Changes check ✅ Passed All changes are directly scoped to the M0 foundation objectives: Xcode project setup, service protocols, domain models, app configuration, test infrastructure, documentation, and CI/build script updates. No unrelated features or exploratory changes are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch PJ/m0-foundation-clean-room

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.

@Peerapat-J
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 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 `@docs/clean-room-rules.md`:
- Around line 49-57: Update the PR checklist entry currently phrased as "Which
public/product source describes that behavior?" to require an immutable
provenance citation: mandate a URL plus accessed date and, when available, a
version/tag/commit identifier (or other immutable snapshot) and include an
example format; change the checklist line and any related question text in
docs/clean-room-rules.md to explicitly require "URL + accessed date +
version/tag/commit (or immutable snapshot)" and add a short note or template
showing the expected citation format for auditability.

In `@docs/reference-feature-inventory.md`:
- Around line 3-5: The inventory currently cites an inspection date but not the
exact artifacts; update the text that references `Peerapat-J/translateOnScreen`
and the inspection date (2026-06-04) to include immutable source references—add
the repository URL plus the specific release tag or commit SHA (and optional
release archive URL) you inspected so the record is reproducible and auditable;
ensure the same change appears where the repository name is mentioned in
docs/reference-feature-inventory.md and keep the original inspection date
alongside the added URL and tag/SHA.

In `@LinguistMac.xcodeproj/project.pbxproj`:
- Around line 349-399: The project-level build configurations (entries
B70000000000000000000002 "Debug" and B70000000000000000000003 "Release")
hard-pin ARCHS = arm64 in their buildSettings, which forces all targets to arm64
and breaks xcodebuild on Intel hosts; remove the ARCHS = arm64 override (or set
ARCHS to the default/standard architectures, e.g. "$(ARCHS_STANDARD)" or simply
delete the ARCHS key) from those XCBuildConfiguration blocks so targets inherit
normal architecture settings instead of being forced to arm64.

In `@Tests/LinguistMacCoreTests/ServiceMocksTests.swift`:
- Around line 6-77: Add a failing orchestration-path test that mirrors
testServicesCanDriveMockTranslationFlow but makes one service fail and asserts
the flow surfaces that failure: create a TranslationRequest, build
LinguistServices where one stub returns a failure (e.g.,
StubScreenCaptureService(result: .failure(MockError.some)) or a
StubTranslationProvider configured to throw on translate), then call the same
orchestration methods (services.screenCapture.captureSelection(),
services.ocr.recognizeText(...), services.translatorRegistry.provider(...),
translator.translate(request)) and assert the expected throw using
XCTAssertThrowsError; reference the existing
testServicesCanDriveMockTranslationFlow, StubScreenCaptureService,
StubOCRService, StubTranslationProvider, captureSelection, recognizeText,
provider(for:), and translate to locate where to add the new failing test.
🪄 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 Plus

Run ID: 79c04d3f-7631-4c59-a2e6-ea4bae1af0f4

📥 Commits

Reviewing files that changed from the base of the PR and between 53cb807 and 90ba558.

📒 Files selected for processing (27)
  • .github/workflows/ci.yml
  • Configuration/LinguistMac/Info.plist
  • Configuration/LinguistMac/LinguistMac.entitlements
  • LinguistMac.xcodeproj/project.pbxproj
  • LinguistMac.xcodeproj/xcshareddata/xcschemes/LinguistMac.xcscheme
  • Package.swift
  • Sources/LinguistMacCore/AppFeature.swift
  • Sources/LinguistMacCore/AppIdentity.swift
  • Sources/LinguistMacCore/AppSettings.swift
  • Sources/LinguistMacCore/LinguistServices.swift
  • Sources/LinguistMacCore/Permissions.swift
  • Sources/LinguistMacCore/ServiceProtocols.swift
  • Sources/LinguistMacCore/TranslationModels.swift
  • Tests/LinguistMacCoreTests/AppFeatureTests.swift
  • Tests/LinguistMacCoreTests/AppIdentityTests.swift
  • Tests/LinguistMacCoreTests/AppSettingsTests.swift
  • Tests/LinguistMacCoreTests/PermissionBaselineTests.swift
  • Tests/LinguistMacCoreTests/ServiceMocks.swift
  • Tests/LinguistMacCoreTests/ServiceMocksTests.swift
  • Tests/LinguistMacCoreTests/TranslationModelsTests.swift
  • docs/app-identity-permissions.md
  • docs/ci-cd.md
  • docs/clean-room-rules.md
  • docs/contribution-notes.md
  • docs/parity-roadmap.md
  • docs/reference-feature-inventory.md
  • script/build_and_run.sh
💤 Files with no reviewable changes (1)
  • Package.swift

Comment thread docs/clean-room-rules.md
Comment thread docs/reference-feature-inventory.md Outdated
Comment thread LinguistMac.xcodeproj/project.pbxproj
Comment thread Tests/LinguistMacCoreTests/ServiceMocksTests.swift
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90ba558668

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread LinguistMac.xcodeproj/project.pbxproj Outdated
@Peerapat-J Peerapat-J marked this pull request as ready for review June 5, 2026 08:22
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b5453ec12

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread script/build_and_run.sh Outdated
@Peerapat-J Peerapat-J merged commit 25cd6db into main Jun 5, 2026
6 checks passed
@Peerapat-J Peerapat-J deleted the PJ/m0-foundation-clean-room branch June 5, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: app App target, app identity, lifecycle, and platform integration. area: ci Continuous integration and local validation parity. area: docs Documentation and implementation handoff material. area: permissions Accessibility, screen recording, sandbox, and permission prompts. documentation Improvements or additions to documentation enhancement New feature or request priority: p0 Critical path for initial parity. type: architecture Module boundaries, state flow, dependency injection, and platform structure. type: clean-room Clean-room rewrite, license-risk, provenance, and no-copy guardrails. type: privacy Privacy, permissions, API keys, and data-handling concerns. type: tests Unit, integration, UI, and regression validation.

Projects

None yet

1 participant