Skip to content

feat(storage): implement user-scoped data storage#66

Merged
ParkerM2 merged 1 commit intomasterfrom
feature/user-scoped-storage
Feb 22, 2026
Merged

feat(storage): implement user-scoped data storage#66
ParkerM2 merged 1 commit intomasterfrom
feature/user-scoped-storage

Conversation

@ParkerM2
Copy link
Owner

@ParkerM2 ParkerM2 commented Feb 22, 2026

Summary

Implements user-scoped data storage to isolate user data by Hub account, enabling multi-user support on shared machines.

Key Changes

  • User Session Manager: New UserSessionManager service tracks current logged-in user and notifies services when user changes
  • User Data Resolver: New UserDataResolver determines the correct data directory based on authentication state
  • Reinitializable Services: Services implement reinitialize(newDataDir) pattern to reload data when user changes
  • Data Migration: UserDataMigrator handles migration of existing global data to user-scoped directories

Services Updated

All 12 data-storing services now support user-scoped storage:

  • AlertStore, HistoryStore, BriefingService, ChangelogService
  • DashboardService, FitnessService, IdeasService, MilestonesService
  • NotesService, PlannerService, TaskService, ProjectService

Data Flow

Login -> UserSessionManager.setCurrentUser() -> emits 'auth.session-changed'
                                                      |
                                            ServiceRegistry listens
                                                      |
                                        UserDataResolver.resolveUserDataDir()
                                                      |
                                      service.reinitialize(newDataDir) for each

Verification

  • All 248 unit tests pass
  • All 156 integration tests pass
  • Build succeeds
  • Lint passes (0 errors)
  • TypeScript passes (0 errors)
  • Documentation updated

Plan Reference

See docs/features/user-scoped-storage/plan.md for full implementation plan.

Isolate user data (notes, captures, briefings, etc.) per logged-in Hub account:

- Add UserSessionManager to track login/logout and emit session change events
- Add UserDataResolver to compute user-scoped paths (users/{userId}/)
- Add UserDataMigrator to copy existing data on first login
- Add ReinitializableService interface for user-scoped services
- Update 10 services to implement reinitialize/clearState pattern:
  notes, dashboard, briefing, assistant-history, alerts, ideas,
  planner, fitness, milestones, changelog
- Wire service-registry to reinitialize services on session change
- Update auth handlers to trigger session changes on login/logout/restore
- Add useSessionEvents hook to clear React Query cache on session change
- Update ARCHITECTURE.md with user-scoped storage documentation

Global data (settings, hub-config, oauth-tokens) remains at root.
User data lives in {appData}/adc/users/{userId}/.

Closes user data isolation issue where different Hub accounts
would see each other's local data.
@ParkerM2 ParkerM2 force-pushed the feature/user-scoped-storage branch from 8df71a9 to a908ed8 Compare February 22, 2026 21:36
@ParkerM2 ParkerM2 merged commit 342c814 into master Feb 22, 2026
8 checks passed
@ParkerM2 ParkerM2 deleted the feature/user-scoped-storage branch February 22, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants