Skip to content

Commit e1761e4

Browse files
committed
keep member_profile populated (drop the clear)
1 parent cac01f2 commit e1761e4

2 files changed

Lines changed: 29 additions & 18 deletions

File tree

ConvosCore/Sources/ConvosCore/Messaging/MessagingService.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,6 @@ final class MessagingService: MessagingServiceProtocol, @unchecked Sendable {
204204
selfProfileStore: selfProfileStore,
205205
selfInboxId: selfInboxId
206206
).run()
207-
// Android parity: once the canonical stores are seeded, clear the
208-
// legacy `member_profile` rows. Identity now lives in `profile` /
209-
// `profileAvatar` (others) and `selfProfile` / `DBMyProfile`
210-
// (self); nothing reads identity from `member_profile` anymore.
211-
// The table is kept (inert), not dropped, matching Android.
212-
try await databaseWriter.write { db in
213-
_ = try DBMemberProfile.deleteAll(db)
214-
}
215207
} catch {
216208
Log.error("Profile backfill failed: \(error)")
217209
}

docs/plans/2026-06-29-profile-table-implementation.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -727,16 +727,35 @@ What shipped:
727727
removed `myProfileWriter()` from the messaging/state-manager protocols + DI.
728728
`ProfilesRepository` + its publish methods are now `public`. Kept
729729
`MyGlobalProfileWriter` / `DBMyProfile` as the global edit-side model.
730-
- [done] `member_profile` clear-and-keep (matches Android, which never actually
731-
dropped its equivalent): `MessagingService.startProfileServices` `deleteAll`s
732-
`member_profile` after the backfill seeds. The table is kept but inert - no
733-
identity reader remains, so residual writes just create unread rows. A physical
734-
`DROP TABLE` is deferred as a trivial future migration.
735-
736-
Known residual: a member whose identity exists only in group appData (never sent
737-
a ProfileUpdate/Snapshot) is gap-filled into the now-inert `member_profile`
738-
(`ConversationWriter`) rather than the canonical tables, so it would not render.
739-
Rare; the message-sourced path (the common case) reaches canonical.
730+
- [done] `member_profile` is left fully populated. The `deleteAll`-after-backfill
731+
clear was removed after PR review: several live subsystems still read
732+
`DBMemberProfile` (see "remaining migration work"), so clearing (or dropping)
733+
the table is not yet safe. `member_profile` is simply no longer the *rendering*
734+
identity source; the un-migrated subsystems keep working off it unchanged.
735+
736+
### Remaining migration work (before any member_profile clear/drop)
737+
738+
The rendering choke point was migrated to the canonical tables, but these live
739+
paths still read/write `DBMemberProfile` and must move to `DBProfile` /
740+
`DBProfileAvatar` before `member_profile` can be cleared or dropped:
741+
742+
Readers:
743+
- `ContactSyncCoordinator.syncConversation` - builds contact snapshots per member.
744+
- `AssetRenewalURLCollector.collectRenewableAssets` - enumerates avatar assets.
745+
- `AgentTimezonePublisher.republishTimezoneForAgentConversations` - finds the
746+
user's conversations.
747+
- `AgentBuilderConnectionGrantReplayer.verifiedAgentInboxIds` - filters verified
748+
agents (an agent reverified only in `DBProfile` is invisible here).
749+
750+
Write paths (populate `DBMemberProfile` but not canonical, so identity from these
751+
alone renders as "Somebody"):
752+
- `InviteJoinRequestsManager` - joiner profile via `ContactsWriter` mirror.
753+
- `ConversationWriter.persist` appData gap-fill.
754+
755+
Ordering: `IncomingMessageWriter.bootstrapSenderProfile` reads `DBProfile`, but in
756+
`BatchCatchUp` message persist runs before `ProfileInboundApplier` (detached), so
757+
a verified agent's grant request can be dropped on cold-launch backlog replay.
758+
Needs the canonical write to land before the gate is checked.
740759

741760
---
742761

0 commit comments

Comments
 (0)