Repository navigation
Conversation
This branch has not been deployed
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.
Description
TaskdogTUI._flush_reloadandTaskdogTUI.on_gantt_resize_requestedrun in separate exclusive Textual worker groups ("reload"and"gantt"). When both run concurrently, whichever finishes last overwroteTUIState.gantt_cache, allowing a slower stale gantt fetch or an older full reload to clobber newer gantt window or task data.This adds monotonic
reload_generationandgantt_generationcounters toTUIStateand stamps each worker snapshot (FetchParamsandGanttFetchParams) on the UI thread when the fetch starts:reload_generationandgantt_generation.gantt_generationonly.apply_ganttand_finish_gantt_reloaddrop results and error/loading updates ifgantt_generationhas been superseded.apply_task_datadrops the entire update ifreload_generationhas been superseded, and skips overwritinggantt_cache/GanttWidgetwhenreload_generationis current butgantt_generationhas been superseded by a newer gantt pan/resize.Related Issue
Closes #1145
Type of Change
Changes Made
packages/taskdog-ui/src/taskdog/tui/state/tui_state.py: Addedgantt_generation,reload_generation,next_gantt_generation(), andnext_reload_generation().packages/taskdog-ui/src/taskdog/tui/services/task_ui_manager.py: Added generation tokens toFetchParamsandGanttFetchParams, generation validation helpers (is_current_reload_generation,is_current_gantt_generation), and selective gantt cache/widget gating inapply_task_data,_update_cache,_refresh_ui, andapply_gantt.packages/taskdog-ui/src/taskdog/tui/app.py: Propagated generation tokens through_reload_in_thread/_finish_reloadand_gantt_reload_in_thread/_finish_gantt_reloadand gated loading/error cleanup.packages/taskdog-ui/tests/tui/test_app_worker_race.py: Added end-to-end Textual async regression tests covering both stale-gantt-after-reload and stale-reload-after-gantt-pan worker races.packages/taskdog-ui/tests/tui/services/test_task_ui_manager.pyandpackages/taskdog-ui/tests/tui/state/test_tui_state.py: Added unit tests for generation counters and stale-token filtering.Testing
Test Environment
Tests Performed
pytest packages/taskdog-ui/tests/ --cov=taskdog --cov-fail-under=70 -q: 1197 passed, 83.77% coverage)packages/taskdog-ui/tests/tui/test_app_worker_race.pyfail before the fix (reproducing the stalegantt_cacheoverwrite) and pass after the fix (2 passed)Code Quality Checklist
ruff check --config pyproject.toml packages/taskdog-ui/src/ packages/taskdog-ui/tests/— all checks passed)mypy --config-file pyproject.toml packages/taskdog-ui/src/— 0 issues in 193 source files)ruff format --check --config pyproject.toml packages/taskdog-ui/src/ packages/taskdog-ui/tests/— 309 files formatted)vultureandcodespell— 0 issues)Package Affected