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’s tenant_id for every account-creation event, regardless of which tenant the shopper actually signed up under; this is the sole source of tenant_id for the request-context store built before calling validateAndInitUser.
  • 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_user under the wrong tenant scope. In the common case this is masked because the synchronous call inside verify_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 onCreate triggers receive no per-request tenant hint directly; the trigger would need to either read tenant scope off a Firebase custom claim already set before create_user_by_phone returns, 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 onUserCreated trigger and the Flutter signup UI are “still open” — both are fully implemented today (firebase-function/functions/src/triggers/user_account_created.js, ui-application’s pre_auth feature).
    • Its description of the init_user flow states pii_client.upsert_attributes(entity_type = "user", ...) — the actual code (user_svc_impl.rs) uses PII_ENTITY_TYPE = "user_personal".
    • Its “Open questions” section describes a first_name/displayName capture-and-trigger-race mechanic that does not match the current trigger file, which has no first_name/displayName handling at all.
  • 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.