Files
Justin Gu e374a0da28 release: v1.32.6 — 两周改动深度审查全面修复(回测口径三件套/LLM 安全加固/涨停价舍入/时区统一/缓存与竞态等 58 处)
对 v1.21→v1.32.5 的 249 文件 4.2 万行改动做六路专项审查,本轮落地全部发现:

回测正确性:组合收益 fillna(0) 虚增、轮动停牌日过期价成交、单标的 WF 逐窗指标
被预热区稀释(三件套均带先红后绿回归);worst_drawdown 方向、grading 容错、
组合体检品种费率、寻优端点费率透传。

安全:LLM api_url 仅 http/https 且禁 userinfo(封死 file:// 读取与 Key 外送链)、
错误响应不回显原始 body、响应体 2MB 上限、配置原子写、坏配置字段级防御。

数据:涨跌停价整数分币舍入(67/318/90 个价位错 1 分漏判清零)、交易时段/采样/
provisional 统一沪时区、warehouse 增量缺口自动全量重拉、provisional 定点转正、
baostock 真故障抛错 + W/M 去 tradestatus(实测服务端报错,周月兜底此前从未工作)
+ 指数 vol 股→手(实测锚定)、ccpm 结构变更抛错。

Web API:缓存键补 count/vipdoc、NaN 清洗先于缓存、count>800 分页取全量、
submit 透传真实状态、pending 不再被淘汰成幽灵、watchlist/server 入参约束。

公式:FILTER 去副作用、0-1 值域误判收严、递归深度上限、REF 负移位显式禁止。

前端:4 处请求竞态序号守卫、Sparkline viewBox、北交所 market=2 映射、
空数据缓存死角、AI 弹窗卸载中止轮询、量能/资金日历口径修正。

CLI/CI:warehouse sync 失败 exit 1、参数校验干净报错、release 真实发布 SHA256、
CI 超时与缓存、spec 补 baostock 前提。

约 60 条回归测试先红后绿;pytest 1820 全过,ruff/mypy/vue-tsc/node --test 全绿。
2026-09-06 22:16:48 +08:00

111 lines
4.1 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 60 # Windows runner 偶发卡顿,6 格矩阵整体留足余量
strategy:
fail-fast: false
matrix:
# 项目核心场景是读取 Windows 通达信安装目录下的 .day 文件,
# 路径分隔符 / GBK 文件名 / tzdata 时区行为在 Windows 上与 Linux 不同,
# 故补充 Windows 矩阵覆盖这些平台特有路径。
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
pyproject.toml
requirements-dev.txt
# 前端 dist 被 pyproject.toml 的 force-include 引用,pip install -e .
# 要求它存在。先构建前端(type-check + vite build)。
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: web-ui/package-lock.json
- run: npm ci
working-directory: web-ui
- run: npm run build
working-directory: web-ui
- run: pip install -e ".[dev]"
- run: pip install -r requirements-dev.txt
# test_ai_llm.py 依赖 LLM 异步任务轮询,CI 无 API key 且 runner 卡顿时
# 必然轮询超时抖挂(本地有 mock 可跑),CI 跳过
- run: python -m pytest tests/unit/ -v --tb=short --cov src/easy_tdx --cov-fail-under=60 --ignore=tests/unit/test_ai_llm.py
- run: ruff check src/ tests/
- run: ruff format --check src/ tests/
mypy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"
cache-dependency-path: pyproject.toml
# 同 test jobforce-include 要求 web-ui/dist 存在。
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: web-ui/package-lock.json
- run: npm ci
working-directory: web-ui
- run: npm run build
working-directory: web-ui
- run: pip install -e ".[dev,web]"
- run: mypy src/
# 前端构建检查。web-ui 此前只有本地 vue-tscCI 不覆盖,
# 类型错误 / 破坏性 import 只有发布后用户才发觉(v1.17.9 的
# 65409694% 离谱数值 bug 即前端无回归守卫的典型后果)。
# 与 Python 版本无关,故独立 job,避免在 test matrix 里跑 6 遍。
frontend:
runs-on: ubuntu-latest
timeout-minutes: 60 # Playwright 安装 + E2E 首跑较慢
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: web-ui/package-lock.json
- run: npm ci
working-directory: web-ui
- run: npm run build
working-directory: web-ui
# Playwright E2Emock 模式):serve 托管刚构建的 dist,行情全部来自
# EASY_TDX_E2E_MOCK=1 合成数据,不连真实通达信服务器、不受交易时段限制。
# 需要 Python 侧 easy-tdx[web]webServer 用系统 python 启动 serve)。
- uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"
cache-dependency-path: pyproject.toml
- run: pip install -e ".[web]"
# 浏览器二进制按 lockfile 哈希缓存(版本变 → 新 key → 重下)
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('web-ui/package-lock.json') }}
- run: npx playwright install --with-deps chromium
working-directory: web-ui
- run: npm run test:e2e
working-directory: web-ui
env:
EASY_TDX_PYTHON: python