Skip to content

Preserve user-hidden status item defaults#1

Open
hhh2210 wants to merge 1 commit into
Thinkscape:fix/repeat-status-item-defaults-repairfrom
hhh2210:codex/pr-1306-status-defaults-review
Open

Preserve user-hidden status item defaults#1
hhh2210 wants to merge 1 commit into
Thinkscape:fix/repeat-status-item-defaults-repairfrom
hhh2210:codex/pr-1306-status-defaults-review

Conversation

@hhh2210
Copy link
Copy Markdown

@hhh2210 hhh2210 commented Jun 6, 2026

Summary

  • Keep repeated cleanup for stale default NSStatusItem VisibleCC Item-* = false keys.
  • Only remove codexbar-* = false visibility defaults during the first migration, before the repair marker exists.
  • Preserve user choices to hide CodexBar status items after the migration has already run.

Follow-up for steipete#1306 and its ClawSweeper P1 blocker.

Tests

  • make check
  • swift test --filter StatusItemControllerSplitLifecycleTests
  • swift test
  • git diff --check

Review

  • Spawned independent reviewer Dirac: no findings.

Copilot AI review requested due to automatic review settings June 6, 2026 05:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the status item defaults repair logic to avoid removing user-intended “hidden” keys after the initial migration repair, and extends tests to cover the repeated-run behavior.

Changes:

  • Adjusted repairHiddenVisibilityDefaultsIfNeeded to respect didRepairKey when deciding whether to delete legacy autosave keys.
  • Renamed an existing test and added a new test to verify repeated cleanup behavior without overriding later user hides.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
Tests/CodexBarTests/StatusItemControllerSplitLifecycleTests.swift Renames a repair-related test and adds coverage for repeat-run behavior with didRepairKey set.
Sources/CodexBar/MenuBarStatusItemDefaultsRepair.swift Gates legacy autosave cleanup based on didRepairKey while continuing default-item cleanup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +25 to 30
static func shouldRepair(key: String, value: Any?, didRepair: Bool = false) -> Bool {
guard key.hasPrefix(self.visibilityPrefix), self.isFalse(value) else { return false }
let itemName = String(key.dropFirst(self.visibilityPrefix.count))
return itemName.hasPrefix(self.legacyAutosavePrefix) || self.isDefaultStatusItemName(itemName)
if self.isDefaultStatusItemName(itemName) { return true }
return !didRepair && itemName.hasPrefix(self.legacyAutosavePrefix)
}
@Test
func `status item defaults repair removes stale hidden Control Center keys repeatedly`() throws {
func `status item defaults repair removes stale hidden Control Center keys during migration`() throws {
let suite = "StatusItemControllerSplitLifecycleTests-repair-repeated-\(UUID().uuidString)"
Comment on lines 366 to +373
defaults.set(false, forKey: "NSStatusItem VisibleCC Item-2")
defaults.set(false, forKey: "NSStatusItem VisibleCC codexbar-codex")

#expect(MenuBarStatusItemDefaultsRepair.repairHiddenVisibilityDefaultsIfNeeded(defaults: defaults) == [
"NSStatusItem VisibleCC Item-2",
"NSStatusItem VisibleCC codexbar-codex",
])
#expect(defaults.object(forKey: "NSStatusItem VisibleCC Item-2") == nil)
#expect(defaults.object(forKey: "NSStatusItem VisibleCC codexbar-codex") == nil)
#expect(defaults.object(forKey: "NSStatusItem VisibleCC codexbar-codex") != nil)
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