From 0891e6c979dda2da1cb7d9e9a5c63d89ca95a846 Mon Sep 17 00:00:00 2001 From: adlee-was-taken Date: Sat, 11 Apr 2026 00:16:56 -0400 Subject: [PATCH] feat(server): register flow flags accounts from test-seed invites When a user registers with an invite_code whose marks_as_test=TRUE, their users_v2.is_test_account is set to TRUE. Normal invite codes and invite-less signups are unaffected. Co-Authored-By: Claude Opus 4.6 (1M context) --- server/routers/auth.py | 13 +++++++++++++ server/services/auth_service.py | 3 +++ 2 files changed, 16 insertions(+) diff --git a/server/routers/auth.py b/server/routers/auth.py index ccae963..3ecdcef 100644 --- a/server/routers/auth.py +++ b/server/routers/auth.py @@ -245,11 +245,23 @@ async def register( ) # --- Invite code validation --- + is_test_account = False if has_invite: if not _admin_service: raise HTTPException(status_code=503, detail="Admin service not initialized") if not await _admin_service.validate_invite_code(request_body.invite_code): raise HTTPException(status_code=400, detail="Invalid or expired invite code") + # Check if this invite flags new accounts as test accounts + invite_details = await _admin_service.get_invite_code_details(request_body.invite_code) + if invite_details and invite_details.get("marks_as_test"): + is_test_account = True + logger.info( + "test_seed_account_registering", + extra={ + "username": request_body.username, + "invite_code": request_body.invite_code, + }, + ) else: # No invite code — check if open signups are allowed if config.INVITE_ONLY and config.DAILY_OPEN_SIGNUPS == 0: @@ -277,6 +289,7 @@ async def register( username=request_body.username, password=request_body.password, email=request_body.email, + is_test_account=is_test_account, ) if not result.success: diff --git a/server/services/auth_service.py b/server/services/auth_service.py index 6f7b2ac..794b1ba 100644 --- a/server/services/auth_service.py +++ b/server/services/auth_service.py @@ -101,6 +101,7 @@ class AuthService: password: str, email: Optional[str] = None, guest_id: Optional[str] = None, + is_test_account: bool = False, ) -> RegistrationResult: """ Register a new user account. @@ -110,6 +111,7 @@ class AuthService: password: Plain text password. email: Optional email address. guest_id: Guest session ID if converting. + is_test_account: Mark this user as a soak-harness test account. Returns: RegistrationResult with user or error. @@ -151,6 +153,7 @@ class AuthService: guest_id=guest_id, verification_token=verification_token, verification_expires=verification_expires, + is_test_account=is_test_account, ) if not user: