mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-09 04:40:57 +00:00
fix(cloud): track workspace membership provenance (#2406)
* fix(cloud): converge legacy revision-zero members * fix(cloud): track workspace membership provenance * test(persistence): track current migration head --------- Co-authored-by: Chan <dadachann@users.noreply.github.com>
This commit is contained in:
@@ -99,6 +99,7 @@ async def test_invitation_secret_is_hashed_and_acceptance_is_one_time(collaborat
|
||||
membership = await service.accept_invitation(created.token, account.uuid)
|
||||
assert membership.workspace_uuid == workspace.uuid
|
||||
assert membership.role == 'developer'
|
||||
assert membership.source == 'local'
|
||||
|
||||
with pytest.raises(InvitationUsedError):
|
||||
await service.accept_invitation(created.token, account.uuid)
|
||||
|
||||
@@ -153,6 +153,33 @@ async def test_initial_owner_cannot_be_claimed_by_another_account(workspace_test
|
||||
).all()
|
||||
assert len(owners) == 1
|
||||
assert owners[0].account_uuid == first_account_uuid
|
||||
assert owners[0].source == 'local'
|
||||
|
||||
|
||||
async def test_claim_initial_owner_reclassifies_existing_membership_as_local(workspace_test_context):
|
||||
service, session_factory = workspace_test_context
|
||||
|
||||
async with session_factory() as session:
|
||||
async with session.begin():
|
||||
account_uuid = await _insert_account(session, 'reclaimed@example.com')
|
||||
workspace = await service.ensure_singleton_workspace(session=session)
|
||||
session.add(
|
||||
WorkspaceMembership(
|
||||
uuid='44444444-4444-4444-8444-444444444444',
|
||||
workspace_uuid=workspace.uuid,
|
||||
account_uuid=account_uuid,
|
||||
role='viewer',
|
||||
status='removed',
|
||||
source='cloud_projection',
|
||||
projection_revision=4,
|
||||
)
|
||||
)
|
||||
|
||||
membership = await service.claim_initial_owner(account_uuid)
|
||||
|
||||
assert membership.role == 'owner'
|
||||
assert membership.status == 'active'
|
||||
assert membership.source == 'local'
|
||||
|
||||
|
||||
async def test_execution_binding_returns_persisted_generation(workspace_test_context):
|
||||
|
||||
Reference in New Issue
Block a user