Files
noteflow/docs/sprints/phase-ongoing/.archive/sprint-gap-013-client-code-consolidation/FILE_INVENTORY.md
Travis Vasceannie 0a18f2d23d chore: update linting artifacts
- Updated basedpyright linting results (705 files analyzed, analysis time reduced from 22.928s to 13.105s).
- Updated biome linting artifact with warning about unnecessary hook dependency (preferencesVersion) in MeetingDetail.tsx.
2026-01-08 21:45:05 -05:00

13 KiB

SPRINT-GAP-013: File Inventory & Pattern Locations

This document provides a detailed inventory of files affected by each consolidation pattern.


1. Silent Failure Locations

Empty Catch Blocks

File Lines Pattern Current Behavior
client/src/contexts/workspace-context.tsx 22-26 readStoredWorkspaceId() Returns undefined on error
client/src/contexts/workspace-context.tsx 30-35 persistWorkspaceId() Comment: "Ignore storage failures"
client/src/contexts/project-context.tsx 13-15 readStoredProjectId() Returns undefined on error
client/src/contexts/project-context.tsx 21-23 persistProjectId() Silent empty catch
client/src/contexts/storage.ts 9-18 clearStoredProjectIds() Comment: "Ignore storage failures"
client/src/contexts/storage.ts 25-30 clearStoredWorkspaceId() Comment: "Ignore storage failures"
client/src/lib/preferences.ts 75-82 emitValidationEvent() Comment: "Silently ignore listener errors"
client/src/lib/preferences.ts 413-416 savePreferences() Comment: "Storage save failed - non-critical"
client/src/lib/preferences.ts 427-438 setServerAddressOverride() Comment: "Non-critical; override remains best-effort"
client/src/lib/cache/meeting-cache.ts 43-50 emitCacheEvent() Comment: "Silently ignore listener errors"
client/src/lib/cache/meeting-cache.ts 89-92 saveCache() Comment: "Ignore cache write failures"
client/src/lib/client-logs.ts (implicit) Storage operations Silent error handling
client/src/lib/preferences-sync.ts 118-123 decodeServerPreferences() Comment: "Ignore bad values"
client/src/api/reconnection.ts 54-61 Server info fetch Comment: "continue without version check"
client/src/api/reconnection.ts 64-68 Integration revalidation Comment: "events are emitted by revalidateIntegrations"
client/src/api/reconnection.ts 72-76 Reconnection callbacks Comment: "continue with remaining callbacks"
client/src/api/index.ts 59-61 startTauriEventBridge() Comment: "non-critical, continue without bridge"
client/src/api/cached/base.ts 32-34 startTauriEventBridge() Comment: "non-critical"
client/src/pages/Recording.tsx 359-368 Stream state check Comment: "continue anyway, Rust has timeout protection"
client/src/pages/Recording.tsx 432-434 Nested connection try No comment, pure silent fail
client/src/pages/Meetings.tsx 68-69 listMeetings() Comment: "Error swallowed intentionally"
client/src/hooks/use-panel-preferences.ts 105-128 localStorage load/save Similar pattern
client/src/hooks/use-meeting-reminders.ts 41-54, 56-62, 64-93 Multiple localStorage ops Similar pattern

Fire-and-Forget Operations

File Line Expression
client/src/api/reconnection.ts 110 void syncStateAfterReconnect()
client/src/api/reconnection.ts 124 void attemptReconnect()
client/src/api/reconnection.ts 129 void attemptReconnect()
client/src/api/reconnection.ts 145 void attemptReconnect()

2. localStorage Pattern Locations

Files with Load/Save Pattern

