fix(strategy): channel_test盘外轮换改锚固定9:35——09-02 dev巡检实锤5d0a0bf副作用:随启随验「盘外不注册」×运维规则「轮换放23:05后」=每次boot都盘外→永不注册→测试通道停摆(live_18/22零任务,调度恢复又因存档模块路径vs runtime副本错配恒失败,守卫再拦回退注册,三重叠加清空);考古澄清:四固定任务自08-20 147a49d随启随验上线即有意退出live(probe_all一轮覆盖rotate/T1/swap),非本次回归;修=盘外boot改锚固定9:35(历史主调仓时刻,盘中由构造保证),盘中boot仍now+90s快验不变,执行侧守卫保留为末道防线;原「盘外不注册」测试按新规格改写为断言注册9:35;25/25+557绿 [vps]
CI/CD / test (push) Successful in 19s
CI/CD / nas-deploy (push) Successful in 3s
CI/CD / nas-verify (push) Successful in 7s

This commit is contained in:
2026-09-02 10:25:36 +08:00
parent 66e741b6bb
commit 8c6a3f90d0
2 changed files with 19 additions and 9 deletions
+10 -5
View File
@@ -97,16 +97,21 @@ class ChannelTestStrategy:
b.set_option("use_real_price", True)
b.set_option("avoid_future_data", True)
if self._on_demand():
# 随启随验:只注册一个"启动后约90秒"的探针任务。必须经 facade.run_daily
# 注册而非直接调用——回调才会收到 B2 包装的代理 context(实例预算视图),
# 随启随验:只注册一个探针任务。必须经 facade.run_daily 注册而非
# 直接调用——回调才会收到 B2 包装的代理 context(实例预算视图),
# 绕过它探针就测不到定寸虚拟化。重启实例(停止→启动)即再验一轮。
# 盘前/盘后/周末重启不注册(锚点在时段外=盘后真单挂柜台,09-01 实锤)。
# 锚点策略:盘中重启锚 now+90s(快验);盘外重启锚固定 9:35——
# 09-01 实锤 now+90s 落盘外=16 笔真单挂柜台,而 5d0a0bf 初版
# 「盘外不注册」在 09-02 被 dev 巡检实锤副作用:轮换按运维规则放
# 23:05 后 → 每次 boot 都盘外 → 永不注册 → 测试通道停摆
# (live_18/22 零任务,四场景至少停一天)。
probe_at = _now() + timedelta(seconds=90)
if not _in_trading_session(probe_at):
logger.warning(
"[PROBE] 重启于非交易时段(探针锚定 %s),跳过随启随验注册"
"——防盘后挂单排队次日集合竞价;下次盘中重启再",
"[PROBE] 重启于非交易时段(探针锚定 %s),改锚固定时刻 9:35"
"——防盘后挂单排队次日集合竞价,同时保住测试通道每日在",
probe_at.strftime("%H:%M"))
b.run_daily(self.probe_all, "9:35")
return
b.run_daily(self.probe_all,
probe_at.strftime("%H:%M"))
+9 -4
View File
@@ -237,9 +237,14 @@ def test_probe_all_skips_out_of_session(monkeypatch, caplog):
assert any("非交易时段" in r.message for r in caplog.records)
def test_initialize_on_demand_after_hours_skips_registration(monkeypatch, caplog):
"""盘后重启(live env)不注册随启随验——run_daily 锚点落在时段外必跳过,
否则 16 笔真单挂柜台排队次日集合竞价(09-01 18:48 轮换实锤)。"""
def test_initialize_on_demand_after_hours_registers_fixed_anchor(monkeypatch, caplog):
"""盘后重启(live env)改锚固定盘中时刻 9:35,而非放弃注册。
09-01 18:48 轮换实锤「now+90s 落盘外=16 笔真单挂柜台」后,5d0a0bf 修成
盘外不注册;09-02 dev 巡检实锤其副作用:运维规则轮换放 23:05 后 → 每次
boot 都盘外 → 永不注册 → 测试通道四场景停摆(live_18/22 零任务)。修=盘外
boot 锚定固定 9:35(历史主调仓时刻,probe_all 一轮覆盖 rotate/T1/swap),
既有盘后挂单风险由锚点固定+执行侧守卫双重消除。"""
monkeypatch.setenv("SANGUO_LIVE_STRATEGY", "channel_test")
ct._now = lambda: datetime(2026, 9, 1, 18, 48) # type: ignore[assignment]
registered: list = []
@@ -254,7 +259,7 @@ def test_initialize_on_demand_after_hours_skips_registration(monkeypatch, caplog
config=ChannelTestConfig(on_demand=True))
with caplog.at_level("WARNING"):
s.initialize(object())
assert registered == [] # 不注册
assert registered == [("probe_all", "9:35")] # 改锚固定盘中时刻
assert any("非交易时段" in r.message for r in caplog.records)