Repository navigation
refactor(transport): implement the connections on Drive - #9564
Merged
Merged
Conversation
… router through them Add DriveP2PConnection (sending), DriveOwnerStore, DriveCollections, DrivePeering and a DriveWatcherStore placeholder over GDriveConnection, and route ConnectionRouter through them; it no longer imports Drive code. Receiving stays on the Drive methods until send-and-forget. Fix: the event log is read oldest first, so restoring from it keeps the newest version of a file that changed twice.
pjwerneck
approved these changes
Oct 19, 2026
pjwerneck
left a comment
Collaborator
There was a problem hiding this comment.
Only minor issues. Looks good.
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
Second part of step 1 of the V1 transport split, built on #9561.
ConnectionRouterstops callingGDriveConnectiondirectly and goes through the connections from #9561, implemented on Drive. What is read from and written to Drive does not change, apart from one fix to the order the event log is read in.Changes
syft/sync/connections/drive/drive_connections.py:DriveP2PConnection,DriveOwnerStore,DriveCollections,DrivePeeringandDriveWatcherStore, anddrive_transport()to build them. Each calls theGDriveConnectionmethod used today. Where a contract builds a method from simpler ones, the Drive class overrides it to keep the one Drive call it makes today.DriveP2PConnectiononly sends for now: a proposed change goes to the owner's inbox, file events to the scientist's outbox, with the file name asmsg_id, and the result isDELIVERED. Reading and archiving messages stay on theGDriveConnectionmethods. Doing them throughreceiveandackchanges how they behave (one rule for both folders, delete on ack, no read cursor), which lands with send-and-forget.receiveandackraiseNotImplementedError.DriveWatcherStoreraisesNotImplementedErroruntil watcher storage on Drive is built.connection_router.py:p2p.send.owner_store.peering.collections.Transportbuilt fromconnections[0], andcopy_connectioncallsclone_for_thread()instead of checkingisinstance(GDriveConnection). It imports nothing from Drive.base_connection.py: two hooks,as_transport()andclone_for_thread().gdrive_transport.py:PEERS_META_KEY,SYFT_PEERS_VERSIONand the message timestamp parser fromnaming.py, so there is one copy (they still import from here);peer_manager.py:load_peerstakes the peer's platform from the transport instead of creatingGdriveFilesPlatform().owner_get_all_accepted_event_file_ids,owner_download_all_raw_events_from_syftboxanddownload_raw_events_since_timestampnow sort by message time.Testing
tests/unit/test_drive_connections.py(20 tests): each Drive connection on the mock Drive; both router sends go throughp2pwith the right kind; the router keeps its transport until its connection changes; the router source holds no Drive code; restoring from the event log keeps the newest version of a file changed twice. The restore test and the ordering test fail without the fix.tests/unit/test_peers_json_version.py: the fake router gives a transport instead ofconnection_for_send_message; the assertions are unchanged.test_dataset_multicopy_delivery.pyfail on macOS, ondevas well (/tmpagainst/private/tmp).Asana task
https://app.asana.com/1/1185126988600652/project/1210542925864934/task/1219496828587148