Skip to content

fix: remove legacy assistant keychain entries#11

Merged
D1a0y1bb merged 1 commit into
masterfrom
D1a0y1bb/fix-assistant-key-deletion
May 15, 2026
Merged

fix: remove legacy assistant keychain entries#11
D1a0y1bb merged 1 commit into
masterfrom
D1a0y1bb/fix-assistant-key-deletion

Conversation

@D1a0y1bb
Copy link
Copy Markdown
Owner

@D1a0y1bb D1a0y1bb commented May 15, 2026

Summary

  • delete the legacy audit assistant Keychain account after migrating it into the provider-specific account
  • make Settings > Delete Key remove both the current credential ID and the legacy default account
  • add tests covering migration cleanup and stale legacy delete behavior

Validation

  • git diff --check
  • swift test --package-path PitcherPlantApp --filter keychainCredential
  • swift test --package-path PitcherPlantApp
  • xcodebuild -project PitcherPlantApp/PitcherPlantApp.xcodeproj -scheme PitcherPlantApp -configuration Debug -destination 'platform=macOS' build

Security note

The published v0.2.1-beta artifacts were built by GitHub Actions from commit d4d4299. I also checked the released app bundle and repository for common API-key token patterns; no match was found.

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved handling of legacy audit assistant credentials to ensure they are properly cleaned up during migration and deletion operations.
    • Enhanced credential deletion process to remove all associated credential data more thoroughly.

Review Change Stack

Move migrated audit assistant credentials out of the legacy default account instead of copying them.

Make the Settings delete action remove both the current credential ID and the legacy default account so stale keys cannot reappear on the next launch.

Add tests for migration cleanup and delete behavior.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

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: 1eeb1dfe-d287-43a8-a2ce-896f03153608

📥 Commits

Reviewing files that changed from the base of the PR and between d4d4299 and a1fe6e7.

📒 Files selected for processing (3)
  • PitcherPlantApp/Sources/PitcherPlantApp/Core/AuditAssistantService.swift
  • PitcherPlantApp/Sources/PitcherPlantApp/Features/Settings/SettingsRootView.swift
  • PitcherPlantApp/Tests/PitcherPlantAppTests/AuditAssistantServiceTests.swift

📝 Walkthrough

Walkthrough

This PR enhances credential cleanup by teaching the audit assistant credential store to remove legacy default credentials during migration and deletion operations. A new helper method is added, the settings view is updated to use it, and tests verify the complete cleanup behavior.

Changes

Legacy Credential Cleanup

Layer / File(s) Summary
Migration and deletion helpers
PitcherPlantApp/Sources/PitcherPlantApp/Core/AuditAssistantService.swift
The migration method now deletes the legacy credential after transferring its value, and a new deleteCredentialAndLegacyIfPresent(id:) helper deletes the provided credential and removes the legacy default credential when the provided ID is not itself the legacy key.
Settings credential deletion
PitcherPlantApp/Sources/PitcherPlantApp/Features/Settings/SettingsRootView.swift
The credential deletion action now calls the new deleteCredentialAndLegacyIfPresent helper to clean up both current and legacy credentials in a single operation.
Test coverage for cleanup behavior
PitcherPlantApp/Tests/PitcherPlantAppTests/AuditAssistantServiceTests.swift
Migration test assertions now verify that the legacy credential is removed post-migration and that a second migration call returns false. A new test validates that deleteCredentialAndLegacyIfPresent removes both the target and legacy credentials.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A legacy key once cluttered the store,
Now migration makes room for the new,
With deleteAndClean, we sweep up before,
Both old and new vanish from view! 🌱

🚥 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 'fix: remove legacy assistant keychain entries' directly summarizes the main change: deletion of legacy audit assistant keychain entries after migration, which is the core objective across all modified files.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch D1a0y1bb/fix-assistant-key-deletion

Comment @coderabbitai help to get the list of available commands and usage tips.

@D1a0y1bb D1a0y1bb merged commit bca9e4a into master May 15, 2026
2 checks passed
@D1a0y1bb D1a0y1bb deleted the D1a0y1bb/fix-assistant-key-deletion branch May 15, 2026 03:31
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