Skip to content

refactor(settings): decompose TranscriptedSettingsView god object [WIP]#1343

Open
r3dbars wants to merge 5 commits into
mainfrom
claude/app-health-check-umn6dg
Open

refactor(settings): decompose TranscriptedSettingsView god object [WIP]#1343
r3dbars wants to merge 5 commits into
mainfrom
claude/app-health-check-umn6dg

Conversation

@r3dbars

@r3dbars r3dbars commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Why

docs/strategy/codebase-architecture-health-2026-06-14.md (principal-engineer audit, grade B) flagged Sources/UI/Settings/TranscriptedSettingsView.swift as the #1 highest-ROI fix: 4900+ lines, 187 commits since January, the hottest merge-contention file in the repo. Its recommended shape: extract each settings page into its own file using the existing private var xPage: some View seams.

Product Impact

  • Affects: agent workflow (internal refactor, no user-facing behavior change)
  • Lane: agent workflow
  • Why this matters: settings/home pages are the most-edited surface in the app; splitting them reduces merge contention and makes each page safe to touch independently.

What changed

  • Extracted peoplePageTranscriptedSettingsView+People.swift
  • Extracted connectAgentPageTranscriptedSettingsView+ConnectAgent.swift
  • meetingSession promoted from private to internal (needed cross-file access from the moved connectAgentPage)
  • This PR is a work in progress. More pages (about, support, storage, beta, shortcuts, models, privacy, general) are being extracted in following commits on this same branch, in order of increasing coupling risk. The general/shortcuts/models/privacy cluster shares nearly all its state with the rest of the file, so it may land as promoted-access-but-not-moved rather than a full file split — will call that out explicitly when it lands.

This is a mechanical, behavior-preserving move: page bodies relocated verbatim, only access modifiers changed where a moved page now references something cross-file. No logic changes.

How I checked it

  • scripts/dev/agent-preflight.sh
  • Selected checks from .agents/test-matrix.yml for the files changed — touches Sources/UI/** only, so bash build.sh --no-open + bash run-tests.sh is the required lane
  • bash build.sh --no-opencould not run: this session has no macOS/Swift toolchain (Linux container). Relying on Swift CI for the actual compile check.
  • bash run-tests.sh — same limitation
  • Performance budget passed
  • bash run-integration-smoke.sh — not applicable, no Meeting/Core files touched
  • swift test — not applicable
  • Manual check: not possible from this environment (no running macOS app)

Risk Review

  • Privacy / local-first behavior reviewed — no data flow changes, pure code motion
  • Storage path or migration impact reviewed — not applicable
  • Public-facing copy stays concrete and matches current product scope — not applicable, no copy changes
  • Release/update impact reviewed — not applicable, no release-path files touched
  • Agent PRs link the issue/workpad and stay draft until human review — draft, per this note
  • UI changes include sanitized .agent-review/visuals/ evidence — no visual/behavior change, none needed
  • No private transcripts, audio, tokens, personal paths, or customer data are included

Notes

Follow-up to the health-check session's architecture audit. Keeping this draft and iterating commit-by-commit on this branch until all planned pages land and CI is green, since I can't compile-check locally here.


Generated by Claude Code

claude added 5 commits July 1, 2026 16:20
…files

Start of the god-object decomposition flagged in the 2026-06-14 architecture
health audit (docs/strategy/codebase-architecture-health-2026-06-14.md):
TranscriptedSettingsView.swift was the hottest, most-coupled file in the repo.
This is a behavior-preserving mechanical move (page body + no other logic
changes); meetingSession drops private since the moved connectAgentPage now
references it from a different file. More pages to follow in this branch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AymCvy8QNJ9YGSociPqg9v
…ls/privacy pages

Continues the TranscriptedSettingsView decomposition. Also fixes the repo
command contract tests: several `readRepoTextFile("...TranscriptedSettingsView.swift")`
call sites were asserting on page content that has now moved to sibling
extension files. Introduced readSettingsSurfaceContents() to concatenate the
main file with its TranscriptedSettingsView+*.swift siblings so these
contract tests keep working regardless of which physical file a page's code
lives in, instead of re-patching them on every future page move.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AymCvy8QNJ9YGSociPqg9v
…om prior commit

Completes the TranscriptedSettingsView page extraction (all 10 pages now
live in sibling TranscriptedSettingsView+*.swift files). Also fixes two
real bugs the previous commit shipped, caught by CI (build-and-test failure
on d52b231):

- modelsPage and privacyPage were left declared in both the main file and
  their new extension files (duplicate declaration) after an in-progress
  extraction pass landed mid-commit.
- 5 identifiers Shortcuts.swift needs (sortedAutoEnterAllowedBundleIDs,
  setAutoEnterApp, refreshAutoEnterAppCandidates, chooseAutoEnterApp,
  autoEnterDisplayName) were still `private` in the main file, inaccessible
  from the extension file.

Verified by hand (no local Swift toolchain in this session): brace balance
and single-declaration checks across all 11 files pass. Relying on Swift CI
for the actual compiler check.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AymCvy8QNJ9YGSociPqg9v
…sion files

Follow-up to the TranscriptedSettingsView page extraction (aab7732, d52b231,
a4ae475). A full identifier cross-reference against all 10 new
TranscriptedSettingsView+*.swift extension files turned up several members
that were still `private` in the main file despite being read/called from
those extension files: sttRouter, dictationTriggerSystemWarning,
dictationShortcutsEnabled, showTranscriptedInDock, launchAtLoginEnabled/Status,
showGeneral* disclosure flags, customDictionary* state, dictationCleanupEnabled,
dictationOverlayMode, uiSoundsEnabled, autoEnter* state, anonymousAnalyticsEnabled,
sentryTestStatus, permissionStates, meetingMicProcessingMode,
splitLocalSpeakersEnabled, confirmQuitDuringMeetingEnabled,
autoDetectCallsEnabled, missingRequiredPermissions, crashReportingFootnote,
analyticsFootnote, trackPermissionCTA, refreshPermissions, and
sendTestSentryEvent. Swift's `private` is file-scoped, so these were
inaccessible from the sibling extension files even though nothing flagged it
without a full cross-file grep. Also tidies two doubled blank lines left over
from the extraction cuts.

Verified by hand (no local Swift toolchain in this session): every identifier
referenced by each TranscriptedSettingsView+*.swift file is now either
declared in that same file or is non-private in the main file; brace counts
balance in all 11 files; no page var is declared in more than one file; the
pageBody switch in the main file is unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AymCvy8QNJ9YGSociPqg9v
HomeImportAudioActionTests and UIAutomationSurfaceContractTests each read
Sources/UI/Settings/TranscriptedSettingsView.swift directly and assert on
page content that has moved into sibling TranscriptedSettingsView+*.swift
files (28 failures in the last CI run, all content-location misses, not
access-level or compile errors — compilation itself now succeeds).

Added a shared settingsSurfaceContents() helper to Tests/TestHelpers.swift
(concatenates the main file with its extension-file siblings) and pointed
both test files at it instead of re-patching each assertion individually,
matching the approach already used in RepoCommandContractTests.swift.

Checked the remaining 3 test files that reference TranscriptedSettingsView.swift
(DictationSoundsTests, HomeFirstArtifactVisibilityTests,
HomeStatsPresentationTests) — they only assert on Home-cluster content that
was not moved, so they're unaffected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AymCvy8QNJ9YGSociPqg9v
@r3dbars r3dbars marked this pull request as ready for review July 3, 2026 01:34
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