Fix: destroy "not now" state when closing cards, enables "indexed_by=closed" expected behaviour #2237
+29
−0
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.





I (Claude actually) found a bug when testing the API. Cards moved directly from "not now" to "done" don't appear in the
indexed_by=closedquery. This bug also prevents cards from appearing in the "status = done" filter in the UI if moved from "not now".I decided to include some tests that ensure each "from x column to done" pathway is working, these tests would've pick up this bug. It also prevents any regressions on any of the other closure contexts.
Here is the bug report Claude produced...
Bug Report: Closed cards from NOT NOW missing from
indexed_by=closedfilterDate: 2025-12-21
Discovered via: API testing
Severity: Medium (data appears correctly but filtering fails)
Summary
Cards closed directly from NOT NOW state retain their
not_nowrecord, causing them to be excluded from theindexed_by=closedfilter results. The cards showclosed: truein individual API responses but don't appear in filtered lists.Reproduction Steps
POST /cards/:number/not_nowPOST /cards/:number/closureGET /cards?indexed_by=closedExpected: Card appears in closed list
Actual: Card is missing from closed list
Root Cause
The
Card#closemethod inapp/models/card/closeable.rbdoes not clean up thenot_nowrecord:Meanwhile, the
Filter#cardsmethod inapp/models/filter.rbexcludes cards withnot_nowrecords:The
include_not_now_cards?method only returnstruewhenindexed_by.not_now?, so closed cards with orphanednot_nowrecords are filtered out.Affected Code Paths
POST /:account/cards/:number/closureCard#closewhich has the bugVerified Behavior
Other transitions properly clean up via
resume:send_back_to_triage→ callsresume→ destroysnot_nowtriage_into(column)→ callsresume→ destroysnot_nowpostpone→ callssend_back_to_triagefirstOnly
closeskips this cleanup.Suggested Fix
In
app/models/card/closeable.rb, addnot_now&.destroyto theclosemethod:Data Cleanup
Existing orphaned records can be cleaned with:
Test Cases to Add
Resolution
Status: Fixed
Date: 2025-12-23
Fix Applied:
not_now&.destroytoCard#closeinapp/models/card/closeable.rbresumemethod inapp/models/card/postponable.rbTests Added:
test/models/card/closeable_test.rbVerification:
indexed_by=closed