Skip to content

fix: preserve calendar declarations and session boundary semantics - #94

Merged
stefan-jansen merged 14 commits into
mainfrom
fix/session-calendar-contract
Oct 17, 2026
Merged

stefan-jansen merged 14 commits into
mainfrom
fix/session-calendar-contract

Conversation

@stefan-jansen

@stefan-jansen stefan-jansen commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #93

Outcome

Session APIs now resolve the canonical calendar through shared FeedSpec: explicit selection, declared feed metadata, then NYSE. Explicit None preserves observations unchanged with no session column or grid expansion. The constructor's old positional/calendar_name forms and explicit exchange selector remain supported, but conflicting explicit selectors fail. Descriptive metadata exchange is not inferred as a selector.

Data Metadata preserves version-2 omitted calendar versus explicit null through JSON/copy/shared projection, with version-1 null inheritance retained. Temporal normalization and serialization use Specs, not a second resolver. Declared timezone, timestamp semantics and grid fields survive metadata bridges.

Provider-driven updates retain explicit null in the metadata payload and reject invalid temporal declarations atomically instead of silently dropping them. The calendar-disable storage round trip is a positive control on the old implementation because the backend already preserves it; the two invalid-declaration mutations are the reproduced update defects. Provider reuse itself is a separate finding and is not hidden behind a broad ValueError assertion here: these update tests explicitly select the real synthetic provider.

Event intervals use [open,close), selecting the new session at continuous midnight. Close-labeled bars use (open,close], including exchange close and break start; explicit declarations override frequency/midnight heuristics. Lunch breaks and declared calendar interruptions are excluded using the same tradable intervals in assignment and completion. Daily labels remain unique when a session contains multiple tradable intervals. Session labels retain civil dates. Naive instants use existing UTC unless a timezone is declared; ambiguous local clocks fail. Existing outside-session null/raise/drop behavior remains.

DataManager's session operations now use one implementation with and without storage. fill_gaps=False assigns without expansion. Minute completion remains the existing open-labeled operation, rejects unsupported close/session-label metadata and honors calendar=None. This is not a claim of general intraday completeness or roll-calendar conformance.

Executed verification

  • Base55b86e250fd6279222876c5a1e4c20ae1469d7fa, imported from an isolated immutable archive: ten real workflow failures and one passing control among existing public API calls. These reproduce default/None errors, lost midnight session, ignored no-fill flag and silently conflicting selectors, not new-keyword TypeErrors.
  • Regression-only42aa185: original24 cases produce20 failures/4 controls passing.
  • Current head14cb9957f07763eef490ea09acd42cba010aa185 includes merged provider repairc7b9dfa without rewriting published work. Invalid-temporal update cases fail twice on immutable55b86e2 with one disabled-calendar control passing. Empty timezone silently becoming UTC in both adapters is reproduced and rejected. Additional actual provider/model tests reproduce ignored event-count/non-minute completion, dropped session-start metadata and ignored general-grid policy; the current revision preserves declarations and explicitly rejects unsupported adapters. Full hosted gates must qualify the new exact combined head; previous-head green checks do not substitute for them.
  • Ruff lint/format, ty, diff check and commit hooks passed. Full supported CI/resource/package/ecosystem and strict documentation gates must finish before ordinary merge. They run hosted; no heavy local suite or benchmark during Backtest's reserved timing window.
  • Native interruption regression99df664 on sourcef57c8d9: six actual public-workflow failures and one daily-label control pass. Registered schedule with two halts, real SyntheticProvider minute rows: assignment incorrectly accepts halt rows and completion fabricates30 rows or accepts an observation during the halt. Fixed at14cb9957f07763eef490ea09acd42cba010aa185;148 focused session/range/provider tests pass in11.66s, native caps1 and ResourceWarning as error. Strict documentation build1.65s, full Ruff/format/ty and normal commit hooks pass. Full hosted qualification is pending at the new exact head.

Review and assistance

AI-assisted implementation, regressions and prose under maintainer direction. Owner reviewed actual source diff, shared contract/version semantics, old signatures, non-mutating disabled behavior, continuous/close/break interval boundaries, facade parity and metadata serialization. No independent reviewer is claimed. Separate range-planner PR92 changes different implementation files; remaining general intraday-grid, ingestion propagation and futures-roll work stays explicit. No release/deployment or change to published0.2.1; Specs source pin remains701bde68744035050ede386efce498234c661c21.

Copilot AI balanced review requested due to automatic review settings October 17, 2026 14:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@stefan-jansen
stefan-jansen merged commit da7d259 into main Oct 17, 2026
27 checks passed
@stefan-jansen
stefan-jansen deleted the fix/session-calendar-contract branch October 17, 2026 17:16
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.

fix: preserve calendar declarations and instant boundaries in session APIs

2 participants