Skip to content

Sign-out ejects the account's drives, signs it out in every folder and tidies the Drives list - #105

Merged
owenisas merged 4 commits into
mainfrom
fix/signout-unmounts-drives
Nov 29, 2026
Merged

owenisas merged 4 commits into
mainfrom
fix/signout-unmounts-drives

Conversation

@owenisas

Copy link
Copy Markdown
Collaborator

On Thomas's Mac (ParaAir build 92, alpha 14), signing out of team@parafield.ai in Storage Settings and signing in as thomas@parafield.ai caused four problems:

  • /Volumes/ParaOS stayed mounted. CloudAccountModel.signOut only marked the selected folder's account signed out and removed its Keychain item.
  • The Drives list kept "ParaOS (team@…) · Needs sign-in · Sign In Again…", and there was no way to remove it. Remove from List… is hidden for a mounted drive.
  • Thomas's drive couldn't take /Volumes/ParaOS and mounted at /Volumes/ParaAir Cloud instead.
  • setup-status still reported team@'s drive as mounted and healthy. It also reported a second folder sharing the same sign-in (ParaOS-B) as signedIn.

The owner asked for this to be fixed and cleaned up.

What changes

  • Eject before signing out. Sign-out ejects every mounted drive of the account, in every folder the app knows, before the account record changes (MenuModel.ejectDrives(ofAccount:)). Nothing is forced closed. If a drive has files open, the account stays signed in and Storage Settings says: "“ParaOS” is in use, so you’re still signed in. Close the files open on it, then sign out again." Those folders also stop waiting for a login mount or Connect, so nothing reconnects them during sign-out.
  • Signed out in every folder. The new CloudAccountStore.markSignedOut(_:binding:) marks each other folder's copy of the same sign-in (same id and binding) as signed out. The vault isn't touched; the shared Keychain item is already gone. This means setup-status no longer reports a signed-out account as signed in in a second folder.
  • The Drives list tidies itself. After a sign-out, other folders of that account leave the list once their drives are unmounted and nothing in them waits to upload (SignedOutFolders.idle). The folder the app leaves when another account signs in is removed the same way (adoptStateRoot). A folder holding any other kind of drive, or one with files still waiting to upload, stays listed. State folders are kept, and Choose State Folder… brings one back. Once a drive is unmounted, Remove from List… is offered again as before.
  • README: added the sign-out behaviour, and that signing out in one folder ejects and signs out both.

Checks

  • swift test --filter Cloud: 178 tests pass (4 skipped), including the new testMarkSignedOutUpdatesSharedCopiesOnly.
  • scripts/build-juicefs.sh and scripts/build-app.sh build in a fresh worktree.
  • scripts/render-ui-snapshots.sh passes, including the new checkSignOutDrives:
    • a busy drive keeps the account signed in and is named;
    • a clear sign-out signs out both folders and tells the app;
    • the rules for which folders may leave the list.
  • Not run: a real sign-out on a Mac with mounted drives. Per standing rules, the app wasn't launched here. That needs a release-review run, like Thomas's steps above.

Copilot AI balanced review requested due to automatic review settings November 29, 2026 05:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical sign-out flaws can leave drives mounted after credential removal, eject another account’s drive, and leave shared folders incorrectly signed in or blocked after reauthentication.

6 open issues
What changed in this PR

This PR extends account sign-out across shared state folders, aiming to release mounted drives and remove idle signed-out folders from the Drives list while preserving local state.

Changes:

  • Ejects account drives before sign-out and reports drives that cannot be ejected.
  • Propagates signed-out state to matching accounts in known folders and adds list-cleanup rules.
  • Adds shared-account and UI checks, plus documentation of the new behavior.
File Description
Tests/​StreamDriveCoreTests/​CloudAccountStoreTests.swift Tests matching shared-account sign-out updates.
Sources/​StreamDriveCore/​Cloud/​CloudAccountStore.swift Adds sign-out marking without modifying the vault.
README.md Documents ejection, shared sign-out, and list cleanup.
macOS/​Tests/​UISnapshots.swift Checks busy-drive handling, propagation, and folder cleanup rules.
macOS/​App/​StreamDriveApp.swift Coordinates drive ejection and removal of idle signed-out folders.
macOS/​App/​CloudAccountModel.swift Integrates ejection and shared-record updates into sign-out.
macOS/​App/​CloudAccountDeletion.swift Adds eligibility checks for signed-out folder cleanup.
macOS/​App/​AppUpdater.swift Generalizes the ejection failure log message.

Review effort: Balanced

Comment thread macOS/App/CloudAccountModel.swift Resolved
Comment thread macOS/App/CloudAccountModel.swift Resolved
Comment thread macOS/App/StreamDriveApp.swift Resolved
Comment thread macOS/App/StreamDriveApp.swift Resolved
Comment thread macOS/App/CloudAccountModel.swift Resolved
Comment thread macOS/App/CloudAccountModel.swift Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread macOS/App/CloudAccountModel.swift Resolved
Comment thread macOS/App/CloudAccountModel.swift Resolved
Comment thread macOS/App/CloudAccountModel.swift Resolved
Comment thread macOS/App/StreamDriveApp.swift Resolved
…d tidies the Drives list

On Thomas's Mac (build 92), signing out of one account left its drive mounted at
/Volumes/ParaOS: the Drives list kept it as "Needs sign-in" with no way to
remove it, the next account's drive mounted under another name, and
setup-status still reported the account signed in, in a second folder sharing
its sign-in.

