Technical Debt — Mobile Login & Signup Gaps
By Engineering Team•October 10, 2026•4 min read
| Metadata | Details |
|---|---|
| System Name | Mobile Login & Signup — firebase-function + user-secure-engine |
| Document ID | TD-2026-AUTH-001 |
| Author | Engineering Team |
| Status | Open |
TD-21 — user_account_created trigger hardcodes a single-tenant placeholder
- Status: Open
- Severity: Medium
- Affected component:
firebase-function/functions/src/triggers/user_account_created.js - Evidence:
DEFAULT_TENANT_ID = process.env.TENANT_ID || ''is used as the trigger’stenant_idfor every account-creation event, regardless of which tenant the shopper actually signed up under; this is the sole source oftenant_idfor the request-context store built before callingvalidateAndInitUser. - Impact: Harmless today because the deployment is single-tenant, but the moment a second tenant onboards, the trigger’s asynchronous safety-net call (Architecture flow D, step 2) will attempt
init_userunder the wrong tenant scope. In the common case this is masked because the synchronous call insideverify_signup_otp(which does carry the correct per-request tenant) already completes first and the trigger’s call becomes a no-op — but if the synchronous path ever fails and the trigger call becomes the actual provisioning path, it would provision the account under the wrong tenant. - Remediation direction: Firebase v1
onCreatetriggers receive no per-request tenant hint directly; the trigger would need to either read tenant scope off a Firebase custom claim already set beforecreate_user_by_phonereturns, or a documented decision to require this trigger to be deployed per-tenant once multi-tenant signup is supported. - Related requirement: SR-027 NFR-04.
TD-22 — user-secure-engine’s nested user-service CLAUDE.md has drifted stale
- Status: Open
- Severity: Low
- Affected component:
user-secure-engine/src/src/service/user/CLAUDE.md - Evidence:
- Its Status section states the Firebase
onUserCreatedtrigger and the Flutter signup UI are “still open” — both are fully implemented today (firebase-function/functions/src/triggers/user_account_created.js,ui-application’spre_authfeature). - Its description of the
init_userflow statespii_client.upsert_attributes(entity_type = "user", ...)— the actual code (user_svc_impl.rs) usesPII_ENTITY_TYPE = "user_personal". - Its “Open questions” section describes a
first_name/displayNamecapture-and-trigger-race mechanic that does not match the current trigger file, which has nofirst_name/displayNamehandling at all.
- Its Status section states the Firebase
- Impact: Low risk of a direct production incident, but a real risk of a future contributor making a design decision based on an already-resolved “open question” or an incorrect entity-type name, duplicating work already done or introducing a mismatch against
pii-service’s actual schema. - Remediation direction: Update the Status section to reflect both features as implemented, correct the entity-type name to
user_personal, and remove or rewrite the stale open question to match the current trigger’s actual (simpler) behavior. - Related requirement: SR-027 FR-07.
Related Documents
- BRD-026 — Mobile Login & Signup: Phone-Based Identity and Legal Acceptance
- SR-027 — Mobile Login & Signup: System Requirements
- ADR-00041 — Mobile Login & Signup: Phone-OTP, Dual-Path Initialization, and Consent Design
- Architecture — Mobile Login & Signup: Component Topology and Data Flow
- Microservices: user-secure-engine, firebase-function