Browse Source

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
pull/188/head
Matthew Raymer 2 weeks ago
parent
commit
eb4ddaba50
  1. 17
      doc/activeDid-migration-plan.md
  2. 2
      playwright.config-local.ts
  3. 6
      src/utils/PlatformServiceMixin.ts

17
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 ### Phase 2: API Layer Updates ❌ INCOMPLETE
- [x] Implement `$getActiveIdentity()` method (exists but wrong return type) - [x] Implement `$getActiveIdentity()` method (exists but wrong return type)
- [x] Fix `$getActiveIdentity()` return type to match documented interface - [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 - [ ] 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 ### Phase 3: Component Updates ❌ BLOCKED
- [ ] Update 35+ components to use `$getActiveIdentity()` - [ ] 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 - **Evidence**: `src/utils/PlatformServiceMixin.ts:555` - Method updated with correct return type
- **Status**: Ready for use in component updates - **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 - **Time**: 2025-08-31T03:34Z
- **Evidence**: `src/utils/PlatformServiceMixin.ts:817` - Method still uses legacy pattern - **Evidence**: `src/utils/PlatformServiceMixin.ts:817` - Method now calls $getActiveIdentity and combines results
- **Hypothesis**: Components will continue using old activeDid from settings - **Status**: Maintains backward compatibility while using new API
- **Next probe**: Update $accountSettings to call $getActiveIdentity and combine results
- ❌ **$updateActiveDid() not implemented** with dual-write pattern - ❌ **$updateActiveDid() not implemented** with dual-write pattern
- **Time**: 2025-08-31T03:34Z - **Time**: 2025-08-31T03:34Z
@ -395,14 +394,14 @@ async function rollbackActiveDidMigration(): Promise<boolean> {
| Task | Exit Criteria | Priority | | Task | Exit Criteria | Priority |
|------|---------------|----------| |------|---------------|----------|
| **Fix $getActiveIdentity() return type** | Method returns `{ activeDid: string }` as documented | ✅ COMPLETE | | **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 | | **Implement $updateActiveDid() dual-write** | Method updates both active_identity and settings tables | 🔴 HIGH |
| **Start application in browser** | Application loads and initializes IndexedDB database | 🟡 MEDIUM | | **Start application in browser** | Application loads and initializes IndexedDB database | 🟡 MEDIUM |
| **Inspect IndexedDB via DevTools** | Verify active_identity table exists and contains data | 🟡 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 | | **Update first component** | One component successfully uses new API pattern | 🟢 LOW |
| **Systematic component updates** | All 35 components use 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 ## Future Improvement: MASTER_SETTINGS_KEY Elimination
@ -435,7 +434,7 @@ async function rollbackActiveDidMigration(): Promise<boolean> {
- **Sign-off checklist**: - **Sign-off checklist**:
- [ ] Migration script integrated with existing MIGRATIONS array - [ ] Migration script integrated with existing MIGRATIONS array
- [x] $getActiveIdentity() method returns correct type - [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 - [ ] $updateActiveDid() method implements dual-write pattern
- [ ] All 35+ components updated to use new API - [ ] All 35+ components updated to use new API
- [ ] Rollback procedures validated - [ ] Rollback procedures validated

2
playwright.config-local.ts

@ -21,7 +21,7 @@ export default defineConfig({
/* Retry on CI only */ /* Retry on CI only */
retries: process.env.CI ? 2 : 0, retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */ /* Opt out of parallel tests on CI. */
workers: 1, workers: 4,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [ reporter: [
['list'], ['list'],

6
src/utils/PlatformServiceMixin.ts

@ -836,8 +836,10 @@ export const PlatformServiceMixin = {
return defaults; return defaults;
} }
// Determine which DID to use // Determine which DID to use - try new active_identity table first, fallback to settings
const targetDid = did || defaultSettings.activeDid; const activeIdentity = await this.$getActiveIdentity();
const targetDid =
did || activeIdentity.activeDid || defaultSettings.activeDid;
// If no target DID, return default settings // If no target DID, return default settings
if (!targetDid) { if (!targetDid) {

Loading…
Cancel
Save