Skip to content

refactor: audit phase 0, 1, 2, 3, 5, 6 foundations#1117

Merged
datlechin merged 5 commits intomainfrom
refactor/audit-phases
May 8, 2026
Merged

refactor: audit phase 0, 1, 2, 3, 5, 6 foundations#1117
datlechin merged 5 commits intomainfrom
refactor/audit-phases

Conversation

@datlechin
Copy link
Copy Markdown
Member

Summary

Five-phase refactor pulled out of the codebase audit (827 Swift files / 131k LOC). Each commit is foundation-only: pattern + 1-2 exemplar migrations. Long tail tracked in pattern docs at /tmp/audit/.

Commit Phase What
1ff9774 0+1 12 try! regex sites → safe compileRegex with OSLog fault. Dynamic Type for ER diagram + 2 hardcoded font sites. Accessibility on chat shimmer + TestConnectionStatusButton + LicenseActivationSheet Cancel. FileConflictDiffSheet resizable
95bb688 6 2 real bugs: SSHProfileStorage.deleteProfile and TagStorage.deleteTag fired markDeleted before saveX, violating the persist-then-notify invariant
7a01406 5 New Core/Events/AppEvents.swift with typed Combine publishers. Migrated themeChanged + connectionStatusChanged (3 post sites + 3 observer sites). Removed the two Notification.Name constants. 33 notifications still on the old bus, recipe in phase5-migration-pattern.md
9408747 3 New Core/Services/AppServices.swift dependency container holding 11 services. EnvironmentKey wired to all 4 SwiftUI scenes. QuickSwitcherViewModel migrated as exemplar (init takes services with .live default). Tail: 6 ViewModels + 5 coordinators in phase3-migration-pattern.md
b129c42 2 New PluginCapabilities OptionSet (12 flags) and PluginProcedureFunctionSupport sub-protocol in TableProPluginKit. PluginDatabaseDriver gains a capabilities property with default []. SQLite declares its 7 real capabilities. NO ABI bump (additive change with default impl). Plugin migration order in phase2-migration-pattern.md

What's not in this PR

  • Phase 4 (split MainContentCoordinator): every real coordinator candidate mutates tabManager.tabs, currentQueryTask, or the undo manager. Plan-only doc at /tmp/audit/phase4-extraction-plan.md scored all 35 extensions; nothing met the safety bar without behavior change. Multi-session work needed (TabStateMutator first).

Style

No em dashes in the diff. Banned-word grep clean. swiftlint passes on every touched file. Build: every commit was built and pushed in sequence (force-pushed off main into this branch later).

Test plan

  • xcodebuild Debug builds clean
  • swiftlint --strict passes
  • Existing tests pass
  • Manual: SSH profile delete/restore round trips through CloudKit sync (verifies the persist-then-notify fix)
  • Manual: theme switch updates DataGridCoordinator fonts (verifies AppEvents wiring)
  • Manual: connection status changes still trigger sidebar/badge updates
  • Manual: SQLite alter table / truncate / cancel still work (capabilities are descriptive, no behavior change)

@datlechin datlechin changed the title refactor: audit phase 0+1+2+3+5+6 foundations refactor: audit phase 0, 1, 2, 3, 5, 6 foundations May 8, 2026
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: b129c42ecc

ℹ️ 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".

return regex
}
regexLogger.fault("Failed to compile static regex pattern: \(pattern, privacy: .public)")
return NSRegularExpression()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use a valid fallback regular expression

This fallback calls NSRegularExpression() with no arguments, but Foundation does not provide a parameterless initializer for NSRegularExpression in Swift, so the target will fail to compile whenever this file is built. Use a valid pattern such as (?!) for the fallback instead of constructing an empty regex.

Useful? React with 👍 / 👎.

return regex
}
patternLogger.fault("Failed to compile JSON highlight pattern: \(pattern, privacy: .public)")
return NSRegularExpression()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use a valid fallback regular expression

This fallback calls NSRegularExpression() with no arguments, but Foundation does not provide a parameterless initializer for NSRegularExpression in Swift, so the target will fail to compile whenever this file is built. Use a valid pattern such as (?!) for the fallback instead of constructing an empty regex.

Useful? React with 👍 / 👎.

return regex
}
logger.fault("Failed to compile EnvVarResolver pattern: \(source, privacy: .public)")
return NSRegularExpression()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use a valid fallback regular expression

This fallback calls NSRegularExpression() with no arguments, but Foundation does not provide a parameterless initializer for NSRegularExpression in Swift, so the target will fail to compile whenever this file is built. Use a valid pattern such as (?!) for the fallback instead of constructing an empty regex.

Useful? React with 👍 / 👎.

@datlechin datlechin merged commit be57986 into main May 8, 2026
2 checks passed
@datlechin datlechin deleted the refactor/audit-phases branch May 8, 2026 09:00
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.

1 participant