Skip to content

feat(chart): cancel the read a gesture left behind - #104

Merged
mrcsin merged 1 commit into
masterfrom
history-pipeline
Oct 2, 2026
Merged

mrcsin merged 1 commit into
masterfrom
history-pipeline

Conversation

@mrcsin

@mrcsin mrcsin commented Oct 2, 2026

Copy link
Copy Markdown
Member

Problem

A drag queries the history of every window it passes. When the gesture ended, a read for a window the operator had already left ran on to its end, up to the 300 s command timeout, and held the next read behind it. A window whose apply threw could not be asked for again.

What changed

Group E (Tasks 9 and 10) of docs/plans/20260929-window-per-process.md.

  • The cancellation token runs from IDataProvider.QueryHistoryAsync to the Npgsql reads.
  • A paced request during a drag never cancels, so the strip fills while it moves. The trailing request at the end of a gesture cancels the read for any other window. A cancelled read reports nothing.
  • The cancel goes through CancelAsync, so Npgsql's blocking cancel request (up to the 15 s connect timeout) never runs on the UI thread or under the debouncer's or Rx's locks.
  • The chart is the one owner of the window drawn. A gesture that ends inside it reads nothing and still cancels the read it left. A read for an older pen set opens nothing.
  • A window whose apply threw is read again at the next move.
  • Two gaps on the same read path are closed. A window starting before the archive's first sample no longer rereads every throttle period. A pen added with older rows reads them once the archive extent widens. Both were also present on master.
  • Stepwise input with gaps over 150 ms (wheel notches, key presses) cancels at every step. data-integration.md states this trade-off.

The plan stays in docs/plans/; Groups F and G follow.

Verification

  • dotnet test SemiPlot.slnx: 1580 unit and 138 integration tests pass. AReadCancelledMidStatementThrowsInsteadOfFailing cancels a read held by a table lock on the Raw and Minute layers.
  • Each review regression has a test that failed before its fix: the cancel on the UI thread and under the gate, the drawn window per pen set, a pen removed and named again, the endless read before the first sample, and the two widen gaps.
  • Idle probes: 45 virtual minutes issue no repeated read for any window position.
  • Manual stand walk: a 3 s Raw drag fills during the drag and lands within one read, a drag out of the band and back in keeps the window drawn, an idle minute shows no repeated reads in the log, and a close during a drag closes at once. Passed.
Per-task commits before collapse
9f1a414 docs(plans): record the history pipeline exec run
96daf10 fix(chart): read rows a widened archive brings in
ee51051 docs(comments): cut restated history comments
70c98ef fix(chart): stop rereading a window before the first sample
b3c09a9 refactor(chart): address smells findings
1613bf7 fix(chart): read a pen that came back
395c74f fix(chart): keep the drawn window per pen set
685a0d1 fix(chart): address review findings
04d3ec1 fix(chart): request a window again after its apply threw
48b1409 feat(chart): cancel the read a gesture left behind

https://claude.ai/code/session_01PfZJa7neMMKPzycFR6iuhD

A drag queries the history of every window it passes. When the gesture
ended, a read for a window the operator had already left ran on to its
end, up to the command timeout, and held the next read behind it. A
window whose apply threw could not be asked for again.

The history token now runs from IDataProvider.QueryHistoryAsync to the
Npgsql reads. A paced request during a drag never cancels, so the strip
fills while it moves; the trailing request at the end of a gesture
cancels the read for any other window, and a cancelled read reports
nothing. The cancel goes through CancelAsync, so Npgsql's blocking
cancel request never runs on the UI thread or under the debouncer's or
Rx's locks. The chart is the one owner of the window drawn: a gesture
that ends inside it reads nothing and still cancels the read it left,
and a read for an older pen set opens nothing. A window whose apply
threw is read again at the next move.

Two gaps on the same read path are closed too: a window starting before
the archive's first sample no longer rereads every throttle period, and
a pen added with older rows reads them once the archive extent widens.

Claude-Session: https://claude.ai/code/session_01PfZJa7neMMKPzycFR6iuhD
@mrcsin
mrcsin marked this pull request as ready for review October 2, 2026 08:50
@mrcsin
mrcsin merged commit da31d5c into master Oct 2, 2026
2 checks passed
@mrcsin
mrcsin deleted the history-pipeline branch October 2, 2026 08:53
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