fix(coordinator): token a row count handle so a superseded task cannot clear its successor - #2070
Merged
Merged
Conversation
…t clear its successor
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Follow-up to #2068, which made this reachable.
Before #2068,
resolveRowCount's write-back guard wasisCurrent(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, includingclearRowCountTask(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.
tableLoadTaskshas carried a token for this since before any of this work: itsdeferonly clears the entryif tableLoadTasks[tabId]?.token == token. This givesrowCountTasksthe same discipline rather than inventing a different one.RowCountTaskLifecycleTestsgains a test that registers two handles for one tab and clears with the first token, asserting the successor survives. 23 tests pass acrossRowCountTaskLifecycleTests,MainContentCoordinatorRefreshTestsandPhase2RowCountGuardTests.swiftlint lint --strictreports 0 violations.No CHANGELOG entry: #2068 has not shipped, so this folds into that entry.