Skip to content

fix: cache the ids of the SyftBox folders a new account creates - #9601

Merged
koenvanderveen merged 1 commit into
devfrom
koen/cache-created-folder-ids
Oct 30, 2026
Merged

koenvanderveen merged 1 commit into
devfrom
koen/cache-created-folder-ids

Conversation

@koenvanderveen

Copy link
Copy Markdown
Collaborator

Summary

When a new account logs in, syft creates /SyftBox and the personal folder /SyftBox/{version}#{email}, but it didn't cache their ids. Later lookups searched Drive again. Now the id is cached when the folder is created, the same way the archive folder already does it.

Changes

  • get_syftbox_folder_id and get_personal_syftbox_folder_id cache the id whether they find the folder or create it.
  • The personal-folder search moves into get_personal_syftbox_folder_id_from_drive, to match get_syftbox_folder_id_from_drive.

Drive calls on a new account:

Before After
Login 3 searches 2 searches
First personal-folder lookup after login 1 search 0

Before this change, /SyftBox was only cached by accident: creating the personal folder searched for /SyftBox a second time. On real Drive, a search right after a create can miss the new folder because Drive's search index lags. That could create a second /SyftBox, and a second personal folder makes the next login fail with "Found 2 compatible folders". Caching the created id avoids that second search. I haven't seen this happen; it's a possibility, not an observed bug.

Testing

  • New unit test: test_login_on_new_account_searches_each_folder_once counts Drive calls during login on a new mock account. It fails without the fix (4 searches) and passes with it (2).
  • Unit, syft-rds, syft-datasets, syft-enclave, syft-job, migrations and mock-mode integration suites pass. Pre-commit is clean.

Asana task

get_syftbox_folder_id and get_personal_syftbox_folder_id cached a folder's
id only when they found it on Drive, not when they created it. On a new
account, login therefore searched for /SyftBox twice, and the first lookup
of the personal folder after login searched Drive again.
@koenvanderveen
koenvanderveen merged commit 6b4d943 into dev Oct 30, 2026
21 checks passed
@koenvanderveen
koenvanderveen deleted the koen/cache-created-folder-ids branch October 30, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant