Use local time for local-backup snapshot folder names - #14911
Open
patjackson52 wants to merge 1 commit into
Open
patjackson52 wants to merge 1 commit into
patjackson52 wants to merge 1 commit into
Conversation
Snapshot directories were stamped in UTC, so a backup taken at 11:55 local appeared as signal-backup-2026-08-03-18-55-33. Android's v1 backups name and parse in device-local time, as do iOS local backups, making this the only place in the app that stamps a filename in UTC. Name new snapshots in local time, and stop deriving ordering from names altogether: directories written before this change carry UTC names, and a single parse rule cannot tell the two generations apart, so a mixed directory could order an older snapshot ahead of a newer one by the local UTC offset -- affecting both retention and the dates shown when picking a backup to restore. listSnapshots() now uses the directory's last-modified time, falling back to the parsed name only when no modified time is reported. Fixes signalapp#14866
patjackson52
force-pushed
the
local-backup-folder-local-time
branch
from
August 3, 2026 19:30
b188a8c to
c9230e2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First time contributor checklist
Contributor checklist
playStagingSpinner) — on-device backup run against this branch and againstmainArchiveFileSystemTest, 14/14Fixes #1234syntaxDescription
Fixes #14866.
Snapshot directories for on-device backups are stamped in UTC, so a backup taken at 11:55 local shows up as
signal-backup-2026-08-03-18-55-33. The reporter noticed this is a change from the v1.backupfiles, which used local time.This appears to be the only place in the app that stamps a filename in UTC. Android's v1 backups both write and parse in device-local time (
LocalBackupJob/LocalBackupJobApi29, andBackupUtil.getBackupTimestamp, none of which set an explicit zone), and iOS's local backups do the same —LocalFileBackupManager.Constants.dateFormattersets notimeZone, so it usesTimeZone.current. That's what led me to read v2's UTC as unintentional. If it was deliberate, I'm happy to close this and instead look at displaying local time wherever these names surface to users — just say the word.Two changes:
createSnapshot()names new snapshots in the device's local time zone.listSnapshots()no longer derives ordering from names. Directories written before this change carry UTC names, and nothing in a name distinguishes the two generations, so parsing a mixed directory with one rule orders an older snapshot ahead of a newer one by the local UTC offset. That ordering drivesdeleteOldBackups()retention, andRestoreLocalBackupViewModelrendersSnapshotInfo.timestampas the date label when picking a backup to restore, so a legacy directory written at 8pm local would also display under the following day's date. It now uses the directory's last-modified time, falling back to the parsed name only when a provider reports no modified time.Renaming in either direction has the mixed-generation problem, which is why ordering moves off names rather than trying to parse both formats.
Testing
Built this branch and
mainonto a Pixel 10 Pro and ran an on-device backup with each, ~9 minutes apart in America/Los_Angeles:That pair is also what the new ordering test reconstructs: a mixed UTC/local directory asserting the newer snapshot sorts first, which fails without the
listSnapshots()change. Also added a round-trip test pinned to a non-UTC zone (fails if either the write or parse side alone reverts to UTC) and a test for the name-parsing fallback.ArchiveFileSystemTestpasses 14/14.Unrelated observation
iOS writes
signal-backups-<date>(plural) while Android writessignal-backup-<date>(singular), and the iOS doc comment documents the singular form. Android's prefix filter matches both by accident. Not touching it here, but flagging it in case local backup directories are meant to be portable between platforms.