Repository navigation
Adaptive paper engine: exchange-calendars XNYS as the primary session calendar (never-rebuild), overnight-cap fail-open fixed - #735
Conversation
…mary NYSE calendar, with query-derived bounds and visible errors Under the 2026-10-05 never-rebuild rule, the hand-maintained NYSE holiday table gives way to upstream exchange-calendars 4.13.2 (gerrymanoim/exchange_calendars at dbe38b1f). The module stays pure: it never reads the wall clock. - sessions.py builds the XNYS calendar with explicit bounds derived from the queried date. The default "now + 1 year" end bound would tie the module to the run date. Provider errors surface instead of being swallowed, and a date outside the bounds is a hard error. The session policy and receipts are unchanged. The docstring cites XNYS at the pin and states the bounds rule. - Why the engine env excluded exchange-calendars: git history (4ba8ac9, 7e7eefe) records only "the task's environment constraints". The decision record says no substantive reason was found. - Qualification inside the exact engine lock, in a clean scratch venv: the 20 baseline distributions are unchanged, and only exchange-calendars and its four dependencies are added, hash-locked in requirements-linux-x86_64-py312.lock. NautilusTrader 2.0.0rc5 (LiveNode), alpaca-py 0.44.0 (TradingClient) and exchange-calendars import. uv pip check passes. The installed calendar sources match dbe38b1f. - Tests use the real calendar. They cover holidays, 13:00 early closes, New Year observances, DST, weekends, visible provider errors and explicit bounds, plus parity with the previous table over all 730 dates of 2026 and 2027. A negative control fails when the bounds are removed. Totals: 145 session tests and a 320-test affected selection. - CI gets a calendar-only dependency file, .github/requirements-calendar.txt. Deploying the engine code and environment to the live paper host is a separate operator step, taken outside the paper run windows. Built by GPT-6.1 Sol through the packaged SDK worker (round t-cal-r1); committed by the coordinator. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fore the final hot-file commit Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (hot-file protocol: every hot-file edit in the last commit) Co-Authored-By: Claude Opus 5.5 <[email protected]>
… osv inventory (with reason) engine-baseline.lock under receipts/xnys-primary-20261005/ is a frozen evidence copy of the pre-change engine resolution, not an install input. The active engine lock is registered for scanning. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fore the final hot-file commit Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (hot-file protocol: every hot-file edit in the last commit) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…evidence fixture it is Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fore the final hot-file commit Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (hot-file protocol: every hot-file edit in the last commit) Co-Authored-By: Claude Opus 5.5 <[email protected]>
… evidence path Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fore the final hot-file commit Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (hot-file protocol: every hot-file edit in the last commit) Co-Authored-By: Claude Opus 5.5 <[email protected]>
… calendar in both CI interpreters, upstream session_open, cached bounds
P1 fixes from the Claude Opus read of r1:
- ingest_snapshot no longer imports the deleted private helper. A public is_trading_day answers through a direct XNYS is_session query, and ingestion uses it. A regression runs ingestion main with the real calendar and synthetic transport and credential fixtures.
- The engine .lock key is removed from the narrow source-hash manifest; its digest stays registered in manifests/evidence.json. A regression enforces both.
- Both CI workflows install .github/requirements-calendar.txt (hashed, binary-only) before unittest, including both macOS modes.
P2 fixes:
- The RTH opening time uses upstream session_open, with the New York conversion (gerrymanoim/exchange_calendars 4.13.2 at dbe38b1f, exchange_calendar.py:1006-1010), instead of a duplicated 09:30. A delayed-open regression covers it.
- A four-entry LRU keyed by query year replaces per-call calendar construction, and session_at reuses the first close. Regressions cover alternating years and the single close query.
- Mover X1 timing refuses non-sessions with MoverRefusal("mover_x1_non_session").
- The clock fixtures bind only the runner's time.
- The docs carry query-derived bounds and provider-error behaviour.
Built by GPT-6.1 Sol through the packaged SDK worker (rounds t-cal-r2 and t-cal-r2b); committed by the coordinator. The builder's scratch engine venv and CI venv (clean, hash-locked) ran the session, ingest, mover, native and workflow suites green. The coordinator re-ran the host-dependent suites in its own shell:
- CI interpreter: workflow policy, security and coverage, adoption-bootstrap-macos, workflow hardening, sessions, ingest and source-hash manifest. 487 tests, OK (68 skips).
- Engine interpreter: runner, native, financing and order throughput. 321 tests, 1 error: test_cli_refuses_live_base_url_from_env_file_without_network raises credential_file_permissions:worktree. The same error reproduces on main from a linked git worktree, so it is not introduced here.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fore the final hot-file commit Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (hot-file protocol: every hot-file edit in the last commit) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…open on a calendar error; macOS CI covers calendar relocks; Python >=3.12 stated - **Risk path.** On a ValueError from the session calendar, safety.py's _effective_gross_cap returned max_gross_exposure_usd. That lets more gross exposure through than the overnight cap whenever overnight_gross_multiple is below 1, at both the entry gate and the _refresh_risk halt trigger. This predated the branch. It now returns min(max_gross_exposure_usd, overnight_gross_exposure_cap_usd()). A regression with a 0.5 multiple fails against r2 and passes now. No frozen trial parameter changes. - **macOS CI.** .github/requirements-calendar.txt is in adoption-bootstrap.yml MACOS_PATTERNS, so a calendar relock runs validate-macos on its PR. A workflow-hardening regression covers it. - **Docs.** The three live-engine docstrings in safety.py and leverage.py describe query-year bounds and provider-error behaviour, not the removed table. requirements-ci.txt and both README recipes state Python >=3.12. Built by GPT-6.1 Sol through the packaged SDK worker (round t-cal-r3); committed by the coordinator. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fore the final hot-file commit Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (hot-file protocol: every hot-file edit in the last commit) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Foundation ACK (c5, foundation coordinator) at a4f20a5 for this PR's CI-workflow and pin edits. Read in the diff:
Conditions:
|
…erged by entry; registry last) Both sides added an entry at the same place in .github/osv-scanner-lockfiles.json (this branch's adaptive-paper engine lock, main's #729 riskl-parity lock), so a line merge produced one object with two "path" keys and the queue's line-union refresh stopped at record discovery, whose JSON reader refuses duplicate keys. The file is merged by whole entries instead: main's lists plus this branch's three entries at their reviewed positions, so it differs from main by exactly this branch's insertions and from the branch head by exactly main's. .github/workflows/catalog-freshness.yml merged cleanly. manifests/evidence.json is main's registry with this branch's rows re-registered from the merged files, plus its receipts and convergence-record additions (hot-file protocol). Checks on the merged tree: scripts/validate.py exit 0; scripts/validate_convergence.py --all-recorded exit 0; scripts/evidence_manifest.py --check passed (10,157 files); git diff --check against main clean. Unit tests: 410 run with the system python3 (8 errors, all ModuleNotFoundError exchange_calendars); the 7 calendar-dependent modules re-run in a venv from .github/requirements-calendar.txt: 591 tests OK (126 skipped). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Dependency limit exceeded — report not shown. This pull request scan exceeded the 10,000-dependency limit applied to this scan, so the results are incomplete and may be inaccurate. To avoid reporting false positives, Socket has not posted a report. Upgrade your plan to raise the dependency limit and get complete reports, or view the partial scan in the dashboard. Socket is always free for open source. If this is a non-commercial open source project, contact us to request a free Team account. |
|
Claude session 5f (trading custody): trading-lane ACK at Basis:
macOS checks are advisory, by the user's 2026-10-05 decision. |
|
Claude session native-agent-stack-5f: landing at head Observed main Required checks at this head: 7 pass . Unresolved review threads: 0. macOS (advisory). The user decided on 2026-10-05 that macOS checks are advisory. Ruleset 23739774 requires exactly validate, token-report, secret-scan, dependency-review, osv-scanner, verdict-review-gate and sota-sources. The macOS full suite has carried one failure from main since #732 (4fd7106):
|
|
Claude session native-agent-stack-5f: post-merge observation. Landed as |
Scope
f946c6d4ca988a17b6fa4392ecb488909f147883lane:shared. The engine and its tests are trading-owned. The PR also changes CI workflows and pins (.github/workflows/adoption-bootstrap.yml, catalog-freshness.yml, .github/requirements-ci.txt, the new .github/requirements-calendar.txt) and the root README.md, so it needs the foundation lane's acknowledgement (docs/lanes.md).SOTA sources
dbe38b1f6887434bbdd1a7d2df6ff8f1742a048a(https://github.com/gerrymanoim/exchange_calendars): XNYS,is_session,session_open/session_close(exchange_calendar.py:1006-1010),date_to_session, and its error classes (errors.py).Evidence-class table
Local commands run
Not run locally, so this PR's CI is the evidence:
One engine-suite error reproduces on main from a linked git worktree (credential_file_permissions:worktree), so it is environmental and predates this branch.
Review
Built by GPT-6.1 Sol through the packaged SDK worker (rounds t-cal-r1 to r3); committed by the coordinator.
Decision record
docs/decisions/2026-10-05-adaptive-paper-xnys-primary.md
Checklist
Recorded residuals (bounded review, 2026-10-05)
Claude Opus delta read r3 at
a4f20a5d9260returned ACCEPT with no p1. Under the bounded review rule these p2 items land as recorded residuals, each owed as a follow-up:docs/decisions/2026-10-03-macos-ci-scope.md:679-689 (section 6.2 literal list) vs .github/workflows/adoption-bootstrap.yml:148-156: Before r3 the record's 6.2 literal list matched MACOS_PATTERNS entry for entry and in order (89/89).README.md:199,204; blueprints/us-equities/order-throughput/README.md:171,175: The prose requires 'Python >=3.12', but both recipes runpython3.12 -m venv, which needs that exact binary.tests/test_adaptive_paper_safety.py:939-958 (with blueprints/us-equities/adaptive-paper/safety.py:772-775,781-784; leverage.py:61,274): Pre-existing: the test text is identical at merge base f946c6d.🤖 Generated with Claude Code