refactor(vector-sync): address round-1 review nits
- ProvisionSignal.wait() re-arms in a finally so a cancelled wait (shutdown racing the doorbell) leaves a fresh unset event, not a stale set-but-consumed one; preserves the no-await-before-swap lost-wakeup guarantee. - Hoist user_manager_task's _wake_on helper out of the while loop (one object, not one per iteration). - Test: assert ProvisionSignal via its public wait() contract instead of the private _event attribute. - Add test_provision_app_password_wakes_user_manager covering the api/passwords.py wake path (previously only LFv2 web + MCP tool were tested). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
d8e3e9bc33
commit
3f09453926
@@ -203,11 +203,13 @@ def test_notify_user_provisioned_noop_without_manager(mocker):
|
||||
app_module.notify_user_provisioned()
|
||||
|
||||
|
||||
def test_notify_user_provisioned_rings_when_present(mocker):
|
||||
async def test_notify_user_provisioned_rings_when_present(mocker):
|
||||
"""When a manager is running, the helper rings its signal."""
|
||||
import nextcloud_mcp_server.app as app_module
|
||||
|
||||
signal = ProvisionSignal()
|
||||
mocker.patch.object(app_module._vector_sync_state, "provision_signal", signal)
|
||||
app_module.notify_user_provisioned()
|
||||
assert signal._event.is_set()
|
||||
# Public contract: after a ring, the next wait() returns without blocking.
|
||||
with anyio.fail_after(1):
|
||||
await signal.wait()
|
||||
|
||||
Reference in New Issue
Block a user