Honor M4 renderer cache invalidation

Preserve the renderer's `reset_cache` result when publishing
rebuilt paths so zoom changes invalidate Qt's cached graphics.
Retain the earlier live-debug provenance for cadence, negative
volume, repaint suppression, and downsample cache repair.

Prompt-IO: ai/prompt-io/opencode/20260903T232525Z_fadab3d2_prompt_io.md

(this commit msg was generated in some part by `codex` using
`gpt-6` (`openai`))
wkt/fsp_backfill_sync
Gud Boi 2026-09-15 12:49:53 -04:00
parent 5b4622fb39
commit 224399147d
3 changed files with 114 additions and 2 deletions

View File

@ -0,0 +1,41 @@
---
model: gpt-5.6-sol
service: opencode
session: fsp-backfill-sync-live-volume
timestamp: 2026-09-03T23:25:25Z
git_ref: fadab3d2
scope: code
substantive: true
raw_file: 20260903T232525Z_fadab3d2_prompt_io.raw.md
---
## Prompt
Diagnose and fix MNQ's same-index volume repaint, missing post-closure
volume curve, stale zoomed-out downsample path, and repeated
`No yrange provided for dolla_vlm` warnings using live SHM evidence.
## Response summary
Declared source sample periods on `Flume` so FSP cascades cannot mistake
a market-closure timestamp gap for their regular cadence. Clamped
negative provider volume at sampling and volume-FSP boundaries, honored
M4 renderer cache invalidation, and skipped unchanged realtime FSP
redraws while retaining forced history repairs.
## Files changed
- `piker/data/flows.py` - declare RT/history sample periods.
- `piker/data/_sampling.py` - prevent negative sampled volume.
- `piker/fsp/_engine.py` - subscribe using the declared RT period.
- `piker/fsp/_volume.py` - clamp volume history and trade sizes.
- `piker/ui/_dataviz.py` - honor renderer cache resets.
- `piker/ui/_fsp.py` - skip identical realtime FSP redraws.
- `tests/test_fsp_sync.py` - cover the observed regressions.
## Human edits
The human identified each visual failure, supplied the exact console
warning, confirmed that the later-started `flow_rates` cascade behaved
correctly, requested declared cadence instead of timestamp inference,
performed chart restarts, and live-validated the final behavior.

View File

@ -0,0 +1,71 @@
---
model: gpt-5.6-sol
service: opencode
timestamp: 2026-09-03T23:25:25Z
git_ref: fadab3d2
diff_cmd: git diff HEAD~4..HEAD
---
## Prompt
The human reported that the MNQ volume subchart repeatedly rendered
its last bar at one index around the equity-futures closure, then
reported that the volume curve disappeared after reopening. During
live testing, the human confirmed that `flow_rates`, which started
later, advanced correctly while `dolla_vlm` remained pinned. The human
then reported a stale downsampled curve on zoom-out and supplied the
repeated console warning:
`No yrange provided for dolla_vlm!?`
The human requested a live diagnosis and fix, validated each restart,
and confirmed the final chart behavior was fixed.
## Response
Read-only SHM snapshots showed that `dolla_vlm` remained at exclusive
bound `172801` while the source advanced hundreds of rows. Its one
current row kept receiving current quote values, explaining the
same-index repaint. `flow_rates` remained aligned because it started
after regular one-second timestamps resumed.
The cascade had inferred its sampler period from the last two distinct
timestamps. A market closure therefore looked like the source cadence.
Explicit `Flume` RT/history periods now drive sampling and downsampling
metadata instead.
> `git diff HEAD~4..HEAD -- piker/data/flows.py`
> `git diff HEAD~4..HEAD -- piker/fsp/_engine.py`
Further SHM inspection found an IB source row with volume `-2319096`.
`dolla_vlm` multiplied that value into a `-68277471626` outlier, causing
`Viz.maxmin()` to reject the zoomed-out range. Sample ingestion and
volume FSP history/realtime calculations now clamp negative volume.
> `git diff HEAD~4..HEAD -- piker/data/_sampling.py`
> `git diff HEAD~4..HEAD -- piker/fsp/_volume.py`
The M4 renderer already returned a cache-reset signal after rebuilding
a downsampled path, but `Viz.update_graphics()` overwrote that signal
with `False`. The override was removed so Qt's device-coordinate cache
is invalidated with the new path.
> `git diff HEAD~4..HEAD -- piker/ui/_dataviz.py`
Normal quote cycles also redrew unchanged FSP state. A per-`Viz`
bounds/timestamp/value signature now suppresses only identical
realtime refreshes; forced history redraws still bypass it.
> `git diff HEAD~4..HEAD -- piker/ui/_fsp.py`
Regression coverage models closure-gap cadence, negative provider
volume, unchanged realtime redraws, and the broader FSP synchronization
behavior.
> `git diff HEAD~4..HEAD -- tests/test_fsp_sync.py`
Live verification after restart showed source and `dolla_vlm` advancing
at the same bound, zero negative destination rows, and correct zoomed-out
rendering. The focused suite completed with 38 passing tests.

View File

@ -985,10 +985,10 @@ class Viz(Struct):
# XXX: SUPER UGGGHHH... without this we get stale cache # XXX: SUPER UGGGHHH... without this we get stale cache
# graphics that "smear" across the view horizontally # graphics that "smear" across the view horizontally
# when panning and the first datum is out of view.. # when panning and the first datum is out of view..
reset_cache = False
if ( if (
reset_cache reset_cache
or should_redraw or
should_redraw
): ):
# assign output paths to graphicis obj but # assign output paths to graphicis obj but
# after a coords-cache reset. # after a coords-cache reset.