Problem
When DailyMotivation.ps1 encounters missing or empty popup_config.json, it exits silently with no user-visible feedback (line 125-129). This is documented as "intentional behavior" (GAP-003b) but it masks real initialization failures and leaves users confused.
Symptoms
- Popup never appears
- No error dialogs shown
- User has no idea what went wrong
- Debug log shows "No folder configured in popup_config.json -- exiting silently"
- User thinks app is broken
Current Behavior
# GAP-004: Treat null/empty explorer_path as "never configured" - exit cleanly
# rather than showing the path-missing panel, which implies a folder
# was once set but got moved/deleted.
if (-not $config.explorer_path -or $config.explorer_path -eq "") {
Write-DLog "No folder configured in popup_config.json -- exiting silently" "WARN"
if ($mutexOwned -and $mutex) { try { $mutex.ReleaseMutex() } catch {} }
exit 0
}
Design Intent (per GAP-003b)
The silent exit is meant to distinguish:
- Never configured: User hasn't set up a task yet → exit silently
- Folder moved/deleted: Task was configured but folder is missing → show path-missing panel
This distinction is reasonable, but the implementation has problems:
- Can't distinguish "never configured" from "initialization failed"
- Can't distinguish "user hasn't scheduled anything" from "config file missing due to bug"
- Silent exit during debugging makes problems invisible
Expected Behavior
Different behavior for different contexts:
Context 1: Launched by Task Scheduler
- If config file missing → Show error dialog: "Configuration missing. Please run the main app to reschedule."
- If explorer_path empty → Show error dialog: "Task data corrupted. Please reschedule this folder."
- Log the issue clearly
Context 2: Manual launch (testing)
- Always show error dialog with debug info
- Never exit silently
- Help developer understand what's wrong
Context 3: After successful config load
- If explorer_path is empty → Show path-missing panel (current behavior)
- This is the ONLY case where silent exit makes sense
Proposed Fix
Distinguish different failure modes:
# Check if config file exists
if (-not (Test-Path $configPath)) {
Show-ErrorDialog "Configuration file not found. Please run the Daily Motivation Brain Helper application to schedule a folder." "Configuration Missing"
Write-DLog "Config file missing: $configPath" "ERROR"
exit 1
}
# Load config
$config = Get-PopupConfig
# Check if config is valid
if (-not $config) {
Show-ErrorDialog "Configuration file is corrupted. Please run the application and reschedule your folder." "Configuration Error"
Write-DLog "Config parse failed" "ERROR"
exit 1
}
# Check if task is configured
if (-not $config.explorer_path -or $config.explorer_path -eq "") {
# This is the ONLY case for silent exit - task exists but no path set
# (edge case: task fired but MainApp hasn't written config yet)
Write-DLog "No folder configured yet - task may have fired early" "INFO"
exit 0
}
# Continue with normal flow...
Acceptance Criteria
Files Affected
- src/DailyMotivation.ps1 (lines 104-129)
- src/Modules/ConfigManager.psm1 (may need additional error handling)
Related Issues
Problem
When DailyMotivation.ps1 encounters missing or empty
popup_config.json, it exits silently with no user-visible feedback (line 125-129). This is documented as "intentional behavior" (GAP-003b) but it masks real initialization failures and leaves users confused.Symptoms
Current Behavior
Design Intent (per GAP-003b)
The silent exit is meant to distinguish:
This distinction is reasonable, but the implementation has problems:
Expected Behavior
Different behavior for different contexts:
Context 1: Launched by Task Scheduler
Context 2: Manual launch (testing)
Context 3: After successful config load
Proposed Fix
Distinguish different failure modes:
Acceptance Criteria
Files Affected
Related Issues