[truealpha-factors] Implement pinned Qlib selection adapter - #187
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.
This was referenced Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
pyqlib==0.9.7selection adapter for the frozen S7 issuer corpuslibs/factors/qlib-runtimeproject with its own lock; the root lock is unchangedBoundary
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
make check: 660 passed, 4 skippeduv.lock: unchangedIssue: #181
Architecture record: #182