Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 429d600e57
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
429d600 to
e6b3694
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6b36942e6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let updated_timer = ActiveTimer::new(current_timer.started_at) | ||
| .with_project(project_id, project_name) | ||
| .with_activity(activity_id, activity_name) | ||
| .with_note(current_timer.note); | ||
| service.edit_timer(&user.id, &updated_timer).await?; |
There was a problem hiding this comment.
Preserve server timer state when saving from stale clients
This update unconditionally rewrites the active timer with project/activity values from the save payload before persisting the entry, so a stale client can overwrite newer server-side changes and save to the wrong project/activity. In toki-tui, active timer state is only restored during startup (initialize_app_state in toki-tui/src/bootstrap.rs) and is not periodically refreshed, so editing the same timer from another client (web UI/second TUI session) is enough to trigger this. Before this commit, save_timer used the server’s current timer state directly and did not have this overwrite path.
Useful? React with 👍 / 👎.
Greptile Summary
This PR enhances the timer save functionality to include project and activity metadata in the save request. The backend now accepts optional project/activity fields and syncs them via
edit_timerbefore saving, making the save operation more robust if a prior timer-edit sync call was missed.Key Changes:
SaveTimerPayloadnow acceptsproject_id,project_name,activity_id, andactivity_namefieldsedit_timerbeforesave_timerSaveTimerRequestwith current project/activity from app stateThe implementation correctly handles all edge cases with the current TUI client, which always sends paired id/name fields together.
Confidence Score: 4/5
toki-api/src/routes/time_tracking/timer.rsif adding new clients - the merge logic assumes paired id/name fieldsImportant Files Changed
SaveTimerPayloadand logic to sync timer state before saving, preventing data loss from missed sync callsLast reviewed commit: 429d600