Skip to content

security: session-day calendar boundaries + mid-UTC-day tz-offset memo - #160

Merged
luisleo526 merged 1 commit into
mainfrom
sec-history-offset
Aug 23, 2026
Merged

security: session-day calendar boundaries + mid-UTC-day tz-offset memo#160
luisleo526 merged 1 commit into
mainfrom
sec-history-offset

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

Round 2 of the symbol campaign (follows #159). Two coupled defects kept FX daily/weekly request.security series wrong while equities looked fine.

Defect 1 — calendar clock. D/W/M keys split at symbol-local midnight; TV forex candles run 17:00-ET → 17:00-ET (measured: all 472 TV probe triggers satisfied by the session-day cut, zero by any midnight cut — reconstruction in ledger finding 402 follow-ups). Calendar periods now ride the session-day clock. Equities coincide with local midnight, so their series are unchanged.

Defect 2 — tz memo poisoning. The per-UTC-day offset memo paired the local midnight with the query instant's UTC floor. Any bar whose local date straddles UTC midnight (every FX evening bar) seeded the whole UTC day with −20h instead of +4h — splitting every HTF candle in two with a spurious boundary completion and a bogus evening-fragment close. The memo now samples at mid-UTC-day: constant and correct all day, DST-safe (transitions land while session markets are closed).

Evidence @ 46d4f64 (codegen unchanged at 726a0f4):

lane result
EURUSD probes htf-bucket-d 8.6% → 100% (471/471), 240m 76% → 100% (1296/1296)
EURUSD population e+s 307 → 327 (+20); ups 36 / downs 34
AAPL population e+s 241 → 246; ups 18 / downs 16
ETH scraped 396/396 excellent, 0 up / 0 down (fresh grade at this tree)
ETH corpus 312/312 ok, 309/2/1 identical tiers, zero regressions (fresh run)
unit tests 133/133

Known residual (next round): probe-vs-tv on the EURUSD daily probe reports 10 engine-only fills beyond TV's export window edge (window-edge mechanics, not level semantics); weekly FX anchor uses ISO-Monday of the session-day clock vs TV's Sunday-17:00 week start — W probe still divergent, queued.

Symbol-gate PASS · pr-gate PASS (tie carried by trendmatrix MATCH probe, 822/822).

Two defects kept FX daily/weekly request.security series wrong while
equities looked fine:

- Calendar D/W/M keys split at symbol-local midnight; TV forex candles
  run 17:00-ET -> 17:00-ET (measured 472/472 TV triggers satisfied by
  the 17:00 session-day cut, zero by local-midnight cuts). Calendar
  periods now ride the session-day clock; equities coincide with local
  midnight, so their series are unchanged.
- The per-UTC-day tz-offset memo paired the LOCAL midnight with the
  QUERY instant's UTC floor: any bar whose local date straddles UTC
  midnight (FX evenings) seeded the whole UTC day with a negative
  offset, splitting every HTF candle in two with a spurious boundary
  completion + bogus fragment close. Sample the offset at mid-UTC-day:
  constant, correct, DST-safe.

24x7 symbols return before the memo (ETH byte-identical); equity RTH
bars never straddle a UTC date (values identical).

Evidence @ this tree: EURUSD htf-bucket probes D 8.6%->100% (471/471),
240m 76%->100% (1296/1296); population e+s EURUSD 307->327 (+20), AAPL
241->246; ETH scraped 396/396 zero moves; corpus 309/2/1 identical,
zero regressions; 133/133 unit tests.
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