From eb4ddaba5028c2e5101d5e7c958240aff808f516 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Sun, 31 Aug 2025 05:18:05 +0000 Subject: [PATCH] feat(migration): complete Step 1 of ActiveDid migration - update () to use new API - Update () to call () with fallback to settings - Maintain backward compatibility while using new active_identity table - Update migration plan documentation to reflect completed Step 1 - Restore Playwright workers to 4 (was accidentally set to 1) Tests: 39/40 passing (1 unrelated UI failure) Migration progress: Step 1 complete, ready for Step 2 dual-write implementation --- doc/activeDid-migration-plan.md | 17 ++++++++--------- playwright.config-local.ts | 2 +- src/utils/PlatformServiceMixin.ts | 6 ++++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/doc/activeDid-migration-plan.md b/doc/activeDid-migration-plan.md index 9dd76bd6..23ca3fa9 100644 --- a/doc/activeDid-migration-plan.md +++ b/doc/activeDid-migration-plan.md @@ -31,10 +31,10 @@ Follow this implementation checklist step-by-step to complete the migration. ### Phase 2: API Layer Updates ❌ INCOMPLETE - [x] Implement `$getActiveIdentity()` method (exists but wrong return type) - [x] Fix `$getActiveIdentity()` return type to match documented interface -- [ ] Update `$accountSettings()` to use new method +- [x] Update `$accountSettings()` to use new method - [ ] Update `$updateActiveDid()` with dual-write pattern -**Status**: Return type fixed. Method now returns `{ activeDid: string }` as documented. Need to update other API methods. +**Status**: $accountSettings() now uses new API. Method combines settings with activeDid from active_identity table. Need to implement dual-write pattern. ### Phase 3: Component Updates ❌ BLOCKED - [ ] Update 35+ components to use `$getActiveIdentity()` @@ -323,11 +323,10 @@ private async initializeSettings() { - **Evidence**: `src/utils/PlatformServiceMixin.ts:555` - Method updated with correct return type - **Status**: Ready for use in component updates -- ❌ **$accountSettings() not updated** to use new $getActiveIdentity() method +- ✅ **$accountSettings() updated** to use new $getActiveIdentity() method - **Time**: 2025-08-31T03:34Z - - **Evidence**: `src/utils/PlatformServiceMixin.ts:817` - Method still uses legacy pattern - - **Hypothesis**: Components will continue using old activeDid from settings - - **Next probe**: Update $accountSettings to call $getActiveIdentity and combine results + - **Evidence**: `src/utils/PlatformServiceMixin.ts:817` - Method now calls $getActiveIdentity and combines results + - **Status**: Maintains backward compatibility while using new API - ❌ **$updateActiveDid() not implemented** with dual-write pattern - **Time**: 2025-08-31T03:34Z @@ -395,14 +394,14 @@ async function rollbackActiveDidMigration(): Promise { | Task | Exit Criteria | Priority | |------|---------------|----------| | **Fix $getActiveIdentity() return type** | Method returns `{ activeDid: string }` as documented | ✅ COMPLETE | -| **Update $accountSettings() method** | Method calls $getActiveIdentity and combines with settings | 🔴 HIGH | +| **Update $accountSettings() method** | Method calls $getActiveIdentity and combines with settings | ✅ COMPLETE | | **Implement $updateActiveDid() dual-write** | Method updates both active_identity and settings tables | 🔴 HIGH | | **Start application in browser** | Application loads and initializes IndexedDB database | 🟡 MEDIUM | | **Inspect IndexedDB via DevTools** | Verify active_identity table exists and contains data | 🟡 MEDIUM | | **Update first component** | One component successfully uses new API pattern | 🟢 LOW | | **Systematic component updates** | All 35 components use new API pattern | 🟢 LOW | -**Critical Blocker**: Need to update $accountSettings() and $updateActiveDid() methods before component updates can proceed. +**Critical Blocker**: Need to implement $updateActiveDid() dual-write pattern before component updates can proceed. ## Future Improvement: MASTER_SETTINGS_KEY Elimination @@ -435,7 +434,7 @@ async function rollbackActiveDidMigration(): Promise { - **Sign-off checklist**: - [ ] Migration script integrated with existing MIGRATIONS array - [x] $getActiveIdentity() method returns correct type - - [ ] $accountSettings() method updated to use new API + - [x] $accountSettings() method updated to use new API - [ ] $updateActiveDid() method implements dual-write pattern - [ ] All 35+ components updated to use new API - [ ] Rollback procedures validated diff --git a/playwright.config-local.ts b/playwright.config-local.ts index 32b7f023..e2d63465 100644 --- a/playwright.config-local.ts +++ b/playwright.config-local.ts @@ -21,7 +21,7 @@ export default defineConfig({ /* Retry on CI only */ retries: process.env.CI ? 2 : 0, /* Opt out of parallel tests on CI. */ - workers: 1, + workers: 4, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: [ ['list'], diff --git a/src/utils/PlatformServiceMixin.ts b/src/utils/PlatformServiceMixin.ts index 5c4d21f4..7cee0ea2 100644 --- a/src/utils/PlatformServiceMixin.ts +++ b/src/utils/PlatformServiceMixin.ts @@ -836,8 +836,10 @@ export const PlatformServiceMixin = { return defaults; } - // Determine which DID to use - const targetDid = did || defaultSettings.activeDid; + // Determine which DID to use - try new active_identity table first, fallback to settings + const activeIdentity = await this.$getActiveIdentity(); + const targetDid = + did || activeIdentity.activeDid || defaultSettings.activeDid; // If no target DID, return default settings if (!targetDid) {