Repository navigation
fix(upload): keep the stats push off network volumes - #377
Merged
Merged
Conversation
macOS asks "CoDev would like to access files on a network volume" whenever the app or a process it spawns touches a file on a share, and unsigned builds lose the answer on every update. The launch-time stats push read everything it sends from the local session store, but resolved every session's project directory with realpathSync to name it — so one past project on an SMB/NFS share (or under /net or an automounted home) triggered the prompt at every launch. The push now reads the kernel mount table once (`/sbin/mount`, which lists mounts without opening them) and names projects on network filesystems (smbfs, afpfs, nfs, webdav, ftp, autofs) from the path as stored instead of resolving it. Their sessions still count; names only differ when the stored path is a symlink. Mount points under /System/Volumes/Data also match their short aliases (/home). macOS only; elsewhere, or if the mount table can't be read, nothing changes. The manual `codev upload --logs` export still resolves paths, since it is user-initiated and its dedup keys on resolved paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks done
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
macOS users keep getting "CoDev would like to access files on a network volume". Two things combine:
mac-update.ts), so macOS ties the user's answer to that exact build's hash (cdhash H"…"in the TCC database). Every update drops the answer. Signing with a Developer ID is the real fix for that and is out of scope here.readAllSessionStatsnamed each session's project withprojectFolderName, which callsrealpathSync(dir). A single past project on an SMB/NFS share, under/net, or in an automounted home therefore triggered the prompt on every launch, from the desktop sidecar and the CLI'scodev debug statsalike, even with that project closed.The change (all in
packages/codev-upload, which is fork-only, so noDIVERGENCES.mdrow):network-volumes.ts:networkVolumeFilter()reads the kernel mount table once per push (/sbin/mountlists mounts without opening them, about 4 ms here). It treatssmbfs,afpfs,nfs,webdav,ftpandautofsmount points as network paths. Mount points under/System/Volumes/Dataalso match their short aliases, soauto_homecovers/home/…. It's macOS-only; on other platforms, or if the table can't be read, nothing counts as a network path and behavior is unchanged.projectFolderName(dir, { resolve: false })names a directory from its stored path, without touching the filesystem.readAllSessionStats(local store) andreadSessionStatsFromServer(desktop sandboxes) use that for projects on network mounts.collectStatsbuilds the filter once for all sources.codev upload --logsexport is unchanged: it's user-initiated and its dedup keys on resolved paths.The push isn't the only thing that can touch a share. A project open in the sidebar, a sandbox, or a dotfile/PATH entry on a share can also prompt. Those reflect what the user is actively working with, and the prompt they cause only becomes a one-time question once builds are signed.
Related bug found while testing (not fixed here)
openSessionDbopensopencode.dbread-only. SQLite can't open a WAL-mode database read-only when its-wal/-shmside files don't exist, which is the case after every CoDev process has closed it cleanly. The read then fails withSQLITE_CANTOPEN: reproduced on a copy of a real store (fails without the side files, opens once they exist). The launch-time push normally races a running server that has the database open, but a standalonecodev upload(or--logs) with nothing else running would find no sessions. Worth a separate fix.Test plan
bun testinpackages/codev-upload(63 tests; new: mount-table parsing, the macOS filter including the/homealias, local volumes, prefix look-alikes, non-macOS and unreadable-table fallbacks,projectFolderNamewith and without resolving, andreadAllSessionStatsleaving a network project unresolved)bun typecheckinpackages/codev-uploadandpackages/desktop(which bundles it)🤖 Generated with Claude Code