- Sign-out now ejects every mounted drive of the account, in every folder the
  app knows, before the record changes. A drive with files open isn't forced:
  the account stays signed in and Storage Settings names the drive to close
  files on.
- CloudAccountStore.markSignedOut: the account is marked signed out in every
  other folder holding a copy of the same sign-in (same id and binding), so
  setup-status stops reporting it signed in there.
- Other folders of that account leave the Drives list once their drives are
  unmounted and nothing in them waits to upload (SignedOutFolders.idle), and so
  does the folder the app leaves when another account signs in. State folders
  stay; Choose State Folder... brings one back.
- Checks: CloudAccountStoreTests (markSignedOut) and UISnapshots
  checkSignOutDrives (busy drive keeps the sign-in, both folders signed out, the
  app is told, which folders may leave the list).
…drives by state folder

Review fixes:
- The copies follow whenever the selected record says signed out, including when
  removing the Keychain item fails (the error is still shown).
- Signing in again restores copies a sign-out marked signed out
  (CloudAccountCopies.restore, through share, which checks the vault).
- Mounts of the account's drives are refused while sign-out runs; one already
  connecting is waited for (30 s), the selected drive's Finder setup is
  cancelled, and the gate lifts when sign-out ends either way (signOutFinished).
- Drives to eject are found by the state folder they were mounted from
  (ParaAirVolumes.mountedByStateRoot), not a saved mount point another account's
  drive may now use; the Drives-list tidy uses the same.
- Cloud Drives folders the app hasn't learned (connect --new-state-folder) are
  included (CloudDriveSetup.ownedCloudDriveFolders).
- Copy updates that fail are retried once, then reported in Storage Settings
  instead of passing silently (CloudAccountCopies.Outcome.failed).
…onnect them, portable folder check

- Copies are restored only once sign-in is complete: on the existing-drive path
  or after a drive choice succeeds (a cancelled choice removes the tokens), and
  awaited before the account counts as signed in, so no sign-out can overlap it.
- Restored folders that mount at login are queued again and renewed
  (MenuModel.requeueRestoredDrives), so pending uploads resume.
- Remove from List decides "mounted" by the folder a mount came from, as
  sign-out's eject does; a mount source may be a file URL or a plain path, and a
  source naming no folder falls back to the saved mount point.
- CloudDriveSetup.ownedCloudDriveFolders uses PlatformFS (builds on Windows);
  its test runs on macOS only (Cloud Drives follows LOCALAPPDATA/XDG elsewhere).
@owenisas
owenisas force-pushed the fix/signout-unmounts-drives branch from 7b287de to 3fbd9fb Compare November 29, 2026 06:49
@owenisas
owenisas requested a balanced review from Copilot November 29, 2026 06:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved restoration races can mark account copies signed in after sign-out removes tokens, while unreadable profiles can leave shared drives mounted after credentials are removed.

4 open issues
4 resolved since last review

Review effort: Balanced

Comment thread macOS/App/CloudAccountModel.swift Resolved
Comment thread macOS/App/StreamDriveApp.swift Resolved
Comment thread macOS/App/StreamDriveApp.swift Resolved
…rofiles, no stray locks, cleanup vs restore

- restoreCopies keeps the model busy throughout (sign-out waits for it), even
  when the sign-in is cancelled meanwhile.
- Eject also looks at Cloud Drives folders the CLI made; a folder whose profile
  can't be read but holds this account's record has its mounts found by the
  folder they came from.
- markSignedOut checks for the record before taking the lock, so folders that
  never held the account get no cloud-accounts folder or lock file.
- A Drives-list cleanup is dropped if a sign-in restored folders meanwhile, and
  each folder is checked again on the main actor right before removal.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because mount detection and overlapping account operations can leave retained folders incorrectly signed out or pending uploads blocked.

No open issues 🎉

4 resolved since last review

Review effort: Balanced

@owenisas
owenisas merged commit 8c54aa8 into main Nov 29, 2026
7 checks passed
@owenisas
owenisas deleted the fix/signout-unmounts-drives branch November 29, 2026 07:20
parafieldai pushed a commit that referenced this pull request Nov 29, 2026
**Merge only after release 462150473 (tag `v0.1.0-alpha.15`) is
published.** Until then the feed would point at an archive that doesn't
exist yet.

- `site/appcast.xml`: a new first item for ParaAir 0.1.0 alpha 15 (build
96, minimum macOS 26.0).
- Its enclosure is
`https://github.com/parafieldai/ParaAir/releases/download/v0.1.0-alpha.15/ParaAir-0.1.0-alpha.15.zip`:
length 50350442, SHA-256
`ecc52382a3fee2bd88bf694e9842cd12e30b969b0d13b17448385eb10f21d00b`, with
the archive's EdDSA signature.
- The whole feed was re-signed with the `paraair` key by
`scripts/make-appcast.py`. `make-appcast.py --check` passes: 12 items,
newest build 96.
- `index.html`, `pricing.html`, `get-started.html`: the Mac download
buttons and labels now point at `v0.1.0-alpha.15`
(`scripts/update-site-release.py` with the DMG, 56 MB). The Windows
download links (`data-win-download`) still point at alpha 14, because
this release has no Windows assets.
- `scripts/check-site.py site` and `node scripts/check-signup.mjs` pass.

App changes in alpha 15:
- #105: signing out ejects the account's drives,
signs the account out in every folder, and tidies the Drives list.
- #104: the shared core is now portable for Windows.
No change in how the Mac app works.

The extension identity is unchanged since alpha 14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants