[Bug]: appsmithctl restore and backup-failure mail pick the "most recent" backup by directory order, not by time
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- cli
Research direction
Start in app/client/packages/rts/src/ctl/utils.ts at listLocalBackupFiles(), then read restore.ts and mailer.ts to confirm how the final list entry is used. Run the regression test in utils.test.ts with the provided unsorted readdir data; done means backups resolve oldest to newest and the utils, restore, and backup suites pass.
Written by the indexing model from the issue text.
Description
Is there an existing issue for this?
- I have searched the existing issues
Description
appsmithctl restore labels a backup as "Most recent backup" (and the backup-failure mail names a "last successful backup") based on directory order. Directory order isn't chronological.
listLocalBackupFiles()inapp/client/packages/rts/src/ctl/utils.ts:257-275(release @ a6ab36cb26) returns the matching names in rawfs.readdirorder. Its comment says "Ascending order", but nothing sorts them.getBackupFileNameinrestore.ts:55-75marks the last element<--Most recent backup.mailer.ts:38takesbackupFiles.pop()as the last successful backup.
readdir makes no ordering promise. On ext4 (hashed directories), overlayfs and most network filesystems, the order is effectively arbitrary. An admin restoring "the most recent backup" can pick an older archive, and the failure mail can cite the wrong backup.
What I expect is that backups are listed oldest to newest. The timestamped appsmith-backup-<ISO time>.tar.gz[.enc] names sort chronologically, so a plain sort is enough.
Steps To Reproduce
- Put
appsmith-backup-2026-09-24T12-00-00.000Z.tar.gz,...-22T...and...-23T...in the backup directory on a filesystem that returns them in that (non-sorted) order. - Run
appsmithctl restore. The 09-23 archive is marked<--Most recent backup.
Failing unit test (red on release, green with the fix):
jest.spyOn(fsPromises, "readdir").mockImplementation(async () => [
"appsmith-backup-2026-09-24T12-00-00.000Z.tar.gz",
"appsmith-backup-2026-09-22T12-00-00.000Z.tar.gz",
"appsmith-backup-2026-09-23T12-00-00.000Z.tar.gz",
"unrelated.txt",
] as any);
await expect(utils.listLocalBackupFiles()).resolves.toEqual([/* 22, 23, 24 */]);
Proposed approach (a fix with a regression test is ready): return backupFiles.sort(); in listLocalBackupFiles, plus 1 test in utils.test.ts. The utils, restore and backup suites pass (62/62), along with RTS tsc, ESLint and Prettier.
@contributor-support I'd like to take this. Could it be assigned to me? I'll open the PR against release with Fixes #<this> once it's assigned.
Public Sample App
No response
Environment
Release
Severity
Medium (Frustrating UX)
Issue video log
No response
Version
Self Hosted - release @ a6ab36cb26
Prepared with AI assistance (Claude) from the breken-ai account.
- Dominant language
- TypeScript
- Stars
- 40.9k
- Forks
- 4.8k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 56
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from appsmithorg/appsmith
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
appsmithorg/appsmith#42296 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
appsmithorg/appsmith#42295 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
appsmithorg/appsmith#42118 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
appsmithorg/appsmith#42115 · 1 comment ·
Maintainers usually reply within 1 day
-
close-labeler workflow uses break instead of continue, dropping the QA label on multi-issue PRsOpenContributor Expressed Interest
Difficulty 1/5 Under an hour Newbie friendliness 88/100
appsmithorg/appsmith#41983 · 2 comments ·
Maintainers usually reply within 1 day
All issues in appsmithorg/appsmith
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
StabilityNexus/Fate-EVM-Frontend#153 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
code-yeongyu/oh-my-openagent#9039 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Tencent/teamai-cli#862 ·
Maintainers usually reply within 1 day
-
bug good first issue hacktoberfest redis
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
libredb/libredb-studio#1164 ·
Maintainers usually reply within 1 day
-
flake
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day