File Storage Key Default Value Validator
client/src/lib/preferences.ts noteflow_preferences DEFAULT_PREFERENCES Yes
client/src/lib/preferences-sync.ts noteflow_preferences_sync_meta {} No
client/src/lib/client-logs.ts noteflow_client_logs [] No
client/src/lib/cache/meeting-cache.ts noteflow_meeting_cache {} Yes
client/src/hooks/use-panel-preferences.ts noteflow_panel_preferences DEFAULT_PANEL_PREFERENCES Yes
client/src/hooks/use-meeting-reminders.ts noteflow_reminder_settings DEFAULT_SETTINGS Yes
client/src/hooks/use-meeting-reminders.ts noteflow_notified_meetings {} No
client/src/contexts/workspace-context.tsx noteflow_active_workspace undefined No
client/src/contexts/project-context.tsx noteflow_active_project_* undefined No
client/src/pages/settings/settings-helpers.ts noteflow_settings_tab 'status' No

3. Event Emitter Pattern Locations

File Emitter Variable Event Type Subscribe Function
client/src/lib/preferences.ts validationListeners Validation events subscribeToValidationEvents()
client/src/lib/preferences-sync.ts metaListeners Sync metadata subscribeSyncMeta()
client/src/lib/client-logs.ts listeners Log entries subscribeClientLogs()
client/src/lib/cache/meeting-cache.ts cacheListeners Cache events subscribeToCacheEvents()

4. Async State Pattern Locations

Hooks with status/error/data Pattern

File State Shape Fetch Function
client/src/hooks/use-webhooks.ts { status, webhooks, error } fetchWebhooks()
client/src/hooks/use-calendar-sync.ts { status, events, error } fetchEvents()
client/src/hooks/use-entity-extraction.ts { status, entities, error } extract()
client/src/hooks/use-oidc-providers.ts { status, providers, error } fetchProviders()
client/src/hooks/use-project-members.ts { members, isLoading, error } loadMembers()
client/src/hooks/use-cloud-consent.ts { isGranted, isLoading, error } checkConsent()

5. OAuth Flow Duplication

use-oauth-flow.ts vs use-auth-flow.ts

Pattern use-oauth-flow.ts use-auth-flow.ts Identical?
extractOAuthCallback() Lines 46-62 Lines 44-61 95%
Deep link listener setup Lines 72-91 Lines 71-90 98%
CSRF state validation Lines 101-119 Lines 100-119 100%
initiateFlow() pattern Lines 162-241 Lines 172-228 85%
Error handling Throughout Throughout 90%

Key Differences

Aspect use-oauth-flow.ts use-auth-flow.ts
URL pattern noteflow://oauth/callback `noteflow://(auth
API call api.initiateCalendarOAuth() api.initiateOidcLogin()
Callback handler api.handleCalendarCallback() api.handleOidcCallback()

6. Polling Pattern Locations

use-diarization.ts

Variable Line Purpose
currentPollIntervalRef ~114 Current interval
POLL_BACKOFF_MULTIPLIER constant 1.5x backoff
MAX_POLL_INTERVAL_MS constant Maximum interval
retryCountRef ~118 Retry counter
RETRY_BACKOFF_MULTIPLIER constant 2x retry backoff
MAX_POLL_DURATION_MS constant Timeout duration

use-integration-sync.ts

Variable Line Purpose
SYNC_POLL_INTERVAL_MS constant Polling interval
SYNC_TIMEOUT_MS constant Timeout duration
performSync() ~111-160 Polling loop

7. Inline Date Formatting Locations

File Line Current Code Context
client/src/pages/Recording.tsx 377 new Date().toLocaleString() Meeting title default
client/src/pages/MeetingDetail.tsx 123 .toLocaleString() Date display
client/src/api/mock-adapter.ts 714 toLocaleDateString() Mock data
client/src/api/mock-adapter.ts 1114 toLocaleString() Mock data
client/src/api/mock-adapter.ts 1310 toLocaleString() Mock data
client/src/components/integration-config-panel.tsx 797 toLocaleString() Last sync display
client/src/components/settings/provider-config-card.tsx 211 toLocaleString() Test result display
client/src/components/settings/integrations-section.tsx 615 toLocaleString() Last sync display

