@@ -99,15 +99,12 @@ def test_cloud_bisync_fails_fast_when_sync_entry_disappears(monkeypatch, config_
9999@pytest .mark .parametrize (
100100 "argv" ,
101101 [
102- ["cloud" , "sync" , "--name" , "research" ],
103102 ["cloud" , "bisync" , "--name" , "research" ],
104- ["cloud" , "check" , "--name" , "research" ],
105103 ["cloud" , "bisync-reset" , "research" ],
106- ["cloud" , "sync-setup" , "research" , "/tmp/research" ],
107104 ],
108105)
109- def test_cloud_sync_commands_block_organization_workspace (monkeypatch , argv , config_manager ):
110- """Rclone sync commands should fail before setup/execution for Team workspaces."""
106+ def test_cloud_bisync_commands_block_organization_workspace (monkeypatch , argv , config_manager ):
107+ """Bisync commands should fail before setup/execution for Team workspaces."""
111108 project_sync_command = importlib .import_module ("basic_memory.cli.commands.cloud.project_sync" )
112109
113110 config = config_manager .load_config ()
@@ -130,13 +127,62 @@ def test_cloud_sync_commands_block_organization_workspace(monkeypatch, argv, con
130127 "get_mount_info" ,
131128 lambda : pytest .fail ("workspace guard should run before mount lookup" ),
132129 )
130+ monkeypatch .setattr (
131+ project_sync_command ,
132+ "get_project_bisync_state" ,
133+ lambda _name : pytest .fail ("workspace guard should run before bisync state lookup" ),
134+ )
133135
134136 result = runner .invoke (app , argv )
135137
136138 assert result .exit_code == 1 , result .output
137139 output = " " .join (result .output .split ())
138- assert "Mirror-style rclone sync/bisync is supported only for Personal workspaces" in output
139- assert "overwrite or delete shared cloud files" in output
140+ assert "The bisync operation is only supported on Personal workspaces" in output
141+ assert "Use `bm cloud sync --name research` instead" in output
142+
143+
144+ def test_cloud_sync_allows_organization_workspace (monkeypatch , config_manager ):
145+ """Team workspaces can still use the one-way sync command."""
146+ project_sync_command = importlib .import_module ("basic_memory.cli.commands.cloud.project_sync" )
147+
148+ config = config_manager .load_config ()
149+ config .cloud_api_key = "bmc_test"
150+ config .projects ["research" ] = ProjectEntry (
151+ path = "/tmp/research" ,
152+ mode = ProjectMode .CLOUD ,
153+ workspace_id = "team-tenant" ,
154+ local_sync_path = "/tmp/research" ,
155+ )
156+ config_manager .save_config (config )
157+
158+ monkeypatch .setattr (
159+ project_sync_command ,
160+ "get_available_workspaces" ,
161+ lambda : pytest .fail ("sync should not require a personal workspace" ),
162+ )
163+ monkeypatch .setattr (
164+ project_sync_command ,
165+ "get_mount_info" ,
166+ lambda : _async_value (SimpleNamespace (bucket_name = "tenant-bucket" )),
167+ )
168+ monkeypatch .setattr (
169+ project_sync_command ,
170+ "_get_cloud_project" ,
171+ lambda _name : _async_value (
172+ SimpleNamespace (name = "research" , external_id = "external-project-id" , path = "research" )
173+ ),
174+ )
175+ monkeypatch .setattr (
176+ project_sync_command ,
177+ "_get_sync_project" ,
178+ lambda _name , _config , _project_data : (SimpleNamespace (name = "research" ), "/tmp/research" ),
179+ )
180+ monkeypatch .setattr (project_sync_command , "project_sync" , lambda * args , ** kwargs : True )
181+
182+ result = runner .invoke (app , ["cloud" , "sync" , "--name" , "research" ])
183+
184+ assert result .exit_code == 0 , result .output
185+ assert "research synced successfully" in result .output
140186
141187
142188def test_require_personal_workspace_allows_personal_workspace (monkeypatch , config_manager ):
0 commit comments