Skip to content

File Provider: configure domains and shared state - #31

Open
obra wants to merge 4 commits into
h3nock:mainfrom
obra:codex/file-provider-review/domain-foundation
Open

File Provider: configure domains and shared state#31
obra wants to merge 4 commits into
h3nock:mainfrom
obra:codex/file-provider-review/domain-foundation

Conversation

@obra

@obra obra commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Reviewability experiment

This is the head of an attempt to make the File Provider work more reviewable. If this stack or this boundary does not feel right, please say so instead of spending effort reviewing an unhelpful presentation—we can reshape the history first.

This is a history/presentation rewrite of the already-tested implementation. It does not add new product behavior.

Intended review slice

  • Incremental parent: upstream/main
  • Branch: codex/file-provider-review/domain-foundation
  • Production delta: 402 additions / 7 deletions (F1–F3)

The commits in this branch are the atomic commits intended for this slice:

efb4e97 fileprovider: model deterministic SSH domain reconciliation
226b68c fileprovider: migrate profiles and SSH state into shared storage
40e4a45 fileprovider: configure shared app and keychain storage

Stack mechanics

All PRs in this stack intentionally target main. The branches themselves remain sequential, so GitHub may show earlier ancestry in a later PR until its parents merge. Please review the commit range above as the intended slice and merge these PRs in order; after a parent lands, GitHub will reduce the next PR diff to its incremental changes.

Verification

The final rewritten leaf was verified with 1164 tests passed, 0 failed, and 1 skipped. xcodegen generate produced no project diff, and the final tree is identical to the previously tested simplified result.

Summary by CodeRabbit

  • New Features

    • Added File Provider integration for eligible saved servers, including automatic domain registration and cleanup.
    • Added shared storage support for File Provider access across app components.
    • Added migration of existing profiles, credentials, and trusted hosts to shared storage.
  • Bug Fixes

    • Improved SSH credential separation between app and shared storage.
    • Host-key trust now requires matching both the server hostname and public key.
  • Tests

    • Added coverage for File Provider synchronization, migration, shared storage, and trust validation.

obra added 3 commits August 1, 2026 15:29
Configure Remux with the accepted shared App Group root and explicit application and shared Keychain access groups. Keep the credential service identity centralized while allowing the existing Keychain store to target either access group through the accepted structured query path.

Preserve the exact accepted F1 test boundary: shared-root resolution, explicit access-group query construction, and shared configuration lookup. The focused suite first failed at the expected missing symbols, then passed 3 tests with 0 failures and 0 skips. A Remux simulator build also succeeded.

Generate the app entitlement, plist values, and Xcode project membership from the accepted configuration with XcodeGen 2.44.1; consecutive generations were deterministic. Shared-state migration, live application/shared Keychain separation, and all File Provider extension wiring remain deferred to F2 and later branches.
Copy profiles, credentials, and hostname-bound trust into the shared container without deleting application-local source state. Verify copied credentials and repository/trust snapshots before atomically writing the migration marker, so failed attempts remain retryable and completed attempts are idempotent.

Expose only the application/shared Keychain store factory at this layer. Migration construction, authoritative shared-repository selection, and lifecycle activation remain intentionally absent for the final app-integration layer.

Preserve the SSH setup rollback-only trust APIs while adding bulk migration access and binding accepted trust to both server identity and hostname.

Verification: accepted tests produced the expected missing-helper compile RED; the focused migration, shared-storage, and trusted-host suites passed 11 tests with 0 failures and 0 skips; the Remux simulator build succeeded. XcodeGen 2.44.1 was deterministic, runtime production delta is 124 lines, and all complete blobs/hunks match their accepted provenance.
Transplant the accepted inactive File Provider domain model exactly as reviewed. Eligible records require a saved SSH credential and trusted host identity matching both server ID and hostname. UUID-derived domain identifiers remain stable, display-name changes reconcile as remove/add pairs, and a FIFO actor gate serializes concurrent callers.

Keep this leaf deliberately unreachable: it links FileProvider.framework into the app target but adds no dependency factory, live instance, RootModel or lifecycle invocation, host-mutation hook, extension target, or compatibility path. Registry and storage failures propagate after the gate is released; no new retry or cleanup behavior is introduced.

The accepted three-test blob covers eligibility, deterministic add/rename/remove behavior with concurrent reconciliation serialized to one mutation, and host-change removal until replacement hostname trust. The tests-first build failed at the expected missing F3 types. The final focused suite passed 3/3 with no failures or skips, and the Remux iPhone 17 simulator build succeeded. XcodeGen 2.44.1 generated the same PBX blob twice.
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ede4db93-726b-424d-ba51-aea7de5e97dc

