Skip to content

fix(coordinator): token a row count handle so a superseded task cannot clear its successor - #2070

Merged
datlechin merged 1 commit into
mainfrom
fix/row-count-handle-token
Aug 10, 2026
Merged

fix(coordinator): token a row count handle so a superseded task cannot clear its successor#2070
datlechin merged 1 commit into
mainfrom
fix/row-count-handle-token

Conversation

@datlechin

Copy link
Copy Markdown
Member

Follow-up to #2068, which made this reachable.

Before #2068, resolveRowCount's write-back guard was isCurrent(claim), which was false on every run, so the code below it never executed. #2068 fixed that guard to use content identity, which means the completion path now actually runs, including clearRowCountTask(for:).

That exposes a gap. A tab's auto count can be superseded by the exact-count button, which cancels it and installs a new handle. The superseded task still reaches its completion path, its content check still passes (content did not change, only the task did), and it clears the slot its successor now owns. The successor is then orphaned: not cancellable by Stop, by a retarget, or by teardown, which is the exact class of bug #2059 set out to remove.

tableLoadTasks has carried a token for this since before any of this work: its defer only clears the entry if tableLoadTasks[tabId]?.token == token. This gives rowCountTasks the same discipline rather than inventing a different one.

RowCountTaskLifecycleTests gains a test that registers two handles for one tab and clears with the first token, asserting the successor survives. 23 tests pass across RowCountTaskLifecycleTests, MainContentCoordinatorRefreshTests and Phase2RowCountGuardTests. swiftlint lint --strict reports 0 violations.

No CHANGELOG entry: #2068 has not shipped, so this folds into that entry.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@datlechin
datlechin merged commit bdd6003 into main Aug 10, 2026
4 checks passed
@datlechin
datlechin deleted the fix/row-count-handle-token branch August 10, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant