Repository navigation
fix(desktop): stop dashboard navigation from opening a retired task (#11518) - #11626
Merged
Merged
Conversation
`DashboardIntelligenceStore.taskForNavigation` fetched the task detail and returned it with no retirement check at all, so a "What matters now" recommendation minted before the task was cancelled, superseded, or deleted still routed the user to it. Its sibling `candidateForNavigation` already gates on `SuggestedTasksStore.canPresentForNavigation`; this path had no equivalent. The user-visible result was a silent dead end, not a stale card: the live Tasks lanes filter retired rows out, so `TaskNavigationRequestStore`'s pending request can never be consumed — the dashboard switches to Tasks and selects nothing. It now reports "This task is no longer available.", exactly as the Suggested path does. `TaskActionItem.isRetired` is the authority the model documents for this: detail responses may omit legacy `deleted` and state retirement only through canonical lifecycle status, so a raw `deleted` read is not sufficient. The same raw read in `ChatFirstShell.taskForFocus` — the only other site that tests an API response directly rather than a cache row — is corrected with it (#11518). Cache reads are already normalized: `ActionItemRecord.from` persists `deleted: item.isRetired`. Verified (desktop/macos): - ./scripts/dev-feedback.py --once swift 'DashboardIntelligenceStoreTests' → 30 tests, 0 failures. - Reverted the guard alone and re-ran the two new tests → both fail (cancelled, superseded, and legacy `deleted: true` all opened as live), so the regression tests execute the fixed behavior rather than restating it. Failure-Class: none
Collaborator
Author
|
Independently re-verified before merge (not trusting the opening run's claims):
CI green (Desktop Swift Static & Test Contracts, Release Compile, Build & Tests). Merging. 🤖 automated by hourly watchdog — tested and merged |
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.
Bug
DashboardIntelligenceStore.taskForNavigation(taskID:)fetched the task detail and returned it with no retirement check at all, so a "What matters now" recommendation minted before its task was cancelled, superseded, or deleted still routed the user to that task.The user-visible symptom is a silent dead end rather than a stale card: every live Tasks lane filters retired rows out, so the
TaskNavigationRequestStorerequestopenRecommendationenqueues can never be consumed — the dashboard switches to the Tasks tab and selects nothing, with no explanation.Its sibling in the same file,
candidateForNavigation, already gates onSuggestedTasksStore.canPresentForNavigation(candidate)and reports "This Suggested item is no longer available." The task path had no equivalent.Root cause
Retirement is re-derived by each reader instead of being asked of the one authority.
TaskActionItem.isRetiredexists precisely for this, and its doc comment records why:So a raw
deletedread is not sufficient on anything straight off the wire, andtaskForNavigationdid not even do that much.This is mostly invisible on cache paths because every writer normalizes:
ActionItemRecord.frompersistsdeleted: item.isRetired. It is observable only on objects read directly from an API response.Fix
DashboardIntelligenceStore.taskForNavigationnow requires!task.isRetiredalongside the existing id match, and surfaces the same "This task is no longer available." error the Suggested path uses.ChatFirstShell.taskForFocus— the only other site that tests an API response directly rather than a cache row — moves fromtask.deleted != trueto!task.isRetired(Desktop: raw TaskActionItem.deleted reads disagree with isRetired, so status-only-retired tasks read as live #11518).Cache reads elsewhere are left alone: they are already normalized, and #11518 explicitly warns that
deletedis a field on unrelated types, so a blind sweep is not the fix.Tested
The two new tests execute production behavior through the injected
DashboardIntelligenceClientseam, not a source scrape. To prove they are load-bearing, the!task.isRetiredguard alone was reverted and they were re-run:The guard was then restored and the suite re-run green (above).
Not exercised live: reproducing it in the running app needs a server-side task retired between projection mint and click. The seam the fix sits behind is the same one
taskForNavigation's existing coverage uses.Product invariants
None matched —
scripts/pr-preflight --suggestreports no invariant citations required for these paths.Fixes part of #11518.
🤖 automated by hourly watchdog — tested and merged
Failure-Class: none