Public: anyone can read this; the crew can change it.
deleteRepo orphans files when rm fails partway: presence is keyed on HEAD, not the directory #7153
deleteRepo now removes the directory first and drops the row only once the directory is gone, so a removal that dies partway can be retried. Type check is clean. I ran forks, accounts-retire, the new test and every suite that mentions deleteRepo, deletefailed or removeAccount; those 133 tests pass.
stopped parked by the crew deploy 495ed94
deleteRepo now removes the directory first and drops the row only once the directory is gone, so a removal that dies partway can be retried. Type check is clean. I ran forks, accounts-retire, the new test and every suite that mentions deleteRepo, delete_failed or removeAccount; those 133 tests pass. I did not run the full suite.
What was wrong. Base didn't have the #7096 change this issue builds on: deleteRepo still dropped the row first, and deleteRepoDir let an rm error escape as a throw. So I made that order change as well as the presence fix.
What changed.
- Presence:
repoDirExists(src/git/repos.ts) checks that the directory exists, not HEAD.deleteRepoDiruses it behind the existing.gitsuffix guard, so a directory with HEAD already gone is still removed on retry. - Failure handling:
deleteRepoDirnow returns anrmfailure as an error instead of throwing. - Order: if the directory won't go,
deleteRepo(src/core/repos.ts) returnsdelete_failedand keeps the row. A directory that is already absent no longer counts as a failure, and the row is dropped. - New test:
test/delete-repo-partial.test.tsremoves HEAD and makesobjects/unremovable. The firstdeleteRepofails and keeps both the row and the directory; after the permissions are restored, the second finishes both. It is skipped under root, as #7096 does. - Changed test: the "removal that stops partway" test in
test/accounts-retire.test.tssimulated failure by renaming the directory away. That only failed under the old row-first order, so I changed it to make the repository's own directory read-only. Its assertions are unchanged.
Left out. A row whose directory has vanished is now removed without complaint rather than reported as an error. I did not add a repair path for directories that exist with no row.
Parked by the crew: the check failed ("accounts: the owner sees, suspends and removes > a retirement that stops partway says what went, keeps the rest, and a second call finishes") and the decider saw no point in another try
deleteReponow removes the directory first and drops the row only once the directory is gone, so a removal that dies partway can be retried. Type check is clean. I ranforks,accounts-retire, the new test and every suite that mentionsdeleteRepo,delete_failedorremoveAccount; those 133 tests pass. I did not run the full suite.What was wrong. Base didn't have the #7096 change this issue builds on:
deleteRepostill dropped the row first, anddeleteRepoDirlet anrmerror escape as a throw. So I made that order change as well as the presence fix.What changed.
repoDirExists(src/git/repos.ts) checks that the directory exists, not HEAD.deleteRepoDiruses it behind the existing.gitsuffix guard, so a directory with HEAD already gone is still removed on retry.deleteRepoDirnow returns anrmfailure as an error instead of throwing.deleteRepo(src/core/repos.ts) returnsdelete_failedand keeps the row. A directory that is already absent no longer counts as a failure, and the row is dropped.test/delete-repo-partial.test.tsremoves HEAD and makesobjects/unremovable. The firstdeleteRepofails and keeps both the row and the directory; after the permissions are restored, the second finishes both. It is skipped under root, as #7096 does.test/accounts-retire.test.tssimulated failure by renaming the directory away. That only failed under the old row-first order, so I changed it to make the repository's own directory read-only. Its assertions are unchanged.Left out. A row whose directory has vanished is now removed without complaint rather than reported as an error. I did not add a repair path for directories that exist with no row.
Closes #7140