8. Component Pattern Locations

Dialog State Pattern

File State Variables Handler Functions
client/src/components/entity-management-panel.tsx isDialogOpen, formData handleClose()
client/src/components/webhook-settings-panel.tsx isDialogOpen, editingWebhook handleClose()
client/src/components/projects/ProjectMembersPanel.tsx isDialogOpen, newMemberEmail handleClose()
client/src/components/projects/ProjectList.tsx isDialogOpen, newProjectName handleClose()

Loading Button Pattern

File Lines Trigger
client/src/components/settings/provider-config-card.tsx ~80-96 isTesting
client/src/components/integration-config-panel.tsx Various isTesting, isSaving
client/src/components/calendar-connection-panel.tsx Various isConnecting
client/src/components/settings/ai-config-section.tsx Various Multiple loading states
client/src/components/webhook-settings-panel.tsx Various isTesting

Icon Circle Pattern

File Lines Description
client/src/components/stats-card.tsx 36-37 Stats icon container
client/src/components/recording/idle-state.tsx 10-11 Idle state icon
client/src/components/settings/ai-config-section.tsx 289-291 Section header icon
client/src/components/calendar-connection-panel.tsx 113-114 Calendar icon

Confirmation Dialog Pattern

File AlertDialog Usage
client/src/components/simulation-confirmation-dialog.tsx Simulation start
client/src/components/webhook-settings-panel.tsx Webhook delete
client/src/components/sync-history-log.tsx Clear history

9. ai-config-section.tsx Duplication Analysis

Current State Breakdown (278 lines)

Lines Content Duplication
28-38 3 config states 3x identical pattern
39-44 3 fetching states 3x identical pattern
45-50 3 testing states 3x identical pattern
51-80 createProviderChangeHandler factory 3-way if/else
81-110 createBaseUrlChangeHandler factory 3-way if/else
111-140 createApiKeyChangeHandler factory 3-way if/else
141-170 createModelChangeHandler factory 3-way if/else
171-200 createFetchHandler factory 3-way if/else
201-230 createTestHandler factory 3-way if/else
231-278 3x ProviderConfigCard renders 3x identical calls

Target Refactor

// Define config types
type ConfigType = 'transcription' | 'summary' | 'embedding';

// Single state object
const [configs, setConfigs] = useState<Record<ConfigType, ConfigState>>({...});

// Single update function
const updateConfig = (type: ConfigType, updates: Partial<ConfigState>) => {...};

// Map over types for rendering
{(['transcription', 'summary', 'embedding'] as const).map((type) => (
  <ProviderConfigCard key={type} {...buildProps(type)} />
))}

10. Underutilized Utilities

lib/object-utils.ts (2 imports)

Function Purpose Potential Uses
getNestedValue() Get value at path Integration config access
setNestedValue() Set value at path Form state updates
hasNestedValue() Check path exists Validation

lib/integration-utils.ts (2 imports)

Function Purpose Potential Uses
getIntegrationIcon() Get icon for type All integration lists
hasRequiredIntegrationFields() Validate fields Toggle handlers, sync validation

lib/format.ts (17 imports, but formatDate only 2)

Function Usage Count Should Be Used More
formatTime() 15+ No, good coverage
formatDuration() 10+ No, good coverage
formatDate() 2 YES - 6+ inline uses
formatRelativeTime() 8+ No, good coverage

11. Rust Code Locations

crypto/mod.rs Issue

Line Code Risk
293 Ok(self.crypto.get().expect("just set")) Could panic

Acceptable Silent Patterns

File Line Pattern Assessment
commands/summary.rs 22, 36 let _ = app.emit(...) OK - event emission
commands/recording/audio.rs 78 let _ = audio_tx.blocking_send(...) OK - capture loop
commands/preferences.rs 84 let _ = persist_preferences_to_disk(...) OK - non-critical
commands/apps_platform.rs Various .ok() for optional values OK - platform-specific