Skip to content

Send Account Tags Feature - Multiple Sendtags per Account #1515

@0xBigBoss

Description

@0xBigBoss

Overview

This feature introduces the ability for users to have multiple sendtags associated with their send account and select a "main" sendtag that is displayed throughout the app.

Branch Information

  • Current branch: send_account_tags_rebased
  • Original branch (pre-rebase): send_account_tags
  • Base branch: dev

Completed Work

✅ Database Schema Updates

  • Created send_account_tags junction table linking send accounts to tags
  • Added send_accounts.main_tag_id column for main tag selection
  • Modified tags table to use numeric IDs as primary keys
  • Created comprehensive migration strategy preserving existing data
  • Added validation triggers for main_tag_id

✅ API Changes

  • Created tag.create endpoint for creating pending tags
  • Created tag.delete endpoint for removing tags from accounts
  • Created sendAccount.updateMainTag endpoint for main tag selection
  • Updated tag.confirm to work with send_account_id

✅ Frontend Updates

  • Account Sendtag Screen displays all user tags with main tag first
  • Profile displays show main tag preferentially
  • Activity feed updated to display main tags
  • Added main_tag_id and main_tag_name to user schemas

✅ Testing Updates

  • Comprehensive test suite updates for new relationships
  • New test files for send_account_tags functionality
  • Updated Playwright E2E tests

Outstanding Issues & TODOs

🔴 Critical Issues

  1. registerFirstSendtag Integration Broken (CRITICAL)

    • Location: packages/api/src/routers/tag/router.ts:130-164
    • Issue: Directly inserts into tags table using user_id, bypassing send_account_tags junction table
    • Impact: First free sendtag created during sign-up/onboarding is not properly linked to send accounts
    • Required Fix: Update to use create_tag RPC function with send_account_id
    • Sign-up flow: packages/app/features/auth/sign-up/screen.tsx:98-111
    • Onboarding flow: packages/app/features/auth/onboarding/screen.tsx:87-100
  2. API Validation Missing in updateMainTag (HIGH)

    • Location: packages/api/src/routers/sendAccount.ts
    • Missing validation to ensure:
      • Tag exists
      • Tag belongs to user's send account
      • Tag is confirmed (not pending)
    • Risk: Users could set main_tag_id to invalid values

🟡 Medium Priority Issues

  1. Database Migration Issues

    • Missing column drop: Migration references dropping referrals.tag column that was never dropped
    • Location: supabase/migrations/20250118103228_update_tag_functions.sql:593
    • Function compatibility: check_tags_allowlist_before_insert_func still assumes direct user_id relationship
  2. Performance - Missing Indexes

    • Tables needing indexes:
      • referrals.tag_id
      • send_accounts.main_tag_id
      • send_account_tags foreign keys

📋 Sub-Issues to Create

  1. Fix registerFirstSendtag to properly integrate with send_account_tags (CRITICAL)
  2. Add validation to updateMainTag endpoint (HIGH)
  3. Fix database migration issues (MEDIUM)
  4. Add missing database indexes (MEDIUM)
  5. Run comprehensive test suite (MEDIUM)

Testing Commands

# Run Supabase tests
cd supabase && yarn supabase test

# Run Playwright tests
cd packages/playwright && yarn playwright test

# Run API tests
cd packages/api && yarn test | cat

Key Benefits

  1. Users can own multiple sendtags under one send account
  2. Users can switch their main tag without losing other tags
  3. Consistent display of user's preferred tag across the app
  4. Architecture supports future features like tag trading or transfers

Breaking Changes

  • Tags now use numeric IDs instead of names as primary keys
  • Tag references throughout codebase updated from name-based to ID-based
  • Some API endpoints have different parameter requirements

Documentation

See send_account_tags_summary.md for detailed implementation notes and code references.

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions