Repository navigation
Clear completed_at when a todo is reopened - #348
Merged
Merged
Conversation
update_todo stamped completed_at on terminal status but never cleared it when PATCH moved the row back to pending or in_progress. HTTP reopen then violated the documented completed_at=0-until-terminal contract. Co-authored-by: Tyler Reckart <tylerreckart@users.noreply.github.com>
This was referenced Sep 17, 2026
…-completed-at # Conflicts: # CHANGELOG.md
tylerreckart
marked this pull request as ready for review
September 21, 2026 12:58
tylerreckart
enabled auto-merge (squash)
September 21, 2026 12:58
…-completed-at # Conflicts: # CHANGELOG.md
…-completed-at # Conflicts: # CHANGELOG.md
…-completed-at # Conflicts: # CHANGELOG.md
…-completed-at # Conflicts: # CHANGELOG.md
…-completed-at # Conflicts: # CHANGELOG.md
…-completed-at # Conflicts: # CHANGELOG.md
…-completed-at # Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PATCH /v1/todos/:id(and batch PATCH) accept a non-terminalstatus(pending/in_progress), which is the HTTP reopen path.update_todoauto-stampedcompleted_atwhen moving tocompletedorcanceled, but left the stamp in place on reopen.Storage and docs say
completed_at = 0until terminal. A completed-then-reopened row kept a non-zero timestamp, so list/get JSON, UIs that treatcompleted_at > 0as done, and any client filtering on that column were wrong. Subject/description edits on a still-terminal row were already correct (leave the stamp).Writ
/todo startonly resolves against open rows, so this was HTTP-only — but PATCH is the supported reopen API.Fix
When
statusis set and the caller did not passcompleted_at:now()(unchanged)completed_at = 0An explicit
completed_atargument still overrides. Header, concept, and PATCH docs match the store.Tests
unit_todos— reopen from completed→pending and canceled→in_progress clears the stamp; explicit override on reopen is honored; subject edit after completed does not clear. Suite 10/10 locally (+ ASan, 154 assertions).arbitercompiles.Independently mergeable against
main(0456350). merge-tree vs #321–#347: code auto-merges (update_todo/test_todosare disjoint from those hunks); only CHANGELOG[Unreleased]sibling-conflicts after the first of those merges.Note
Low Risk
Localized todo persistence and API contract fix with new unit tests; no auth or cross-tenant behavior changes.
Overview
Reopened todos now reset
completed_at.TenantStore::update_todo(single and batchPATCH /v1/todos) used to stampcompleted_atoncompleted/canceledbut left the old timestamp when status moved back topendingorin_progress. That broke the documented rule thatcompleted_atstays0until a terminal status.When
statusis present andcompleted_atis omitted, non-terminal statuses now writecompleted_at = 0; terminal statuses still auto-stampnow(). An explicitcompleted_atin the request still wins. Subject/description-only updates on a terminal row do not touch the stamp.Docs (
PATCHAPI, todos concept) and CHANGELOG match the store.unit_todosadds reopen, override, and non-clearing edit cases.Reviewed by Cursor Bugbot for commit 2231e28. Bugbot is set up for automated code reviews on this repo. Configure here.