📥 Commits

Reviewing files that changed from the base of the PR and between 517f8d2 and 411dee6.

📒 Files selected for processing (14)
  • Remux.xcodeproj/project.pbxproj
  • RemuxApp/Info.plist
  • RemuxApp/Remux.entitlements
  • RemuxApp/Sources/App/RemuxAppDependencies.swift
  • RemuxApp/Sources/FileProvider/FileProviderDomainReconciler.swift
  • RemuxApp/Sources/Persistence/ApplicationStorage.swift
  • RemuxApp/Sources/Persistence/FileProviderSharedStorageMigrator.swift
  • RemuxApp/Sources/Persistence/SSHCredentialStore.swift
  • RemuxApp/Sources/Persistence/TrustedHostStore.swift
  • RemuxAppTests/FileProviderDomainReconcilerTests.swift
  • RemuxAppTests/FileProviderSharedStorageMigratorTests.swift
  • RemuxAppTests/FileProviderSharedStorageTests.swift
  • RemuxAppTests/GhosttyTerminalDisconnectReasonClassifierTests.swift
  • project.yml

📝 Walkthrough

Walkthrough

The PR adds File Provider domain reconciliation and shared-storage migration. It adds keychain access-group support, shared container configuration, hostname-sensitive trust validation, tests, entitlements, and Xcode project integration.

Changes

FileProvider integration

Layer / File(s) Summary
Shared storage and credential contracts
RemuxApp/Sources/Persistence/ApplicationStorage.swift, RemuxApp/Sources/Persistence/SSHCredentialStore.swift, RemuxApp/Sources/Persistence/TrustedHostStore.swift, RemuxApp/Sources/App/RemuxAppDependencies.swift, RemuxApp/Info.plist, RemuxApp/Remux.entitlements, RemuxAppTests/FileProviderSharedStorageTests.swift
Adds shared-container configuration, keychain access-group lookup, separate application and shared credential stores, bulk trusted-identity operations, and shared-storage tests.
Legacy shared-storage migration
RemuxApp/Sources/Persistence/FileProviderSharedStorageMigrator.swift, RemuxAppTests/FileProviderSharedStorageMigratorTests.swift
Migrates profiles, credentials, servers, workspaces, and trusted identities. It verifies the migrated data and writes an atomic completion marker.
File Provider domain reconciliation
RemuxApp/Sources/FileProvider/FileProviderDomainReconciler.swift, RemuxApp/Sources/Persistence/TrustedHostStore.swift, RemuxAppTests/FileProviderDomainReconcilerTests.swift, RemuxAppTests/GhosttyTerminalDisconnectReasonClassifierTests.swift
Registers domains for servers with credentials and matching trust data. It removes stale domains, serializes concurrent reconciliation, and requires host and key matches for trust validation.
Project and target integration
Remux.xcodeproj/project.pbxproj, project.yml
Registers the new sources and tests, links FileProvider.framework, and configures entitlements and keychain access-group properties.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant FileProviderDomainReconciler
  participant Profiles
  participant KeychainSSHCredentialStore
  participant TrustedHostStore
  participant NSFileProviderDomainRegistry
  FileProviderDomainReconciler->>Profiles: Load saved servers
  FileProviderDomainReconciler->>KeychainSSHCredentialStore: Load credentials
  FileProviderDomainReconciler->>TrustedHostStore: Load trusted identities
  FileProviderDomainReconciler->>NSFileProviderDomainRegistry: List registered domains
  FileProviderDomainReconciler->>NSFileProviderDomainRegistry: Remove stale or changed domains
  FileProviderDomainReconciler->>NSFileProviderDomainRegistry: Add missing or changed domains
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.70% 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 clearly summarizes the main changes: File Provider domain configuration and shared-state setup.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@obra

obra commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@h3nock - Let me know if slicing into PRs and an attempt at logical commits like this is actually useful to you. If it's not, I'll make all of these go away and we can talk through whether there's a sane way to deliver something like the FileProvider work.

@h3nock
h3nock self-requested a review August 12, 2026 14:53
let existingRecords = try await registry.records()

for record in existingRecords
where desiredRecords.first(where: { $0.serverID == record.serverID }) != record {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

would it make sense to avoid removing the domain on rename? i think Apple supports updating the name by calling add with the same ID. i reviewed this with Codex against Apple’s docs.

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