Repository navigation
fix(installations): report expired folder approval separately from write failure (#742) - #794
Conversation
…ite failure (#742) Add Installation previously reported any ENSURE_PATH_EXISTS failure as a write permission error. When the player picks an external folder with Browse and waits more than ten minutes before submitting, the path approval TTL expires and assertManagedPath refuses with an unauthorized path rather than an OS filesystem failure. Update ENSURE_PATH_EXISTS to return a result object with a failure reason ("unauthorized-path" vs "failed"). In Add Installation, notify the player to pick the folder again when authorization expired, matching the behavior in Look for a VS Version.
Translation statusen-US is the source and carries 958 keys.
The links open the strings Weblate marks Needs editing for each language: the machine drafts made before Weblate, plus any string whose English changed since it was translated. See #496. |
Pixnop
left a comment
There was a problem hiding this comment.
I reviewed 42fb8529 against dev adab6b96: ran your new tests against dev's code, followed every caller of the new ENSURE_PATH_EXISTS shape, and put the #742 handler test through a mutation.
The split is where #742 needs it. The first assertManagedPath refusal used to be swallowed into false, and Add Installation turned every false into the write-permission message. Since #411 that field only changes through Browse, so in practice that first refusal is the expired pick. Every caller moved to the new type: AddInstallation, the ensure branch of useOpenPathInExplorer, the packaged e2e, the mock window API and the DOM tests. translation-status.md matches the generator. On dev's code the 6 changed handler tests and both DOM tests fail, and on this head the three touched test files pass, 144 tests.
Approving. Notes 1 and 2 are worth taking here, since note 1 is a message this PR makes untrue and note 2 removes a string translators would otherwise have to do twice. The rest can wait.
Not blocking
-
A symbolic link refusal now reads as an expired pick. The second
catch(pathsHandlers.ts:403) maps everyTypeErrortounauthorized-path, and that includes the strictassertManagedPathrefusing a link among the existing ancestors (validation.ts:237/242). Scenario: the player's Installations folder is a link to another drive, and they keep the suggested<Installations>/My-New-Installation. The first check passes withallowSymlinks,statfinds nothing, the strict check throws, and Add Installation says the ten minutes are up, although nothing was picked. Picking again changes nothing, so the player gets that message every time. On dev it was the vaguer write-permission message, which was at least not false. The updated test "refuses to create a folder through the link" now pinsunauthorized-path. I'd keepunauthorized-pathfor the first refusal only, and let anything in the second block returnfailed(or a reason of its own if you want a dedicated message). Themessage.includes("Symbolic links are not allowed")arm then goes too. It never decided anything anyway, since both symlink refusals are alreadyTypeErrors. -
The new string already exists.
features.installations.pickFolderAgainis word for wordfeatures.versions.pickFolderAgain, which ru-RU has already translated. With a second key, ru-RU goes from 0 to 1 missing and the other eleven locales get one more string to do. Pointing AddInstallation at the existing key, or moving it to a shared one, avoids that. It also takes this PR out of the locale files, which matters for merge order: #793 also adds a key and regeneratestranslation-status.md, and whichever of the two lands second leaves the page at 958 keys where there are 959, unless it is regenerated after the rebase. -
The #742 handler test doesn't show the approval ever applied. With
registerUserSelectedPaths([picked])removed, "returns unauthorized-path when user folder approval has expired (#742)" still passes, because nothing grants that folder anyway. CallingENSURE_PATH_EXISTSonpickeditself and asserting{ ok: true }before moving the clock makes it hold. I tried it, and it passes. A child ofpickedwould not do:pickeddoesn't exist when it is registered, so the approval covers that one path only.vi.useRealTimers()also sits after the assertion, so a failure leavesDatefaked for the rest of the file. Atry/finallyfixes that. -
Add VS Version has the same problem. A folder outside the configured ones, picked on Add VS Version and left more than ten minutes before Install, fails in
DOWNLOAD_ON_PATH's strictassertManagedPath. That comes back asdownload-failed, and the player is told to check their connection. That is outside #742, so it can be its own issue. -
Two stale comments. In
pathsHandlers.ts:386-389the "Only a directory counts as present" paragraph still says the plain-file case "lands on false", and it now sits above the first check while thestat/ensureDirit describes moved to the secondtry. InpathsHandlers.test.ts:467the comment you rewrote still says AddInstallation's folder field is free text, which hasn't been true since #411 (the field isreadOnly).
|
I reviewed Round oneA link refusal no longer claims the ten minutes are up. Only the first, relaxed The duplicate string is gone. AddInstallation uses The #742 handler test now proves the approval applied. It asserts Thanks for opening #807 for the Add VS Version case. Both stale comments are fixed and now match the code. The translation table the bot posted on this PR is from the old head and still says 958 keys. It no longer refreshes because the PR left the locale files. The page in the repository is right. Still approved. |
Summary
When adding an Installation with an external folder selected via Browse, waiting more than ten minutes before clicking Add caused the notification:
"Couldn't create the folder for this Installation. Check that RiftLauncher can write to that location, then try again."
In that scenario, filesystem permissions are fine; the user approval in isUserApprovedPath expired past its 10-minute TTL. ENSURE_PATH_EXISTS previously returned a boolean, swallowing the assertManagedPath refusal and grouping it with generic creation errors.
This change:
Type
Checklist
Testing
Ran all 5 local gate commands:
Related issues
Fixes #742