Skip to content

Commit aaae910

Browse files
Pigbibicodex
andauthored
Add QSL bundle 2026.07.1 and checker transition tests (#152)
Co-authored-by: Codex <noreply@openai.com>
1 parent 572761a commit aaae910

3 files changed

Lines changed: 141 additions & 14 deletions

File tree

compat/bundles/2026.07.1.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name = "2026.07.1"
2+
description = "Phase-2 QSL compatibility bundle (strict transition warning convergence)"
3+
created_at = "2026-07-03"
4+
5+
[repos]
6+
QuantPlatformKit = "7032cde4547e7ec59af15df8935d142461a77051"
7+
UsEquityStrategies = "9f0e5e2deca8a9c16d711eb4772f08a7901da101"
8+
HkEquityStrategies = "00dd0e5b62a6fa65bd9262e15c083468e8b8c191"
9+
CnEquityStrategies = "c6d680d6d2690fe6ff77872355719751c021f9a0"
10+
CryptoStrategies = "c0203b66746efb63e79f4d4bc9a65758c342817e"
11+
QuantStrategyPlugins = "1f3a27b8fd83d71b583f4f5160a748e95fbefaa1"
12+
MarketSignalSources = "bda8ab10b80a646e4b579ef4c0d5dfe90776e908"

docs/qsl_compat_upgrade.md

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# QSL Compatibility & Upgrade Checklist (Central Manifest Phase-1)
1+
# QSL Compatibility & Upgrade Checklist (Central Manifest)
22

3-
This repository carries the first version of the QSL central compatibility manifest.
3+
This repository defines the QSL central compatibility manifest and its upgrade policy.
44

55
## 文件结构
66

77
- `compat/bundles/*.toml`
8-
- 每个 bundle 用 Calendar Version 命名(当前:`2026.07.0`)。
8+
- 每个 bundle 用 Calendar Version 命名(当前:`2026.07.1`)。
99
- 记录 QSL 管控的固定内部仓库提交。
1010
- `compat/repo-tiers.toml`
1111
- 记录仓库层级(`core/strategy-lib/pipeline/runtime/ops`)与升级 ring 规则。
@@ -26,8 +26,8 @@ This repository carries the first version of the QSL central compatibility manif
2626

2727
```toml
2828
[qsl]
29-
bundle = "2026.07.0" # 选择要对齐的 central bundle
30-
compat = "2026.07.0" # 兼容检查入口(与 bundle 相同)
29+
bundle = "2026.07.1" # 选择要对齐的 central bundle
30+
compat = "2026.07.1" # 兼容检查入口(与 bundle 相同)
3131
tier = "ops/tooling"
3232
upgrade_ring = "ring_e"
3333
allow_legacy = false # 需要临时兼容时可先放开
@@ -43,15 +43,26 @@ python scripts/check_qsl_compat.py --repo-root . --non-strict
4343
python scripts/render_qsl_dependency_graph.py --repo-root . --format md
4444
```
4545

46-
说明:默认脚本会输出错误并以非零退出码返回;`--non-strict` 仅用于本地快速预览。
46+
说明:
47+
- 默认脚本执行严格模式:`forbidden short/invalid``bundle pin mismatch``@main` 均为 issue(非零退出)。
48+
- 阶段过渡仓可设置 `enforce_bundle = false`(建议限时):
49+
- `forbidden short/invalid``bundle pin mismatch` 降级为 warning。
50+
- `forbidden ref 'main'` 始终为 issue,不降级。
51+
- `--non-strict` 仅用于本地快速预览,不作为发布门禁依据。
4752

4853
## 当前中心兼容基线
4954

50-
- Bundle: `2026.07.0`
51-
- QPK: `0063af3b4a974650ea58a7d3f26dd1b94f65d3e8`
52-
- UsEquityStrategies: `46887bc3f5454d5b59623b1f5efb7c65912c6b8b`
53-
- HkEquityStrategies: `61993bf261aeccf64b5a75428b9405f4e1d1d682`
54-
- CnEquityStrategies: `ffbdf7303179ba6e7f9d3e28c21202f77e04762c`
55-
- CryptoStrategies: `8039ddddde7634ad3615496c9b79d2918996938c`
56-
- QuantStrategyPlugins: `6c10aef8989f52d82571e676092b14d315401989`
57-
- MarketSignalSources: `ea8771b6b65f356e7edc4a2b08cd621186726646`
55+
- Bundle: `2026.07.1`
56+
- QPK: `7032cde4547e7ec59af15df8935d142461a77051`
57+
- UsEquityStrategies: `9f0e5e2deca8a9c16d711eb4772f08a7901da101`
58+
- HkEquityStrategies: `00dd0e5b62a6fa65bd9262e15c083468e8b8c191`
59+
- CnEquityStrategies: `c6d680d6d2690fe6ff77872355719751c021f9a0`
60+
- CryptoStrategies: `c0203b66746efb63e79f4d4bc9a65758c342817e`
61+
- QuantStrategyPlugins: `1f3a27b8fd83d71b583f4f5160a748e95fbefaa1`
62+
- MarketSignalSources: `bda8ab10b80a646e4b579ef4c0d5dfe90776e908`
63+
64+
## Phase-2 Transition Warning 收敛路径
65+
66+
1. 发现 phase-1 之后的 drift/main 问题先通过 `--non-strict` 定位;提交修复前确保日志可回放。
67+
2. 过渡仓可短期开启 `enforce_bundle = false`,仅将 drift / short SHA 降级为 warning。
68+
3. 版本发布前将仓库切回 `enforce_bundle = true`,并清零 transition warning。
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
from __future__ import annotations
2+
3+
import importlib.util
4+
import sys
5+
import tempfile
6+
import unittest
7+
from pathlib import Path
8+
9+
ROOT = Path(__file__).resolve().parents[2]
10+
MODULE_PATH = ROOT / "scripts" / "check_qsl_compat.py"
11+
MODULE_SPEC = importlib.util.spec_from_file_location("check_qsl_compat", MODULE_PATH)
12+
check_qsl_compat = importlib.util.module_from_spec(MODULE_SPEC)
13+
assert MODULE_SPEC.loader is not None
14+
sys.modules[MODULE_SPEC.name] = check_qsl_compat
15+
MODULE_SPEC.loader.exec_module(check_qsl_compat)
16+
17+
18+
class QSLCompatCheckerTest(unittest.TestCase):
19+
def _make_repo_root(self, qsl_toml: str, pyproject: str) -> Path:
20+
root = Path(tempfile.mkdtemp())
21+
(root / "qsl.toml").write_text(qsl_toml, encoding="utf-8")
22+
(root / "pyproject.toml").write_text(pyproject, encoding="utf-8")
23+
return root
24+
25+
def _write_bundle(self, compat_root: Path, bundle_name: str, repos: dict[str, str]) -> None:
26+
bundle_path = compat_root / "compat" / "bundles" / f"{bundle_name}.toml"
27+
bundle_path.parent.mkdir(parents=True, exist_ok=True)
28+
block = [f'name = "{bundle_name}"', "[repos]"]
29+
for repo, ref in repos.items():
30+
block.append(f'{repo} = "{ref}"')
31+
bundle_path.write_text("\n".join(block) + "\n", encoding="utf-8")
32+
33+
def test_root_compat_bundle_and_ring_schema(self):
34+
with tempfile.TemporaryDirectory() as workspace:
35+
compat_root = Path(workspace)
36+
self._write_bundle(
37+
compat_root,
38+
"2026.07.1",
39+
{"QuantPlatformKit": "7032cde4547e7ec59af15df8935d142461a77051"},
40+
)
41+
repo_root = self._make_repo_root(
42+
qsl_toml=(
43+
"tier = \"ops/tooling\"\n"
44+
"ring = \"ring_e\"\n"
45+
"[compat]\n"
46+
'bundle = "2026.07.1"\n'
47+
),
48+
pyproject=(
49+
"dependencies = [\n"
50+
' "quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@7032cde4547e7ec59af15df8935d142461a77051"\n'
51+
"]\n"
52+
),
53+
)
54+
55+
ok, issues, warnings, notes = check_qsl_compat._check(repo_root=repo_root, compat_root=compat_root)
56+
57+
self.assertTrue(ok)
58+
self.assertEqual(issues, [])
59+
self.assertEqual(warnings, [])
60+
self.assertIn("bundle=2026.07.1", notes)
61+
self.assertIn("upgrade_ring=ring_e", notes)
62+
63+
def test_not_enforced_bundle_reports_warning_for_short_sha_and_mismatch_but_main_stays_issue(self):
64+
with tempfile.TemporaryDirectory() as workspace:
65+
compat_root = Path(workspace)
66+
self._write_bundle(
67+
compat_root,
68+
"2026.07.1",
69+
{
70+
"QuantPlatformKit": "7032cde4547e7ec59af15df8935d142461a77051",
71+
"UsEquityStrategies": "9f0e5e2deca8a9c16d711eb4772f08a7901da101",
72+
},
73+
)
74+
repo_root = self._make_repo_root(
75+
qsl_toml=(
76+
"tier = \"ops/tooling\"\n"
77+
"ring = \"ring_e\"\n"
78+
"[compat]\n"
79+
'bundle = "2026.07.1"\n'
80+
"enforce_bundle = false\n"
81+
),
82+
pyproject=(
83+
"dependencies = [\n"
84+
' "quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@abc123"\n'
85+
' "quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@'
86+
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"\n'
87+
' "us-equity-strategies @ https://github.com/QuantStrategyLab/UsEquityStrategies.git?rev=main"\n'
88+
"]\n"
89+
),
90+
)
91+
92+
ok, issues, warnings, notes = check_qsl_compat._check(repo_root=repo_root, compat_root=compat_root)
93+
94+
self.assertFalse(ok)
95+
self.assertEqual(len(issues), 1)
96+
self.assertIn("forbidden ref 'main'", issues[0])
97+
self.assertEqual(len(warnings), 2)
98+
self.assertTrue(any("forbidden short/invalid ref 'abc123'" in warning for warning in warnings))
99+
self.assertTrue(any("bundle pin mismatch for QuantPlatformKit" in warning for warning in warnings))
100+
self.assertEqual(notes[0], "qsl=" + str(repo_root / "qsl.toml"))
101+
102+
103+
if __name__ == "__main__":
104+
unittest.main()

0 commit comments

Comments
 (0)