feat(db): implement active identity table separation #180
Open
anomalist
wants to merge 24 commits from
activedid_migration into master
pull from: activedid_migration
merge into: :master
:master
:retire-legacy-notification
:notify-api_endpoint-query
:notify-api-sms
:notify-api
:giftopia-app-icon
:fix/ios-share-target-reliability
:thanks-button-rework
:gifted-details-footer
:16kb-pages
:notify-api_android
:edit-proj-parent
:daily-notification-plugin-integration
:2026-01-01-tweaks
:no-locks
:web-share-target-native-implementation
:homeview-gift-recording-improvements
:accountview-contact-management-bundling
:gifted-dialog-recipient-fix
:entitygrid-infinite-scroll-improvements
:meeting-project-dialog
:refactor-initialize
:integrate-notification-plugin
:project-representative-dialog
:entity-selection-list-component
:bulk-members-dialog-refactor
:contact-path
:entity-selection-list-component-infinite-scroll
:meeting-members-admission-dialog
:address-duplicates
:meeting-members-admission-dialog-refactor
:android-file-save
:meeting-members-admission-improvements
:emojis
:meeting-members-set-visibility
:ios-disable-zoom
:view-headings-refresh
:star-projects2
:remove-cannot-upload-images-notification
:star-projects
:notification-system
:load-build-mode-env-file
:notify-initialization-fix
:new-activity-mark-read
:active_did_redux
:ios-qr-code-copy
:master-patch
:registration-prompt-parity
:seed-phrase-backup-prompt
:claimview-fullfills-offer
:wip_new_notifications
:account-import-duplicate-prevention
:electron-copy-paste-keyboard-shortcuts
:switching-identities-change-name
:playwright-test-00-fix
:profile_include_location
:electron-build-config-overwrite
:projectview-hide-offer-link-unregistered
:activedid_migration
:build-web-serve-test
:didview-invalid-did-handling
:electron-build-capacitor-config
:contact-gifting-current-user
:android-safe-area-insets
:deep-link-views-safe-area-inset
:dialog-notification-z-index
:ios-contact-copy
:onboard-alert-component
:dialog-styles-unified
:units-mocking
:performance-optimizations-testing
:playwright-test-60-fix
:notification-section
:fix-deep-link
:platformservicemixin-interface-consolidation
:nearby-filter
:replace-iconrenderer
:imagemagick-anrdoid
:ask-for-contacts-export
:offer-validation-logic
:playwright-test-updates
:logger-level
:remove-image-cache
:claim-view-error-handling
:build-improvement
:get-get-hash
:logging-upgrade
:notification-line-wrapping
:build-dev-to-dist
:fix-contact-import-export
:web-serve-fix
:deep-link
:web-tests
:build-with-env
:onboarding-dialog-fix
:streamline-attempt
:matthew-scratch-2025-06-28
:gifting-periphery-improvements
:gifting-ui-2025-05
:migrate-dexie-to-sqlite
:deep-links-android-update
:android-15-check
:capacitor-local-save
:master-settings-upgrade
:contacts-view-fixes
:ui-fixes-2025-06-w2
:home-icon-enhancements
:search-map-fix
:sql-absurd-sql-further
:sql-absurd-sql
:new-storage
:sql-wa-sqlite
:trent-tweaks
:qrcode-capacitor
:cross-platform-factory-redux
:build-ios
:ai-context
:cross-platform-factory
:registration-gate
:db-backup-cross-platform
:eye-slash
:homeview-cleanup-2025-03
:fix-service-worker
:main
:app_id_fix
:electron_fix_20250317
:homeview-refresh-2025-02
:deep_linking
:ui-fixes-2025-03
:side_step
:split_build_process
:d9085ced6df7dc7bdcd899959cea6489cab7f8b8
:v-onboarding-2024-04
:nostr
:playwright-pwa-install-test
:offer-edit
:passkey-cache
:passkey
:profile-pic
:notify-time
:ui-fixes-2024-03
:photo-reverse
:starred-projects
:vite-version
:design-tweaks-2023-12
:sw-cleanup
:home-view-notification-improvements
:friend-tech-inspired-pwa-dialog
:notification-request-permission-dialog
:plan-loc
:project-gives
:tweaks
:simple-signer
:experimental_plugin
:tmp
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Active Identity Implementation Overview
Author: Matthew Raymer
Date: 2025-08-21T13:40Z
Status: 🚧 IN PROGRESS - Implementation Complete, Testing Pending
Objective
Separate the
activeDidfield from the monolithicsettingstable into adedicated
active_identitytable to achieve:Result
This document provides a comprehensive overview of the implemented Active
Identity table separation system, including architecture, migration strategy,
and component integration.
Use/Run
The implementation is ready for testing. Components can immediately use the new
façade methods while maintaining backward compatibility through dual-write
triggers.
Context & Scope
migrations
integration
identity hierarchies
Artifacts & Links
src/db/tables/activeIdentity.ts,src/utils/PlatformServiceMixin.tssrc/db-sql/migration.ts(migrations 003 & 004)src/config/featureFlags.tsEnvironment & Preconditions
Architecture / Process Overview
The Active Identity separation follows a phased migration pattern with
dual-write triggers to ensure zero downtime and backward compatibility.
Interfaces & Contracts
Database Schema
active_identityscope,active_did,updated_atsettingsid,accountDid,apiServer,activeDidremoved in Phase CService Façade API
$getActiveDid(scope?)scope(default: 'default')Promise<string | null>$setActiveDid(did, scope?)did,scope(default:Promise<void>$switchActiveIdentity(did)didPromise<void>$getActiveIdentityScopes()Promise<string[]>Repro: End-to-End Procedure
1. Database Migration Execution
2. Component Usage
3. Feature Flag Control
What Works (Evidence)
migrationService.tsactive_identitytable schema with proper constraintsand indexes
settings.activeDid→active_identity.active_didWhat Doesn't (Evidence & Hypotheses)
methods
Risks, Limits, Assumptions
Migration Risks
easily reversible
active_identitytable is corrupted
Performance Limits
activeDidchange triggers additionaldatabase operations
consistency
Security Boundaries
ownership
constraints
active_identitytableNext Steps
References
Competence Hooks
downtime while maintaining data consistency through foreign key constraints
and validation
USE_ACTIVE_IDENTITY_ONLY, not testing rollback scenarios, ignoringcross-platform compatibility
and ESLint rules
during the transition phase
Collaboration Hooks
integration, DevOps for deployment strategy
performance validated, rollback plan documented
Assumptions & Limits
'default' scope
vue-facing-decoratorcompatibility (needsvalidation)
execution)
Mobile (Capacitor SQLite)
Implementation Details
Migration 003: Table Creation
Creates the
active_identitytable with:Migration 004: Column Removal
Implements Phase C by:
Service Façade Implementation
The PlatformServiceMixin extension provides:
transition
Feature Flag System
Controls migration phases through:
USE_ACTIVE_IDENTITY_ONLY: Disables legacy fallback readsDROP_SETTINGS_ACTIVEDID: Enables Phase C column removalLOG_ACTIVE_ID_FALLBACK: Logs when legacy fallback is usedENABLE_ACTIVE_IDENTITY_MIGRATION: Master switch for migrationsystem
Security Considerations
Data Validation
Access Control
Audit Trail
Performance Characteristics
Read Operations
active_identitytablesettingstable (Phase A only)Write Operations
Migration Impact
Testing Strategy
Unit Testing
Integration Testing
End-to-End Testing
Deployment Considerations
Rollout Strategy
Rollback Plan
Monitoring
Status: Implementation complete, ready for testing and component migration
Next Review: After initial testing and component updates
Maintainer: Development team
@@ -0,0 +186,4 @@- [Database Migration Guide](../database-migration-guide.md)- [PlatformServiceMixin Documentation](../component-communication-guide.md)- [Feature Flags Configuration](../feature-flags.md)Note that these links point to the parent directory, but I think these would be in this directory.
- Add @capacitor/status-bar dependency for safe area detection - Implement SafeAreaPlugin for Android with proper inset calculation - Create safeAreaInset.js utility for CSS custom property injection - Update Android manifest and build configuration for plugin - Integrate safe area handling across Vue components and views - Update iOS Podfile and Android gradle configurations - Add commitlint and husky for commit message validation Technical changes: - SafeAreaPlugin uses WindowInsets API for Android R+ devices - Fallback detection for navigation bar and gesture bar heights - CSS custom properties: --safe-area-inset-{top,bottom,left,right} - Platform-specific detection (Android WebView only) - StatusBar plugin integration for top inset calculationView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.