feat: add focus duplication and Windows startup polish#66
Conversation
📝 WalkthroughWalkthroughThis PR introduces task-level optional timers persisted to per-focus ChangesTask Timers and AnimalDetail Implementation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Line 9: Update the changelog entry that currently reads "### Added — 052 task
timers and clock dropdown editing (PR `#60`, in flight)" to reference the correct
pull request number `#66`; locate the exact header line text "### Added — 052 task
timers and clock dropdown editing (PR `#60`, in flight)" and replace "PR `#60`" with
"PR `#66`" so it reads "PR `#66`, in flight".
In `@crates/storage/src/focus_store.rs`:
- Around line 232-236: The current delete_task flow mutates focus.md then logs
and continues if remove_task_timer_index(focus_id, index) fails, which can leave
timer indices inconsistent; instead propagate/return the error from
remove_task_timer_index (or perform a compensating rewrite) so the delete_task
operation fails when index cleanup fails. Update the delete_task implementation
to stop treating remove_task_timer_index errors as non-fatal: replace the
log::warn branch with error propagation (e.g., using ? or mapping the error into
delete_task's Error type) or implement an explicit rollback of the focus.md
change before returning the error; ensure references to remove_task_timer_index,
delete_task and focus.md are used to locate the change.
In `@issues/done/052-task-timers-and-clock-dropdown-editing.md`:
- Line 13: The Task type documentation incorrectly documents the timer field as
required; update the description and type notation for Task.timer to indicate
optionality (e.g., change `timer: FocusTimer` to `timer: Option<FocusTimer>` or
the phrase “optional timer field”) so it matches the actual optional behavior;
locate references to Task and FocusTimer in the docs and examples and change
them to the optional form and any explanatory text that assumes the timer is
always present.
In `@src/api/tauriFocusReader.ts`:
- Line 12: The task deserialization in tauriFocusReader drops each task's timer
so task-level FocusTimer objects don't round-trip; update the tasks mapping that
builds Task objects to include the timer property (preserving nullability) by
converting the incoming Rust timer payload into a FocusTimer (or null) and
assigning it to each task.timer; locate the task-deserialization code in
tauriFocusReader (the place that maps/creates tasks from the payload) and wire
the conversion logic (reuse any existing FocusTimer parsing helper or add one)
so timer is not omitted.
In `@src/components/TimerDropdown.tsx`:
- Around line 32-52: The outside-click flow currently calls start() from both
handlePointerDown (capture) and the onBlur handler, causing duplicate commits;
modify the logic so only one path calls start: in handlePointerDown (the capture
listener) set a short-lived flag (e.g., ignoreBlurRef or pointerTriggeredRef)
when you call start(), and in the onBlur handler check that flag and skip
calling start if it's set (clear the flag after a tick or when handling the
blur), or alternatively remove the onBlur start() and rely solely on
handlePointerDown; update references to handlePointerDown, onBlur, start,
rootRef and open accordingly so the outside-click triggers start exactly once.
In `@src/hooks/useFocusController.ts`:
- Around line 30-34: run currently awaits write() without handling rejections so
onWriteFailure(op, outcome) is skipped on error; wrap the write() call in a
try/catch inside run(op: string, write: () => Promise<WriteOutcome>) so that if
write() throws you construct an appropriate failure WriteOutcome (or otherwise
capture the error), call onWriteFailure(op, failureOutcome) and then rethrow the
original error (or return the failure outcome if function callers expect a
resolved WriteOutcome), ensuring onWriteFailure is always invoked for both
resolved-failure and rejected paths.
In `@src/hooks/usePigMovement.ts`:
- Around line 312-314: The Set of expired focus IDs (expiredFocusIds) is being
rebuilt each rAF tick in usePigMovement, causing unnecessary allocations; move
the construction so it runs once whenever focuses changes (e.g., create
expiredFocusIds in an effect or useMemo/useRef updated on focuses) and have the
per-frame tick read that precomputed Set instead of reconstructing it; update
references in the tick callback (the per-frame handler) to use the new
precomputed expiredFocusIds so the hot path avoids iterating/filling the Set
each frame.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 1e652c8a-9f98-4b24-b4cf-c15af9f71498
⛔ Files ignored due to path filters (7)
Cargo.lockis excluded by!**/*.locksrc-tauri/icons/128x128.pngis excluded by!**/*.pngsrc-tauri/icons/128x128@2x.pngis excluded by!**/*.pngsrc-tauri/icons/32x32.pngis excluded by!**/*.pngsrc-tauri/icons/icon.icois excluded by!**/*.icosrc-tauri/icons/icon.pngis excluded by!**/*.pngsrc/types/generated/Task.tsis excluded by!**/generated/**
📒 Files selected for processing (41)
CHANGELOG.mdCONTEXT.mdPRD.mdREADME.mdcrates/commands/src/caps.rscrates/commands/src/focus.rscrates/domain/src/caps.rscrates/domain/src/focus.rscrates/domain/src/parse.rscrates/storage/Cargo.tomlcrates/storage/src/focus_store.rsissues/051-ranch-animal-vocabulary-seam.mdissues/053-task-timer-expiry-workflow.mdissues/README.mdissues/done/030-pig-growth-expired-visual-tray-list.mdissues/done/052-task-timers-and-clock-dropdown-editing.mdsrc-tauri/Cargo.tomlsrc-tauri/icons/icon.icnssrc-tauri/src/app/mod.rssrc-tauri/src/app/paths.rssrc-tauri/src/app/seed.rssrc-tauri/src/app/tray.rssrc-tauri/src/ui_bridge/mod.rssrc/api/fixtureFocusWriter.tssrc/api/focusWriter.test.tssrc/api/focusWriter.tssrc/api/tauriFocusReader.test.tssrc/api/tauriFocusReader.tssrc/components/AnimalDetail.test.tsxsrc/components/AnimalDetail.tsxsrc/components/App.test.tsxsrc/components/App.tsxsrc/components/PigSprite.tsxsrc/components/TimerDropdown.test.tsxsrc/components/TimerDropdown.tsxsrc/hooks/useAppState.test.tsxsrc/hooks/useFocusController.tssrc/hooks/useOpenFocusDetailRequest.tssrc/hooks/usePigMovement.test.tssrc/hooks/usePigMovement.tssrc/styles.css
0cf4201 to
8d9f230
Compare
Summary
Verification
Notes
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Documentation