fix: respect active filters when reloading tasks after create/update #123
No reviewers
Labels
No labels
bug
ci
documentation
duplicate
enhancement
feature
good first issue
help wanted
invalid
performance
priority
P0
priority
P1
priority
P2
question
refactor
size
L
size
M
size
S
size
XL
size
XS
tests
trivial
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
noe.trevino/paso!123
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "bugfix-121/predicates-ignored-post-task-create"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
formConfig.onCompletefromfunc()tofunc() tea.Cmdto allow form completion handlers to return commands (e.g. notifications)Root Cause
createNewTaskWithLabelsAndRelationshipsandupdateExistingTaskWithLabelsAndRelationshipscalledGetTaskSummariesByProjectdirectly instead offetchTasksForCurrentProject, which is the method that checksHasAnyFilter()and routes to the filtered query.Testing
search_persistence_test.gocovering create/update with and without active filtersgolangci-lintcleanCloses #121
@ -124,7 +125,7 @@ func (m *Model) updateExistingTaskWithLabelsAndRelationships(values taskFormValuif err != nil {slog.Error("failed to updating task", "error", err)m.UI.Notification.Add(state.LevelError, "Error updating task")Correctness bug: notification fires even when the task is visible.
HasAnyFilter()checks whether any filter is active, not whether the newly created task is actually absent from the reloaded results. Afterm.AppState.SetTasks(tasksByColumn)is called on line 94,tasksByColumnalready reflects what is visible. The new task's ID (task.ID, available from line 67) should be checked against that map instead.Example false-positive: a user with an active search for "bug" creates a task titled "Bug fix". The filtered reload will include it (title matches), but the warning still fires.
The same issue exists in
updateExistingTaskWithLabelsAndRelationshipsat line 184.@ -341,0 +374,4 @@confirm: true,})assert.Greater(t, svc.Task.CallCount("GetTaskSummariesWithFilters"), initialFilteredCalls,Missing assertions for the notification feature.
The PR description calls out "Shows a warning notification when the saved task won't be visible due to active filters" as a key behaviour, but none of the four new tests assert it. This test has a filter active and
GetTaskSummariesWithFiltersResultreturns a task with ID 99, while the created task has ID 50 — so the task is hidden and the notification should fire. That return value fromcreateNewTaskWithLabelsAndRelationshipsis currently discarded and never asserted.Additionally, there is no test verifying the inverse: that when a newly created task matches the active filter (i.e. it appears in the filtered results), no warning notification is issued. Once the correctness bug in the production code is fixed, that case needs a regression test.
Review Summary
Core fix is correct. Routing
createNewTaskWithLabelsAndRelationshipsandupdateExistingTaskWithLabelsAndRelationshipsthroughfetchTasksForCurrentProjectinstead of callingGetTaskSummariesByProjectdirectly is the right fix, and thefunc() → func() tea.Cmdsignature change propagates cleanly through all call sites.Two issues found:
1. False-positive notification (correctness bug)
Both
createNewTaskWithLabelsAndRelationships(line 99) andupdateExistingTaskWithLabelsAndRelationships(line 184) fire the "hidden by active filters" warning wheneverHasAnyFilter()is true, regardless of whether the task actually appears in the reloaded results. If a user searches for "bug" and creates a task titled "Bug fix", the filtered reload will include the new task, but the warning still fires incorrectly. The check should compare the task's ID againsttasksByColumnafterSetTasksis called.2. Notification behaviour has no test coverage
The four new tests cover query routing (filtered vs. unfiltered) but none of them assert the notification return value or inspect whether a warning was issued. The PR description lists the notification as a primary feature. Missing cases:
updateExistingTaskhas no without-filter counterpart test (asymmetric with the create tests).Score: 6/10