2.6.1 #19

Merged
rune merged 7 commits from 2.6.1 into main 2026-11-26 12:24:21 +01:00
Owner

Easier update functionality.

Easier update functionality.
Extends the existing settings-only iCloud backup with a separate, opt-in
chat backup: all saved conversations and folders, zipped, then encrypted
as an opaque AES-256-GCM blob (key derived via PBKDF2-HMAC-SHA256,
310,000 iterations, random salt per backup) -- deliberately not a
standard password-protected zip, since ZipCrypto (the only encryption
`zip -e` supports) is cryptographically broken.

- ChatBackupService: export/import pipeline, 2-slot retention (never
  delete-then-write -- stage the new file, confirm it, then rotate
  current->previous before promoting staged->current), and a
  change-detection fingerprint (conversation count + max updatedAt) so
  scheduled automatic backups skip the work entirely when nothing
  changed. Manual "Back Up Chats Now" always runs regardless.
- Password is Keychain-backed (SettingsService.chatBackupPassword,
  mirrors the existing syncPassword pattern) and reused automatically at
  backup time -- a deliberate tradeoff, since chats already sit as
  plaintext on disk and unattended scheduled backups need it without
  re-prompting.
- DatabaseService.insertFolderIfAbsent: new method preserving a folder's
  own id (createFolder always mints a fresh one), needed so restored
  nested folders keep their original parentId references and so
  restoring the same backup twice doesn't duplicate folders. Restore is
  conservative: a folder or conversation whose id already exists locally
  is left untouched, never overwritten.
- Settings UI: new "Chat Backup (Encrypted)" section in the Backup tab,
  its own opt-in toggle (independent of the plain settings backup),
  password set/change flow, and Back Up Chats Now / Restore Chats from
  File… actions. Restore prompts for the password via a small sheet
  (not Keychain-backed there, since the password may have changed or
  never been entered on the machine doing the restore).
- Known limitation, not fixed here: Message has no persisted attachments
  column at all (confirmed by reading the schema) -- attachments were
  never saved with a conversation in the first place, so there's nothing
  for this backup to include; UI text says so plainly.
- i18n for all new strings across all 6 shipped languages.
- Tests: crypto round-trip (correct + wrong password, empty data, salt
  randomization), fingerprint equality/serialization, retention
  move-ordering, and folder-id-preserving insert (incl. idempotent
  re-insert and parentId preservation).

Verified: CommonCrypto imports and works in this target (confirmed
empirically, not assumed). String(localized:) does NOT support the
`^[...](inflect: true)` markdown plural syntax used elsewhere via
LocalizedStringKey/Text -- confirmed empirically before shipping a
message that would have shown literal markdown to users; rephrased to
avoid needing pluralization instead. Clean Debug + Release builds (zero
warnings, not just zero errors) and full test suite green.
saveConversation(id:...) always stamped both dates as "now", which is
right for a brand-new conversation but wrong for restoring a historical
one from a chat backup -- every restored conversation would silently lose
its real dates and show up as created/updated at restore time instead.

Added optional createdAt/updatedAt params (default Date(), so the only
other caller -- the plain name:messages: convenience wrapper used for
normal new-conversation saves -- is unaffected) and wired
ChatBackupService.importChats to pass the original payload's dates
through. Added a regression test; caught and fixed an unrelated bug in
the test itself along the way (a message's own default "now" timestamp
was masking the fix, since listConversations() deliberately reports a
conversation's effective updatedAt as its last message's timestamp, not
just the row's own column -- pre-existing, correct behavior, not touched).
The on-disk Application Support folder, DB, and Keychain service names all
deliberately stay "oAI" forever per the original 2026-08 rename decision
(zero migration risk to credentials/identity) -- but the iCloud Drive
backup folder is different: it's a plain Finder-visible directory a user
actually sees, holding everyday documents, not anything load-bearing for
decryption. Worth matching the app's real name, with a one-time migration
(new BackupPaths.swift) so an existing "oAI" folder's contents move over
rather than getting silently orphaned. Scope stays narrow to this one
folder.

Also switched both restore buttons (settings + chat) from SwiftUI's
.fileImporter to NSOpenPanel directly, matching the existing "Add
Folder..." button's own pattern in this file -- grepped SwiftUI.swiftin
terface directly and confirmed none of fileImporter's three overloads
expose a way to set an initial directory, so there was no way to default
the picker to the backup folder without this change. Matches Rune's
request after noticing the restore picker made him navigate there by
hand.

Migration logic covered by BackupPathsTests against a throwaway temp
directory, never the real iCloud path.
Brings the settings-only backup in line with the chat backup's existing
skip-if-unchanged behavior, for consistency rather than any real cost
concern -- the settings export itself is tiny either way. A canonical
sorted "key=value" fingerprint of exactly what gets backed up (shared
with the real export via filteredSettingsForBackup(), so the two can't
drift apart) is compared before a scheduled run; manual "Back Up Now"
still always runs, same as before.
Empty channel, no items yet -- sign-and-publish-appcast.sh (gitignored,
matches build-dmg.sh's convention) will print a ready-to-paste <item>
block per release going forward. Hosted at https://dl.confab.no/appcast.xml
via a new route on the existing confab-dl-server (deployed, verified).
Part of the self-update plan; Xcode/Swift-side integration still needs
Rune's one-time Sparkle key generation + SPM package addition first.
Adds Sparkle 2.8.1 (SPM, exact-pinned -- "Up to Next Major" from 2.10.1
failed to resolve against this Xcode beta's SwiftPM resolver, 2.8.1
resolves cleanly) as the real "Install and Restart" mechanism, replacing
the old UpdateCheckService flow that only detected an update and opened
the releases page in a browser.

- oAIApp.swift: SPUStandardUpdaterController (startingUpdater: true,
  userDriverDelegate: nil -- Sparkle's own standard alert/progress UI,
  no custom UI needed), Help menu rewired to call
  updaterController.updater.checkForUpdates()
- Info.plist: SUFeedURL (https://dl.confab.no/appcast.xml),
  SUPublicEDKey (real key, from Rune's one-time generate_keys run --
  private key lives only in his Keychain), SUEnableAutomaticChecks,
  SUScheduledCheckInterval
- UpdateCheckService trimmed to release-notes fetch/cache only --
  checkForUpdates()/checkForUpdatesManually()/performCheck()/isNewer()/
  openReleasesPage()/updateAvailable/latestVersion/downloadURL/
  isCheckingManually/manualCheckMessage all removed, Sparkle owns this now
- ContentView's custom "Software Update" alert and FooterView's
  UpdateBadge both removed -- Sparkle's own standard alert is the sole
  "update available" surface now, avoids double-prompting

Every Sparkle touchpoint is #if os(macOS)-guarded (this target's
SUPPORTED_PLATFORMS spans iOS/visionOS too, confirmed in project.pbxproj).
Verified: Debug + Release builds clean (zero warnings), full test suite
green, SUPublicEDKey confirmed present in the built app's actual
Info.plist via PlistBuddy (not just "build succeeded").

Still needed before a real release: generate-and-publish a signed appcast
entry via sign-and-publish-appcast.sh, and a local dry-run test (Rune's
job, never an agent) before pointing this at production.
rune merged commit 6da33b83f3 into main 2026-11-26 12:24:21 +01:00
Sign in to join this conversation.
No reviewers
No labels
user-feedback
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
rune/oai-swift!19
No description provided.