Improve apps import connector status cards#6366
Conversation
Greptile SummaryThis PR improves the import connector cards on the Apps page by surfacing real sync counts, freshness timestamps, and actionable connected states, and fixes the Apps-page crash by correctly resolving connector logos from the installed app resource bundle. The persistence logic in Confidence Score: 4/5Safe to merge; no blocking defects — the unpersisted availabilityText is a cosmetic regression limited to chatgpt/claude secondary labels after restart. One P2 data-persistence gap (availabilityText not written to UserDefaults) and one redundant computation; all other metrics are correctly persisted, the crash fix is solid, and the isConnected state remains accurate. desktop/Desktop/Sources/MainWindow/Pages/AppsPage.swift — review the availabilityText persistence gap in markSynced(). Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User
participant AP as AppsPage
participant SS as ImportConnectorStatusStore
participant UD as UserDefaults
participant DB as RewindDatabase
participant SVC as AppleNotesReaderService
U->>AP: Opens Apps page
AP->>SS: .task { await refresh() }
SS->>DB: SELECT COUNT(*), MAX(indexedAt) FROM indexed_files
DB-->>SS: (count, lastIndexedAt)
SS->>SS: metricsByID["local-files"] = updated
SS->>SVC: readRecentNotes(maxResults: 250)
SVC-->>SS: notes array
SS->>SS: metricsByID["apple-notes"] = updated
SS-->>AP: @Published metricsByID triggers re-render
U->>AP: Taps connector card
AP->>AP: selectedConnector = connector
AP->>U: Shows ImportConnectorSheet
U->>AP: Taps sync button
AP->>SS: markSynced(connectorID, sourceCount, memoryCount, lastDeltaCount)
SS->>UD: set(sourceCount) + set(memoryCount) + set(lastSyncedAt) + set(lastDeltaCount)
SS->>SS: metricsByID[connectorID] = updated
SS-->>AP: @Published triggers card re-render with new snapshot
Reviews (1): Last reviewed commit: "Improve apps import connector status car..." | Re-trigger Greptile |
| if let availabilityText = metrics.availabilityText, availabilityText != primaryText(for: connector, metrics: metrics, isConnected: isConnected) { | ||
| return availabilityText |
There was a problem hiding this comment.
secondaryText recomputes primaryText redundantly
primaryText(for:metrics:isConnected:) is called a second time here purely to avoid echoing it as the secondary label. Since snapshot(for:) already computes both values separately, the duplicated call adds unnecessary work on every card render and creates a maintenance coupling — any future change to primaryText must be mirrored in this comparison to keep the dedup working. Consider passing the already-computed primary text in as a parameter to secondaryText.
| } | ||
| if let availabilityText { | ||
| metrics.availabilityText = availabilityText | ||
| } |
There was a problem hiding this comment.
availabilityText is not persisted to UserDefaults
Every other metric (sourceCount, memoryCount, lastSyncedAt, lastDeltaCount) is written to UserDefaults with a keyed prefix, but availabilityText is only stored in the in-memory metricsByID dict. On the next app launch, load() won't restore it (it only has a special-case for apple-notes via appleNotesFolderDefaultsKey). For chatgpt/claude connectors the secondary label "Imported manually" will silently disappear after a restart. isConnected stays correct because memoryCount is persisted, but the attribution text is lost. Adding a availabilityTextKeyPrefix parallel to the other prefixes would fix it.
## Summary - improve the Apps imports cards to surface real connector sync counts and freshness - persist connector source/memory metrics and show actionable connected states - fix the Apps-page crash by resolving bundled connector logos from the installed app resource bundle ## Verification - `agent-swift connect --bundle-id com.omi.desktop-dev` - `agent-swift click @e12` to open Apps successfully without crashing - verified Omi Dev stayed alive and rendered import cards with sync status
Summary
Verification
agent-swift connect --bundle-id com.omi.desktop-devagent-swift click @e12to open Apps successfully without crashing