super-productivity/packages/plugin-dev/sync-md/src/background
Johannes Millan f9fd8454cc fix(sync-md): prevent crash when adding subtasks to markdown file directly
Fixes #6021

When users manually added subtasks to markdown files that referenced
non-existent parent tasks, the plugin would crash due to unsafe null
assertions and missing validation. This made the plugin permanently
disabled and required creating a new markdown file to recover.

Changes:
- Added parent ID validation before creating operations
- Orphaned subtasks are now converted to root tasks with warnings
- Added comprehensive error handling with user notifications
- Plugin stays enabled even after sync errors
- Added 15 new tests (689 lines) for orphaned subtask scenarios
- Fixed all existing tests to support new error notifications

The fix implements defense-in-depth:
1. Validation layer: Check parent IDs exist before operations
2. Error handling: Catch and report errors without crashing
3. User feedback: Clear notifications about issues
4. Data preservation: No data loss, orphans become root tasks
2026-01-16 13:28:05 +01:00
..
__tests__ fix(sync-md): prevent crash when adding subtasks to markdown file directly 2026-01-16 13:28:05 +01:00
helper feat(sync-md): general improvements 2025-07-12 14:37:00 +02:00
sync fix(sync-md): prevent crash when adding subtasks to markdown file directly 2026-01-16 13:28:05 +01:00
background.ts cleanup 2025-07-17 09:12:43 +02:00
config.const.ts feat(sync-md): general improvements 2025-07-12 14:37:00 +02:00
local-config.ts feat(syncMd): implement core markdown sync plugin with bidirectional synchronization 2025-07-10 14:55:44 +02:00
ui-bridge.ts fix(sync-md): prevent crash when adding subtasks to markdown file directly 2026-01-16 13:28:05 +01:00