Skip to content

[truealpha-factors] Implement pinned Qlib selection adapter - #187

Merged
wangzitian0 merged 3 commits into
mainfrom
batch/s7-qlib-selection-e0
Jul 14, 2026
Merged

[truealpha-factors] Implement pinned Qlib selection adapter#187
wangzitian0 merged 3 commits into
mainfrom
batch/s7-qlib-selection-e0

Conversation

@wangzitian0

Copy link
Copy Markdown
Owner

What changed

  • add a pinned pyqlib==0.9.7 selection adapter for the frozen S7 issuer corpus
  • isolate Qlib in the workspace-excluded libs/factors/qlib-runtime project with its own lock; the root lock is unchanged
  • validate full candidate identity, PIT cutoff, confidence, Decimal ordering, and float64 transport before Qlib execution
  • require Qlib top-N membership to match an independent test-only Decimal oracle exactly
  • activate S7 at E0 with a content-addressed integration lease and governance graph update

Boundary

This PR proves one single-cutoff, empty-portfolio top-N membership slice only. It does not claim persistent holdings, TopkDropout turnover semantics, sizing, trades, costs, event-clock replay, approved product semantics, or release readiness. Those remain in #26 and #59/#21.

Qlib is execution infrastructure behind a TrueAlpha adapter. TrueAlpha remains authoritative for PIT snapshots, provenance/lineage, confidence, Decimal-sensitive calculations, identity, and fail-closed output validation.

Validation

  • isolated Qlib runtime: 17 passed
  • targeted Ruff: passed
  • mypy: passed, 90 source files
  • fresh UTF-8 PostgreSQL make check: 660 passed, 4 skipped
  • root uv.lock: unchanged

Issue: #181
Architecture record: #182

Copilot AI review requested due to automatic review settings July 14, 2026 12:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an S7 “pinned Qlib selection adapter” in libs/factors that converts the frozen S6 issuer valuation-gap outputs into a deterministic top‑N selection result, while keeping Qlib isolated in a workspace-excluded runtime project and updating governance artifacts to activate the batch.

Changes:

  • Add the S7 selection adapter kernel + public exports, including strict identity/binding validation and Decimal→float64 order/collision checks before Qlib execution.
  • Add a frozen-corpus test suite that asserts exact corpus/lock hashes and parity between the adapter output and an independent Decimal oracle.
  • Isolate Qlib in libs/factors/qlib-runtime (separate lock) and update governance manifest/lease + vision issue graph to reflect S7 activation.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pyproject.toml Excludes libs/factors/qlib-runtime from the root uv workspace to keep the root lock unchanged.
libs/factors/tests/batches/issuer_strategy_selection_tiny/test_kernel.py Adds frozen-corpus and adapter/oracle parity tests, plus negative controls for identity/denominator corruption and precision hazards.
libs/factors/src/factors/batches/issuer_strategy_selection_tiny/kernel.py Implements the pinned-Qlib selection adapter, execution binding model, and fail-closed result schema.
libs/factors/src/factors/batches/issuer_strategy_selection_tiny/init.py Exposes the adapter’s public API surface for the batch module.
libs/factors/qlib-runtime/pyproject.toml Defines the isolated Qlib runtime project pinned to pyqlib==0.9.7.
governance/vision-issue-graph.json Advances S7 batch status/target rung and updates the manifest hash pointer.
governance/leases/S7-issuer-strategy-selection.v1.json Adds an active integration lease covering the shared integration-surface paths touched by this batch.
governance/batches/S7-issuer-strategy-selection.v1.json Activates the S7 manifest revision, pins corpus + Qlib lock identity, and records acceptance commands for the isolated runtime.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libs/factors/src/factors/batches/issuer_strategy_selection_tiny/kernel.py Outdated
@wangzitian0
wangzitian0 merged commit 891ea69 into main Jul 14, 2026
11 checks passed
@wangzitian0
wangzitian0 deleted the batch/s7-qlib-selection-e0 branch July 14, 2026 12:40
@wangzitian0 wangzitian0 changed the title [truealpha-data] [S7:E0] Implement pinned Qlib selection adapter [truealpha-factors] Implement pinned Qlib selection adapter Jul 15, 2026
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.

2 participants