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: trent_larson:master
trent_larson:master
trent_larson:notify-api
trent_larson:16kb-pages
trent_larson:notify-api_android
trent_larson:edit-proj-parent
trent_larson:daily-notification-plugin-integration
trent_larson:2026-01-01-tweaks
trent_larson:no-locks
trent_larson:web-share-target-native-implementation
trent_larson:homeview-gift-recording-improvements
trent_larson:accountview-contact-management-bundling
trent_larson:gifted-dialog-recipient-fix
trent_larson:entitygrid-infinite-scroll-improvements
trent_larson:meeting-project-dialog
trent_larson:refactor-initialize
trent_larson:integrate-notification-plugin
trent_larson:project-representative-dialog
trent_larson:entity-selection-list-component
trent_larson:bulk-members-dialog-refactor
trent_larson:contact-path
trent_larson:entity-selection-list-component-infinite-scroll
trent_larson:meeting-members-admission-dialog
trent_larson:address-duplicates
trent_larson:meeting-members-admission-dialog-refactor
trent_larson:android-file-save
trent_larson:meeting-members-admission-improvements
trent_larson:emojis
trent_larson:meeting-members-set-visibility
trent_larson:ios-disable-zoom
trent_larson:view-headings-refresh
trent_larson:star-projects2
trent_larson:remove-cannot-upload-images-notification
trent_larson:star-projects
trent_larson:notification-system
trent_larson:load-build-mode-env-file
trent_larson:notify-initialization-fix
trent_larson:new-activity-mark-read
trent_larson:active_did_redux
trent_larson:ios-qr-code-copy
trent_larson:master-patch
trent_larson:registration-prompt-parity
trent_larson:seed-phrase-backup-prompt
trent_larson:claimview-fullfills-offer
trent_larson:wip_new_notifications
trent_larson:account-import-duplicate-prevention
trent_larson:electron-copy-paste-keyboard-shortcuts
trent_larson:switching-identities-change-name
trent_larson:playwright-test-00-fix
trent_larson:profile_include_location
trent_larson:electron-build-config-overwrite
trent_larson:projectview-hide-offer-link-unregistered
trent_larson:build-web-serve-test
trent_larson:didview-invalid-did-handling
trent_larson:electron-build-capacitor-config
trent_larson:contact-gifting-current-user
trent_larson:android-safe-area-insets
trent_larson:deep-link-views-safe-area-inset
trent_larson:dialog-notification-z-index
trent_larson:ios-contact-copy
trent_larson:onboard-alert-component
trent_larson:dialog-styles-unified
trent_larson:units-mocking
trent_larson:performance-optimizations-testing
trent_larson:playwright-test-60-fix
trent_larson:notification-section
trent_larson:fix-deep-link
trent_larson:platformservicemixin-interface-consolidation
trent_larson:nearby-filter
trent_larson:replace-iconrenderer
trent_larson:imagemagick-anrdoid
trent_larson:ask-for-contacts-export
trent_larson:offer-validation-logic
trent_larson:playwright-test-updates
trent_larson:logger-level
trent_larson:remove-image-cache
trent_larson:claim-view-error-handling
trent_larson:build-improvement
trent_larson:get-get-hash
trent_larson:logging-upgrade
trent_larson:notification-line-wrapping
trent_larson:build-dev-to-dist
trent_larson:fix-contact-import-export
trent_larson:web-serve-fix
trent_larson:deep-link
trent_larson:web-tests
trent_larson:build-with-env
trent_larson:onboarding-dialog-fix
trent_larson:streamline-attempt
trent_larson:matthew-scratch-2025-06-28
trent_larson:gifting-periphery-improvements
trent_larson:gifting-ui-2025-05
trent_larson:migrate-dexie-to-sqlite
trent_larson:deep-links-android-update
trent_larson:android-15-check
trent_larson:capacitor-local-save
trent_larson:master-settings-upgrade
trent_larson:contacts-view-fixes
trent_larson:ui-fixes-2025-06-w2
trent_larson:home-icon-enhancements
trent_larson:search-map-fix
trent_larson:sql-absurd-sql-further
trent_larson:sql-absurd-sql
trent_larson:new-storage
trent_larson:sql-wa-sqlite
trent_larson:trent-tweaks
trent_larson:qrcode-capacitor
trent_larson:cross-platform-factory-redux
trent_larson:build-ios
trent_larson:ai-context
trent_larson:cross-platform-factory
trent_larson:registration-gate
trent_larson:db-backup-cross-platform
trent_larson:eye-slash
trent_larson:homeview-cleanup-2025-03
trent_larson:fix-service-worker
trent_larson:main
trent_larson:app_id_fix
trent_larson:electron_fix_20250317
trent_larson:homeview-refresh-2025-02
trent_larson:deep_linking
trent_larson:ui-fixes-2025-03
trent_larson:side_step
trent_larson:split_build_process
trent_larson:d9085ced6df7dc7bdcd899959cea6489cab7f8b8
trent_larson:v-onboarding-2024-04
trent_larson:nostr
trent_larson:playwright-pwa-install-test
trent_larson:offer-edit
trent_larson:passkey-cache
trent_larson:passkey
trent_larson:profile-pic
trent_larson:notify-time
trent_larson:ui-fixes-2024-03
trent_larson:photo-reverse
trent_larson:starred-projects
trent_larson:vite-version
trent_larson:design-tweaks-2023-12
trent_larson:sw-cleanup
trent_larson:home-view-notification-improvements
trent_larson:friend-tech-inspired-pwa-dialog
trent_larson:notification-request-permission-dialog
trent_larson:plan-loc
trent_larson:project-gives
trent_larson:tweaks
trent_larson:simple-signer
trent_larson:experimental_plugin
trent_larson: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.
Delete Branch "activedid_migration"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.