Skip to content

Code review fixes: race conditions, stale state, dead code#6

Merged
sohamM97 merged 8 commits intomainfrom
code-review
Feb 16, 2026
Merged

Code review fixes: race conditions, stale state, dead code#6
sohamM97 merged 8 commits intomainfrom
code-review

Conversation

@sohamM97
Copy link
Owner

Summary

  • Fix DB singleton race condition — concurrent callers now share the same init future instead of racing to create separate connections
  • Route Today's 5 mutations through TaskProvider — all DB writes go through the provider so the All Tasks tab stays in sync
  • Fix deleteTask crash on _currentParent + fix shared _previousLastWorkedAt corruption across tasks
  • Add Task.copyWith() — replaces 8 fragile manual reconstructions in TaskProvider (-142 lines)
  • Enable PRAGMA foreign_keys = ON, guard overlay removal, fix biased random selection
  • Extract shared card colors and displayUrl utility, remove dead indicatorStyle code

Test plan

  • All 208 tests pass (flutter test)
  • Linux build succeeds
  • Test on Android device (release build)

🤖 Generated with Claude Code

Soham Marik and others added 8 commits February 15, 2026 18:17
Critical:
- Fix DB singleton race condition (store Future<Database> not Database?)
- Route Today's 5 mutations through TaskProvider (not direct DB access)
- Fix deleteTask crash when called on _currentParent
- Fix _previousLastWorkedAt shared state corruption across tasks

Important:
- Enable PRAGMA foreign_keys = ON
- Add Task.copyWith() replacing 8 fragile manual reconstructions
- Guard completion animation overlay removal (check mounted)
- Fix biased "Go Deeper" selection to use pickWeightedN
- Extract shared card colors to lib/theme/app_colors.dart

Minor:
- Extract displayUrl to shared utility
- Remove dead indicatorStyle code and branches
- Fix _todayKey() date format (zero-padded)
- Assert on invalid repeat intervals

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts:
#	.gitignore
#	lib/widgets/task_card.dart
…fect

- CR-1: Remove dead indicatorStyle branches (compile error from merge)
- CR-2: Add completeTaskOnly() so Today's 5 doesn't alter All Tasks nav
- CR-3: _workedOn undo now restores isStarted state
- CR-4: Leaf detail undo passes correct restoreTo timestamp
- M8: getRootTaskIds uses lightweight ID-only query

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The plugin_marketplaces + plugins approach was crashing (exit code 1,
148ms, 0 cost). Switched to the official prompt-based pattern from
claude-code-action docs. Also fixed pull-requests permission to write.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
API credit balance issue; removing until needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sohamM97 sohamM97 merged commit 81a0b8b into main Feb 16, 2026
1 check passed
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.

1 participant