Record trade-rate and history reconciliation evidence
Capture the live clipping and backfill observations, the probe handoff, and the sampler clock cases. Document how to qualify IB startup reconciliation while preserving live history. (this patch was generated in some part by `Codex` using `GPT-6` (`OpenAI`))wkt/federated_project_stores
parent
5e03f25e99
commit
fdec59b94e
|
|
@ -993,6 +993,227 @@ The history checkout also contains a sampler timing variant. Compare
|
||||||
those implementations before choosing the landing boundary.
|
those implementations before choosing the landing boundary.
|
||||||
[[file:/home/goodboy/repos/piker/wkts/fsp_backfill_sync/.agents/skills/piker-fsp-expert/roadmap-and-research.md][.agents/skills/piker-fsp-expert/roadmap-and-research.md (original source)]]
|
[[file:/home/goodboy/repos/piker/wkts/fsp_backfill_sync/.agents/skills/piker-fsp-expert/roadmap-and-research.md][.agents/skills/piker-fsp-expert/roadmap-and-research.md (original source)]]
|
||||||
|
|
||||||
|
**** TODO Diagnose trade-rate lines sliding upward as the volume bar fills
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: piker-ui-rate-overlay-slide
|
||||||
|
:CREATED: [2026-11-27]
|
||||||
|
:CARRIED: 0
|
||||||
|
:REPO: /home/goodboy/repos/piker
|
||||||
|
:TAKEN_APPEND_OP: rate-overlay-slide-20261127
|
||||||
|
:TAKEN_APPEND_REQUEST: cc0ac04c62ce30e4dfdd8c76f1fee6243628ecbbb2e2ab81e26ef55b385d0282
|
||||||
|
:END:
|
||||||
|
After the landing slices, trace the trade-rate overlay on a live chart.
|
||||||
|
On wkt/land_feed_endpoint_reuse at 036b7ed9 the tester saw historical
|
||||||
|
dashed lines slide upward while the volume bar filled. The shorter
|
||||||
|
second Sway window showed it most clearly. The 10:49:29, 10:49:36
|
||||||
|
and 10:49:47 captures show clipping. Its cause remains open.
|
||||||
|
|
||||||
|
- [ ] Launch the smaller chart using scripts/trace_rate_view.py from
|
||||||
|
that worktree. Keep the viewport still and save its JSONL trace.
|
||||||
|
- [ ] Compare rows for the same market, completed sample and live bar.
|
||||||
|
Check both stored rates, scene Y, rate-view X/Y bounds, pane height
|
||||||
|
and raw/dollar volume. A changing stored value may also occur during
|
||||||
|
[[id:piker-es-rate-overwrite-20261126][the ES backfill overwrite]].
|
||||||
|
- [ ] If a stable value moves, inspect overlay scaling during
|
||||||
|
graphics_update_cycle. Determine whether visible rate extrema or
|
||||||
|
viewport geometry warranted the change. Verify any fix in short
|
||||||
|
and tall panes while volume grows and new rate peaks arrive.
|
||||||
|
Return the trace interval and measured cause here.
|
||||||
|
|
||||||
|
***** MNQ live rate-axis clipping during a one-bar scroll
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: piker-ui-rate-overlay-slide-mnq-20261127
|
||||||
|
:TAKEN_APPEND_OP: mnq-rate-slide-live-20261127
|
||||||
|
:TAKEN_APPEND_REQUEST: ab6f0e9e1ec94beb416d6b785ebe995624c973376175bd9ce64abe369bfbd95c
|
||||||
|
:END:
|
||||||
|
The tester saw both charts slide; chart C (PID 675626) recorded
|
||||||
|
mnq.cme.20261218.ib in /tmp/piker-rate-view-675626-0u08b_qe.jsonl.
|
||||||
|
Within its first 1290 complete records, compare wall seconds
|
||||||
|
1795795775.5745056 and 1795795775.6755402. Sample 1795795771
|
||||||
|
held trade_rate 40 and dark_trade_rate 45. Pane height stayed 71.5.
|
||||||
|
X advanced one bar. The rate Y bounds changed from [23.8, 46.2]
|
||||||
|
to [24.1, 40.9]. Regular scene Y moved from 20.79 to 4.83 and
|
||||||
|
dark scene Y from 4.83 to -16.45. The dark value exceeded the new
|
||||||
|
upper bound while its sample was still horizontally visible.
|
||||||
|
|
||||||
|
Across 1007 adjacent pairs with rising raw volume, same live bar,
|
||||||
|
sample, X bounds and pane height, rate Y bounds never changed.
|
||||||
|
This sampled interval points to range selection as the view scrolls.
|
||||||
|
Inspect whether both visible rate series contribute extrema to their
|
||||||
|
shared axis; the trace measures the result, not which writer set it.
|
||||||
|
Use the recorded bounds and values for an offscreen regression.
|
||||||
|
***** Probe to carry into the line-slide fix
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: piker-ui-rate-overlay-probe-handoff
|
||||||
|
:TAKEN_APPEND_OP: rate-probe-handoff-20261127
|
||||||
|
:TAKEN_APPEND_REQUEST: 7f5b2f840309cb37f112e9648c44a1e115c7677fbc1be2cbeb1082257911649a
|
||||||
|
:END:
|
||||||
|
- [ ] Carry the [[file:../../land_feed_endpoint_reuse/scripts/trace_rate_view.py][chart probe and its launch examples]] into the follow-up worktree.
|
||||||
|
Commit it with the diagnostic work and record the commit here before
|
||||||
|
retiring its current worktree. The source copy is currently untracked.
|
||||||
|
- [ ] Use the probe before and after the axis fix. Compare both curves
|
||||||
|
against the shared rate bounds when the same completed sample stays
|
||||||
|
in view through a scroll. Use the [[id:piker-ui-rate-overlay-slide-mnq-20261127][captured MNQ case]] as the baseline.
|
||||||
|
*** TODO preserve realtime-only FSP history across backfill resyncs
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: piker-fsp-preserve-live-history-on-resync
|
||||||
|
:CREATED: [2026-11-11]
|
||||||
|
:CARRIED: 0
|
||||||
|
:REPO: /home/goodboy/repos/piker
|
||||||
|
:END:
|
||||||
|
Objective: preserve accumulated dark volume, trade counts and trade-rate
|
||||||
|
history when source OHLCV backfills trigger FSP history rebuilds.
|
||||||
|
Next action: reproduce the overwrite deterministically with nonzero
|
||||||
|
live-derived samples before implementing a bounded preservation fix.
|
||||||
|
|
||||||
|
**** Context and evidence
|
||||||
|
Human manual qualification on 2026-11-11: with two charts of the same
|
||||||
|
market opened during active backfill, regular dollar volume appears
|
||||||
|
intact while dark volume and trade-rate lines repeatedly lose prior
|
||||||
|
history and rebuild. An in-use retry with a new market also exhibited
|
||||||
|
transient stepping differences that settled after backfill; that is a
|
||||||
|
separate observation and its cause is not established by this finding.
|
||||||
|
|
||||||
|
Inspected source: wkt/history_segment_refill at 179a8c81, with unrelated
|
||||||
|
uncommitted history/display and sampler work present. The FSP engine
|
||||||
|
and FSP UI match committed wkt/fsp_backfill_sync. Relevant code:
|
||||||
|
- =piker/fsp/_volume.py:dolla_vlm= reconstructs regular dollar volume
|
||||||
|
from OHLCV, yields None for dark_vlm and omits both trade-count fields.
|
||||||
|
- =piker/fsp/_volume.py:flow_rates= yields None for its history fields,
|
||||||
|
including trade_rate and dark_trade_rate.
|
||||||
|
- =piker/fsp/_engine.py:_write_history_output= allocates zeros, fills
|
||||||
|
only supplied non-None fields, and overwrites destination history.
|
||||||
|
- Matching backfill notices cause Cascade.resync to restart computation
|
||||||
|
and send fsp_update; the UI then forces a matching-buffer refresh.
|
||||||
|
|
||||||
|
This establishes a code path that discards previously collected live
|
||||||
|
history. No deterministic regression or runtime buffer capture has yet
|
||||||
|
been run for this specific loss. Rendering suppression alone would
|
||||||
|
hide the overwrite rather than preserve data.
|
||||||
|
|
||||||
|
Related existing work:
|
||||||
|
[[id:piker-fsp-backfill-sync-review-and-commit][FSP synchronization qualification]]
|
||||||
|
[[id:piker-revisioned-fsp-graph-research][Revisioned FSP graph research]]
|
||||||
|
=fadab3d2= targeted history redraws and =5b4622fb= skipped unchanged
|
||||||
|
quote-driven redraws; forced history updates still bypass that cache.
|
||||||
|
The worktree/stash/reflog scan found no additional preservation fix.
|
||||||
|
|
||||||
|
**** Execution and concerns
|
||||||
|
- [ ] Define explicit history-output semantics for recomputable fields,
|
||||||
|
unavailable historical fields, and existing live-derived observations.
|
||||||
|
- [ ] Preserve existing live-only values over the overlapping sample
|
||||||
|
identities during resync; initialize only newly exposed history and
|
||||||
|
retain source time/index alignment. Do not infer identity from length.
|
||||||
|
- [ ] Cover dark_vlm, trade_count, dark_trade_count and flow_rates outputs;
|
||||||
|
preserve correctness of their dependency and current-sample handling.
|
||||||
|
- [ ] Keep genuine OHLCV-derived corrections visible. Distinguish prepend,
|
||||||
|
equal-bound repair and reset/new-series cases; do not carry stale values
|
||||||
|
into unrelated samples or silently invent pre-observation trade data.
|
||||||
|
- [ ] Account for concurrent sampling and repeated notices while rebuilding.
|
||||||
|
Keep this bounded repair distinct from whole-gap completion gating and
|
||||||
|
the broader revisioned-graph research task.
|
||||||
|
|
||||||
|
**** Verification and handback
|
||||||
|
- [ ] Add a failing regression with nonzero accumulated live-only history,
|
||||||
|
trigger multiple source backfill resyncs, and verify preserved values
|
||||||
|
by sample identity, correct new-history initialization and no extra steps.
|
||||||
|
- [ ] Verify recomputable dollar volume changes on a source correction,
|
||||||
|
while unrelated live-only history survives; include equal-bound repair.
|
||||||
|
- [ ] Manually qualify two charts during active backfill on a new market
|
||||||
|
or controlled fixture; verify dark-volume/rate history survives each
|
||||||
|
frame and both charts continue live updates. Record any independent
|
||||||
|
step-desync separately with destination timestamps/indexes.
|
||||||
|
- [ ] Return the scoped diff, test evidence, live qualification results
|
||||||
|
and remaining semantics questions here for human review.
|
||||||
|
|
||||||
|
**** Manual qualification update, 2026-11-13
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: piker-fsp-manual-qualification-20261113
|
||||||
|
:TAKEN_APPEND_OP: piker-fsp-manual-20261113-append
|
||||||
|
:TAKEN_APPEND_REQUEST: 0f82fa4e9dbc5ecf7065c109b7907051249d2b3a4a7cd2580b1cc76dd88112e3
|
||||||
|
:END:
|
||||||
|
Source: human chart testing of =wkt/land_history_reservations= at
|
||||||
|
=84292898ac407b6fb8c3fe7991b566605d4ed63c=. The checkout was clean when
|
||||||
|
this update was saved. This supplements the existing report; it does
|
||||||
|
not establish a new regression or acceptance of the pending FSP work.
|
||||||
|
|
||||||
|
During two-chart/backfill testing, the human again observed FSP resyncs
|
||||||
|
and curve redraws. On SPCX, the right chart loaded the market first;
|
||||||
|
its volume bar stayed at a fixed horizontal position and its volume
|
||||||
|
curve stopped updating, while the second (left) chart looked normal.
|
||||||
|
Switching the right chart away from SPCX and back did not recover it.
|
||||||
|
The earlier TSLA test had already reported the first-window stall.
|
||||||
|
|
||||||
|
At 18:31:33 the affected chart's =chart.fsp_0[063f7a]= logged
|
||||||
|
=re-syncing fsp dolla_vlm to source=, followed by repeated
|
||||||
|
=No yrange provided for dolla_vlm!?= and corresponding =dark_vlm=
|
||||||
|
messages. The resync message alone does not establish completion.
|
||||||
|
These observations do not yet distinguish stalled FSP output from
|
||||||
|
stale view bounds/graphics, nor prove the same cause as history loss.
|
||||||
|
Screenshot:
|
||||||
|
[[file:/home/goodboy/images/screenshots/2026-11-13T18:33:00,910718038-05:00.png][SPCX first-loaded right chart versus second-loaded left chart]]
|
||||||
|
|
||||||
|
Related evidence: [[id:piker-es-rate-overwrite-20261126][ES trade-rate history overwrite]].
|
||||||
|
|
||||||
|
The human recalls this stall being resolved on the in-use branch.
|
||||||
|
That remains to be checked after the remaining FSP slices are replayed;
|
||||||
|
do not describe the persistent stall as reproduced on in-use. Earlier
|
||||||
|
in-use testing did show transient rate/volume separation during
|
||||||
|
backfill that settled afterward, which is a distinct observation.
|
||||||
|
|
||||||
|
Other manual checks in this session: ZCSH's reserved history stretch
|
||||||
|
looked unchanged after daemon restart; SHM summaries had zero invalid
|
||||||
|
and order counts. MNQ adjacent chart bars jumped across the maintenance
|
||||||
|
break (16:59 to 18:00) and weekend (November 6 16:59 to November 8
|
||||||
|
18:00), without a continuous placeholder run across those closures.
|
||||||
|
These observations support the history slice but do not resolve FSP
|
||||||
|
qualification. The slice's 102 targeted automated tests also passed.
|
||||||
|
|
||||||
|
- [ ] Repeat the same first-loaded/second-loaded chart test after the
|
||||||
|
remaining FSP slices land; compare directly with in-use if it persists.
|
||||||
|
- [ ] If the stall persists, capture source and FSP destination tail
|
||||||
|
timestamps/indexes and chart read/view bounds during the stall.
|
||||||
|
Keep persistent volume stall, transient step desync and live-history
|
||||||
|
overwrite distinct until evidence establishes a shared cause.
|
||||||
|
- [ ] Return the comparison and any fixing commit identity to this task
|
||||||
|
and the linked FSP synchronization qualification task.
|
||||||
|
**** MES trade-rate history loss during IB backfill, 2026-11-26
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: piker-fsp-mes-backfill-20261126
|
||||||
|
:TAKEN_APPEND_OP: mes-fsp-evidence-20261126
|
||||||
|
:TAKEN_APPEND_REQUEST: 41ba83f653b2f8a394880b555ec950db4a7c3dbf551c04816de32f96e087fdb3
|
||||||
|
:END:
|
||||||
|
Manual qualification on land_fsp_sync with mes.cme.20261218.ib.
|
||||||
|
The tester watched a trade-rate peak form and disappear at the
|
||||||
|
same timestamp on a subsequent history-frame redraw. Resets
|
||||||
|
continued until backfill finished. The first-window volume bar
|
||||||
|
continued stepping. No destination FSP rows were captured across
|
||||||
|
a reset, so the layer losing the peak remains to be identified.
|
||||||
|
|
||||||
|
Source OHLCV generation 9821f878-e84a-43 had zero invalid,
|
||||||
|
duplicate or reversed timestamps in both buffers. JSON counts
|
||||||
|
were 270493 historical rows (60s) and 173153 realtime rows (1s).
|
||||||
|
For the regression, compare the destination rate value at a known
|
||||||
|
pre-existing peak before and after processing a source history frame.
|
||||||
|
**** ES trade-rate overwrite confirmed in destination SHM, 2026-11-26
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: piker-es-rate-overwrite-20261126
|
||||||
|
:TAKEN_APPEND_OP: es-rate-evidence-20261126
|
||||||
|
:TAKEN_APPEND_REQUEST: c61f5725c7cbb4f655f66f243ed572123b22c2a1821b058d35599feb9b2d02ac
|
||||||
|
:END:
|
||||||
|
During cold IB backfill on land_fsp_sync the tester saw the chart
|
||||||
|
redraw. A read-only probe of a22c7439_fe0dd6fd.fsp for
|
||||||
|
es.cme.20261218.ib tracked completed nonzero samples by timestamp.
|
||||||
|
Related symptom: [[id:piker-fsp-manual-qualification-20261113][first-window volume stall on SPCX and TSLA]].
|
||||||
|
Through observation epoch 1795740070.636 it saw 55 field values
|
||||||
|
change to zero in five batches (29 trade_rate, 26 dark_trade_rate).
|
||||||
|
For sample 1795739984 both fields went from 4 to 0, observed at
|
||||||
|
1795739996.637. New nonzero samples accumulated between batches.
|
||||||
|
This localizes loss to FSP data upstream of graphics. Exact writer
|
||||||
|
and triggering messages still require tracing. Regression target:
|
||||||
|
preserve both completed tick-derived fields by sample timestamp
|
||||||
|
through a same-market 1s history prepend/resync, while new samples
|
||||||
|
continue to advance.
|
||||||
*** TODO publish and consume explicit feed-delay events
|
*** TODO publish and consume explicit feed-delay events
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:ID: piker-feed-delayed-event
|
:ID: piker-feed-delayed-event
|
||||||
|
|
@ -1438,6 +1659,84 @@ These are proposals for the human. Every existing headline state and
|
||||||
checkbox marker remains exactly as found. No parent acceptance or
|
checkbox marker remains exactly as found. No parent acceptance or
|
||||||
checkbox completion is inferred from a commit or this inventory.
|
checkbox completion is inferred from a commit or this inventory.
|
||||||
|
|
||||||
|
*** TODO Investigate sampler clock lag after suspend and startup row reversal
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: piker-sampler-suspend-clock-correctness
|
||||||
|
:CREATED: [2026-11-14]
|
||||||
|
:CARRIED: 0
|
||||||
|
:REPO: /home/goodboy/repos/piker
|
||||||
|
:TAKEN_APPEND_OP: piker-sampler-suspend-evidence-20261114
|
||||||
|
:TAKEN_APPEND_REQUEST: dfac3012cfd6833bec690c52184715212b42e5359eb352676f902614258b85d8
|
||||||
|
:END:
|
||||||
|
Objective: ensure resumed live samples have correct time labels across
|
||||||
|
SHM periods, and prevent duplicate/backward startup row timestamps.
|
||||||
|
Treat the observed stale labels as a potential data-correctness issue;
|
||||||
|
priority and acceptance remain human-owned.
|
||||||
|
|
||||||
|
Next action: reproduce with a controlled clock in isolated buffers,
|
||||||
|
then compare a fresh in-use runtime with the landing slice. Do not
|
||||||
|
restart the user's daemon or suspend their machine without direction.
|
||||||
|
|
||||||
|
Evidence and scope
|
||||||
|
Read-only inspection of land_fsp_sync on 2026-11-14 after the user's
|
||||||
|
long suspend/resume found generation 3b8159f3-d84b-4f. At 2026-11-15
|
||||||
|
01:47:14 and 01:47:19 UTC, BTC perpetual's 60s tail was labelled
|
||||||
|
2026-11-14 23:46 UTC, while its close changed 62270.0 -> 62261.2 and
|
||||||
|
volume 177.986 -> 199.779. The rt and both inspected FSP buffers
|
||||||
|
advanced together near current wall time. Their common suspend gap
|
||||||
|
was 23:34:51 -> 01:35:12 UTC (7221 seconds).
|
||||||
|
This establishes stale labels with live writes in SHM; persistence
|
||||||
|
of incorrectly labelled data has NOT been established.
|
||||||
|
|
||||||
|
The same rt/FSP buffers contain startup times 23:29:20, 23:29:21,
|
||||||
|
23:29:20, 23:29:21 UTC: one reversed adjacent step. Earlier runs had
|
||||||
|
one duplicate instead. Only one chart's FSP pair remained available
|
||||||
|
for this inspection; user reports both charts recovered visibly.
|
||||||
|
|
||||||
|
Evidence snapshot:
|
||||||
|
[[file:../../land_fsp_sync/.ai/state/backfill-validation/live-buffers-fsp-20261114.json][Read-only OHLCV/FSP snapshots]]
|
||||||
|
|
||||||
|
Mechanism and prior fixes
|
||||||
|
Sampler.increment_ohlc_buffer counts scheduled wakeups in total_s,
|
||||||
|
not elapsed wall time. For periods above 1s it appends previous time
|
||||||
|
plus the period. For 1s it uses rounded wall time, without checking
|
||||||
|
that the new timestamp exceeds the existing tail. No catch-up rows
|
||||||
|
are produced for the time asleep. Startup seeds rt rows at ts, ts+1.
|
||||||
|
The increment method is AST-identical in committed in-use
|
||||||
|
wkt/history_segment_refill@179a8c81 and land_fsp_sync@4166fd06;
|
||||||
|
startup seed assignments are equivalent. This is source evidence,
|
||||||
|
not a live reproduction on the in-use branch or its dirty checkout.
|
||||||
|
|
||||||
|
31c0a366 guarded stale trade ticks; 179a8c81 replaced that with the
|
||||||
|
IB-only startup-backlog filter. Neither corrects row-clock stepping.
|
||||||
|
Do not restore the superseded steady-state trade-slot guard.
|
||||||
|
Related startup reconciliation and its constraints remain owned by
|
||||||
|
[[id:piker-ib-startup-history-reconciliation][IB startup/history reconciliation]].
|
||||||
|
This task's observed suspend failure warrants a separate clock-policy
|
||||||
|
review, not silently changing those prior reconciliation constraints.
|
||||||
|
|
||||||
|
Execution and verification
|
||||||
|
- [ ] Inspect current in-use dirty changes and loaded module paths;
|
||||||
|
record exact revisions before attributing its behavior.
|
||||||
|
- [ ] Reproduce startup within the seeded second and a long clock
|
||||||
|
jump with isolated 1s/60s buffers. Assert actual row timestamps,
|
||||||
|
monotonicity and notifications, not just chart stepping.
|
||||||
|
- [ ] Reproduce suspend/resume on in-use when the user can run it;
|
||||||
|
compare pre/post wall time, tail labels, indices and live writes.
|
||||||
|
- [ ] Trace whether stale-labelled SHM rows can reach persistent
|
||||||
|
history, including subsequent backfill/refill reconciliation.
|
||||||
|
- [ ] Propose missed-period semantics: timestamp jump versus explicit
|
||||||
|
missing slots; account for venue closures, capacity, history-write
|
||||||
|
ownership, FSP alignment and write-before-notify ordering.
|
||||||
|
- [ ] Cover startup, ordinary delay, long suspend and clock rollback;
|
||||||
|
separate network delay from sampler clock advancement.
|
||||||
|
|
||||||
|
Handback
|
||||||
|
Return reproduction evidence, scope across periods/providers, any
|
||||||
|
persistence impact, a proposed clock policy and targeted regression
|
||||||
|
results. Keep the independent FSP history-loss/stuck-volume concern
|
||||||
|
open under [[id:piker-fsp-preserve-live-history-on-resync][its existing task]].
|
||||||
|
Do not mark this or linked tasks accepted on implementation/test success.
|
||||||
* TODO Diagnose Qt6 chart teardown SIGSEGV with native backtraces
|
* TODO Diagnose Qt6 chart teardown SIGSEGV with native backtraces
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:ID: piker-qt6-chart-teardown-sigsegv
|
:ID: piker-qt6-chart-teardown-sigsegv
|
||||||
|
|
@ -2056,6 +2355,216 @@ Verification and handback:
|
||||||
Use disposable storage and private actors for automated checks.
|
Use disposable storage and private actors for automated checks.
|
||||||
Do not reset farms, place orders or modify production TSDB data as
|
Do not reset farms, place orders or modify production TSDB data as
|
||||||
part of this follow-up without separate human authorization.
|
part of this follow-up without separate human authorization.
|
||||||
|
|
||||||
|
** TODO Reconcile IB startup quotes with initial history
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: piker-ib-startup-history-reconciliation
|
||||||
|
:CREATED: [2026-11-06]
|
||||||
|
:CARRIED: 0
|
||||||
|
:REPO: /home/goodboy/repos/piker
|
||||||
|
:CATEGORY: piker.data
|
||||||
|
:END:
|
||||||
|
Replace the working IB startup-backlog exclusion workaround with
|
||||||
|
quote/history reconciliation, reusing existing refill and tracing
|
||||||
|
work. Keep the temporary filter until its replacement is qualified.
|
||||||
|
The human reports that the current workaround resolves the observed
|
||||||
|
spike; this is not an investigation of an ongoing reproduced failure.
|
||||||
|
|
||||||
|
Next action: recheck the receiving checkout and loaded module paths,
|
||||||
|
then reproduce the mutable-Ticker hazard deterministically. Establish
|
||||||
|
stable packet capture before designing the finite startup handoff.
|
||||||
|
Use a fresh trace to validate the overlap policy when useful; a
|
||||||
|
recurrence of the original spike is not a prerequisite.
|
||||||
|
|
||||||
|
*** Baseline and existing work
|
||||||
|
Receiving source: piker. Active checkout after the authorized
|
||||||
|
fast-forward and rename:
|
||||||
|
=/home/goodboy/repos/piker/wkts/history_segment_refill=
|
||||||
|
Branch: =wkt/history_segment_refill=
|
||||||
|
Base at handoff: =179a8c81e655a0e0d4ff8a746b8a4bdb2814b949=
|
||||||
|
"Limit IB trade filtering to its startup backlog"
|
||||||
|
|
||||||
|
The former =wkts/ib_history_request_bounds= checkout was moved here;
|
||||||
|
it is not a second working copy. Its substantial staged refill,
|
||||||
|
storage, CLI, UI, tests and documentation remain separate from this
|
||||||
|
assignment. Preserve the staged index and all unstaged/untracked
|
||||||
|
work, particularly =ib/feed.py=, which has both kinds of changes.
|
||||||
|
The previous unstaged round(tick_s) slot guard was removed during
|
||||||
|
replant; only tracing was carried into the newer sampler. Do not
|
||||||
|
restore the obsolete guard from recovery copies or older tests.
|
||||||
|
|
||||||
|
The evaluation checkout remains:
|
||||||
|
=/home/goodboy/repos/piker/wkts/ib_downstream_pin_eval=
|
||||||
|
At origin handoff it was on =sampler_tick_time_guard= at the same
|
||||||
|
base, with only =pyproject.toml= and =uv.lock= dirty for a temporary
|
||||||
|
Trio/editable-Tractor setup. No new startup implementation was
|
||||||
|
written there. Reverify that snapshot before relying on it.
|
||||||
|
|
||||||
|
=179a8c81= replaces =31c0a366='s steady-state slot matching/waiting
|
||||||
|
with backend-owned =ib._util.StartupTradeFilter=. It excludes IB
|
||||||
|
packets received before consumption starts until the first post-start
|
||||||
|
stamped trade, then stops filtering that symbol's timestamps.
|
||||||
|
This is exclusion, not history-overlap reconciliation.
|
||||||
|
|
||||||
|
At the original audit, =manage_history()=, =query_latest_frame()=,
|
||||||
|
=publish_latest_frame()= and =_prepend_tsdb_history()= had the same
|
||||||
|
structure across the two working trees. The new refiller is awaited
|
||||||
|
after startup; it does not implement startup reconciliation.
|
||||||
|
=07d8cf5a= is an ancestor of both branches, and =fsp/_engine.py= was
|
||||||
|
byte-identical. Do not duplicate that FSP synchronization fix.
|
||||||
|
|
||||||
|
*** Evidence and limits
|
||||||
|
The origin agent collected no wire boot trace. Its evidence was
|
||||||
|
console warnings and read-only SHM observations. The documented
|
||||||
|
=/tmp/mnq-ib-boot.jsonl= was an example, not a verified capture;
|
||||||
|
that path was absent during receiving-agent intake.
|
||||||
|
|
||||||
|
Source inspection confirms that =_setup_quote_stream.push()= queues
|
||||||
|
mutable =Ticker= references and =stream_quotes()= normalizes later.
|
||||||
|
The installed =ib_async= wrapper clears tick lists on later packets.
|
||||||
|
This is a concrete data-integrity hazard, not proven attribution of
|
||||||
|
the original spike. Scalar fields and tick lists both need checking.
|
||||||
|
|
||||||
|
The receiving interpreter resolved the Piker modules to
|
||||||
|
=wkts/history_segment_refill=. Its installed versions at intake were
|
||||||
|
=tractor 0.1.0a6.dev0=, =trio 0.32.0= and =ib_async 2.1.0=.
|
||||||
|
These were local-process probes, not live parent/child actor evidence.
|
||||||
|
Do not assume this environment equals the evaluation checkout's
|
||||||
|
editable-runtime setup or the current lock file.
|
||||||
|
|
||||||
|
*** Agreed design constraints
|
||||||
|
- =samplerd= remains the shared clock advancing registered buffers.
|
||||||
|
Its labels do not promise provider-event-time placement.
|
||||||
|
- Normal datad sampling writes accepted trades into current SHM
|
||||||
|
tails before notifying subscribers. Preserve write-before-notify
|
||||||
|
for TCP/UDS and future lower-latency notification transports.
|
||||||
|
- Do not match every live timestamp against sampler labels, poll
|
||||||
|
for a matching second, or permanently reject delayed live ticks.
|
||||||
|
Actor scheduling and transport delays are expected.
|
||||||
|
- Do not restore a concurrent SHM writer/queue which notifies
|
||||||
|
consumers before applying their trade data.
|
||||||
|
- Do not introduce epoch-flooring, aligned-clock or catch-up changes
|
||||||
|
to compensate for the guard; those speculative changes were removed.
|
||||||
|
- Provider-specific timestamp and overlap interpretation belongs
|
||||||
|
in the backend, not a broker-name policy in generic sampling.
|
||||||
|
- Retain the temporary workaround until its replacement is qualified.
|
||||||
|
Passing guard tests do not prove exact volume reconciliation.
|
||||||
|
|
||||||
|
*** Existing infrastructure to reuse
|
||||||
|
- =ib._trace.trace_ib_wire()=: scoped raw callback and parsed-tick
|
||||||
|
capture, restoring wrapper methods on teardown.
|
||||||
|
- =data._boot_trace.BootTrace=: opt-in bounded JSONL diagnostics.
|
||||||
|
- Normalization and sampler pre/post-write trace integration.
|
||||||
|
- =docs/ib_boot_trace.rst= and
|
||||||
|
=tests/providers/test_ib_boot_trace.py=.
|
||||||
|
- Staged =tsp._refill.Refiller=, durable request journals, store CLI,
|
||||||
|
and price/volume graphics invalidation after in-place repairs.
|
||||||
|
|
||||||
|
[[file:../../history_segment_refill/docs/ib_boot_trace.rst][Trace stages and invocation]]
|
||||||
|
[[file:../../history_segment_refill/piker/brokers/ib/_trace.py][Raw callback capture]]
|
||||||
|
[[file:../../history_segment_refill/docs/history_segment_backfill.rst][Refill ownership and limitations]]
|
||||||
|
|
||||||
|
Trace writes and refill journal serialization/fsync are synchronous.
|
||||||
|
Enabled tracing can perturb timing; distinguish that overhead from
|
||||||
|
normal operation. Refill's provider lock does not serialize startup
|
||||||
|
quotes/history, but synchronous work can stall sibling tasks.
|
||||||
|
|
||||||
|
*** Startup boundary to implement and review
|
||||||
|
1. Capture stable packet records at the IB callback boundary.
|
||||||
|
=ib_async= mutates/reuses Ticker and clears its tick lists at the
|
||||||
|
next packet. Queuing references does not preserve packet contents.
|
||||||
|
Verify scalar fields and tick-list contents against later mutation.
|
||||||
|
2. Keep an early configuration handshake so history loading can start.
|
||||||
|
The allocator awaits quote startup before =manage_history()=;
|
||||||
|
withholding that result until history exists would deadlock it.
|
||||||
|
3. Coordinate initial history with backend-owned startup capture.
|
||||||
|
Record live-flag time, first actual stream packet, per-timeframe
|
||||||
|
history receipt time and final provider bar, and a finite capture
|
||||||
|
boundary. Do not conflate packet receipt with execution time.
|
||||||
|
4. Reconcile a finite captured prefix, then hand subsequent packets
|
||||||
|
to ordinary live processing exactly once. Do not depend on an
|
||||||
|
active queue eventually becoming empty.
|
||||||
|
5. Complete initial SHM reconciliation before shared-clock
|
||||||
|
advancement owns the buffers, or specify an equally explicit
|
||||||
|
ownership handoff. Current sampler registration precedes initial
|
||||||
|
history loading, so this needs deliberate restructuring.
|
||||||
|
6. Preserve separate readiness concepts: early configuration,
|
||||||
|
usable history, reconciled startup and live readiness. Leave room
|
||||||
|
for cached-history-first display and chart indicators.
|
||||||
|
|
||||||
|
=some_data_ready= signals history readiness. =sub_registered= is set
|
||||||
|
following Flume delivery and subscriber registration, before sampling.
|
||||||
|
Do not require subscriber registration while withholding the Flume.
|
||||||
|
Post-capture quotes must remain ordered live input across this gap.
|
||||||
|
|
||||||
|
FeedInit is frozen and =validate_backend()= msgpack-copies it. Keep
|
||||||
|
runtime events/channels outside its serialized fields; an actor-local
|
||||||
|
startup companion/result is a candidate boundary.
|
||||||
|
|
||||||
|
Preserve the two-function layout:
|
||||||
|
- =maybe_allocate_persistent_feed()=: resolve/reuse and own lifetime.
|
||||||
|
- =allocate_persistent_feed()=: allocate and return explicit state.
|
||||||
|
Avoid forwarding helpers justified only by indentation.
|
||||||
|
|
||||||
|
*** Reconciliation policy remains a review obligation
|
||||||
|
The human accepts approximate startup placement using local timing
|
||||||
|
and history-bar bounds. That does not prove exact volume overlap.
|
||||||
|
|
||||||
|
Candidate policy: preserve provider-covered bars, construct uncovered
|
||||||
|
startup intervals, and derive an open minute from reconciled 1s rows
|
||||||
|
only where coverage is sufficient. Make ambiguous unfinished-bar
|
||||||
|
behavior explicit. Do not blindly add potentially duplicated volume
|
||||||
|
or invent missing data.
|
||||||
|
|
||||||
|
Use deterministic tests and, when available, fresh traces to separate
|
||||||
|
raw IB size, parsed ticks, mutable-object transfer and SHM accumulation.
|
||||||
|
There is no historical wire capture establishing the original cause.
|
||||||
|
|
||||||
|
*** Verification
|
||||||
|
- [ ] Record module paths/runtime versions in parent and child actors;
|
||||||
|
checkout names and CLI working directories do not prove what loaded.
|
||||||
|
- [ ] Prove later Ticker mutation cannot change captured packets.
|
||||||
|
- [ ] Prove every packet belongs to exactly one side of the cut.
|
||||||
|
- [ ] Exercise initial-frame overlap and partial coverage with explicit
|
||||||
|
expected OHLCV, including duplicated volume and uncovered trades.
|
||||||
|
- [ ] Assert SHM contents at actual IPC notification receipt.
|
||||||
|
- [ ] Cover quiet markets, cancellation, bounded capture failure and
|
||||||
|
producer cleanup without changing steady-state clock semantics.
|
||||||
|
- [ ] Reuse actor-backed tests; avoid a parallel large fake chart
|
||||||
|
framework or duplicating committed resolver/cache tests.
|
||||||
|
- [ ] Respect repair/synthetic-range metadata and FSP/UI invalidation
|
||||||
|
when startup or later back-correction changes rows.
|
||||||
|
|
||||||
|
Origin evidence: 14 temporary-policy tests, 26 related tests and two
|
||||||
|
actor-backed cases passed. Receiving replant checks: 65 targeted tests
|
||||||
|
passed, including sampling, tracing, refill, history and CLI cases.
|
||||||
|
These are bounded regression evidence, not qualification of the proposed
|
||||||
|
startup design or human acceptance of the staged refill implementation.
|
||||||
|
|
||||||
|
*** Related assignments
|
||||||
|
[[id:piker-chart-startup-latency-readiness][Startup latency and readiness parent]]
|
||||||
|
[[id:piker-feed-cache-first-resolution][Cache-first resolution and native metadata handoff]]
|
||||||
|
[[id:piker-fsp-backfill-sync-review-and-commit][FSP synchronization qualification]]
|
||||||
|
|
||||||
|
Read these contexts, but keep this assignment focused on startup
|
||||||
|
correctness. Do not expand it into every backend migration or the
|
||||||
|
whole startup-latency redesign. The originating agent retains runtime
|
||||||
|
qualification and landing work.
|
||||||
|
|
||||||
|
*** Execution and handback
|
||||||
|
Follow current py-codestyle: multiline named arguments, tuple-style
|
||||||
|
async with, clear task/scope ownership, quoted code/library names,
|
||||||
|
and lowercase =trio=. Preserve maintained comments and human edits.
|
||||||
|
|
||||||
|
Use disposable storage and private actors for automated tests. Live
|
||||||
|
Gateway resets, orders, production TSDB writes, staging, commits and
|
||||||
|
Git-history operations require separate human authorization.
|
||||||
|
|
||||||
|
Return trace findings, explicit handoff/data contracts, overlap policy
|
||||||
|
and limitations, small reviewable patch boundaries, test commands and
|
||||||
|
results, and unresolved concerns to this task. Passing tests do not
|
||||||
|
authorize changes to human-owned acceptance markers.
|
||||||
|
|
||||||
* TODO Resolve feed metadata once using provider-owned symcache
|
* TODO Resolve feed metadata once using provider-owned symcache
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:ID: piker-feed-cache-first-resolution
|
:ID: piker-feed-cache-first-resolution
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue