每日计划:标记盘中恢复版本,排除缺失晨版的效果统计(台账 075)
一、当前恢复与历史决策分别记录 外部数据补齐后需盘中恢复计划,原边界仅比较日期会误认为真实晨版。 首版截止时刻已到北京时间 09:30 时明确标记恢复版,保留真实截止时刻与原因。 二、历史入口保持兼容 固定首版指针仍保留,历史复盘通过晨版资格排除补发样本。 旧版本不改字节,后续完整修订仍可正常发布。 三、验证及交易边界 本地禁网版本契约 18 例通过,含开盘时刻两侧及固定版本查询。 不改任何交易时段、排序、准入、仓位、阈值或提议采纳行为。
This commit is contained in:
parent
f05bec08b1
commit
1139b9cfab
|
|
@ -761,3 +761,12 @@
|
||||||
- **复核日期。** 本轮合成回归及部署读回。外部 10-16 资金流和热度尚缺,恢复后另行核验完整链;不得把错误明确显示当作数据已恢复。
|
- **复核日期。** 本轮合成回归及部署读回。外部 10-16 资金流和热度尚缺,恢复后另行核验完整链;不得把错误明确显示当作数据已恢复。
|
||||||
|
|
||||||
- **074 部署补记。** 功能 ef873bb 于北京时间 09:50:54 在 155 桥生效。八套候选镜像禁网回归通过。写前备份约 598 MiB,全部历史计划、归档和晨版指针哈希保持。只读检查准确报缺 10-16 的传导与热度。09:52:55 PMS 原取数仍拒绝两交易日前旧榜,过期上限 1 未改。外部源数据尚未恢复,不宣称候选可用。
|
- **074 部署补记。** 功能 ef873bb 于北京时间 09:50:54 在 155 桥生效。八套候选镜像禁网回归通过。写前备份约 598 MiB,全部历史计划、归档和晨版指针哈希保持。只读检查准确报缺 10-16 的传导与热度。09:52:55 PMS 原取数仍拒绝两交易日前旧榜,过期上限 1 未改。外部源数据尚未恢复,不宣称候选可用。
|
||||||
|
|
||||||
|
|
||||||
|
## 075 · 2026-10-19 · 盘中恢复版本不冒充晨版
|
||||||
|
|
||||||
|
- **日期。** 2026-10-19。
|
||||||
|
- **改动。** 首版截止时刻若已到北京时间 09:30,标记为 recovery,显示“数据恢复后补发”。仍保存真实输入和首版固定指针,可查询及继续修订,但排除晨版效果统计。
|
||||||
|
- **依据。** 用户补齐外部数据后,需要恢复当前候选。原边界只比较日期,会把同日盘中补发混进晨版历史。
|
||||||
|
- **预期。** 当前可用计划与缺失的盘前决策分开记录,不伪造 07:10 晨版,不改变交易时段或策略规则。
|
||||||
|
- **复核日期。** 本轮离线边界回归、恢复发布与 PMS 实际消费核验。
|
||||||
|
|
|
||||||
|
|
@ -418,7 +418,7 @@ def trace_rows(day):
|
||||||
for i, p in enumerate(history):
|
for i, p in enumerate(history):
|
||||||
d = p['decision']
|
d = p['decision']
|
||||||
versions[d['id']] = p
|
versions[d['id']] = p
|
||||||
rows.append({'date': day, 'kind': 'morning' if i == 0 else 'revision',
|
rows.append({'date': day, 'kind': (d.get('publication_kind') or ('morning' if i == 0 else 'revision')),
|
||||||
'decision_id': d['id'], 'parent_id': d.get('parent_id'),
|
'decision_id': d['id'], 'parent_id': d.get('parent_id'),
|
||||||
'at': d['cutoff_at'], 'reason': d['reason'], 'verified': verified,
|
'at': d['cutoff_at'], 'reason': d['reason'], 'verified': verified,
|
||||||
'order': [r['code'] for r in p['main']], 'params': {}})
|
'order': [r['code'] for r in p['main']], 'params': {}})
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ def health(root, day, **values):
|
||||||
|
|
||||||
|
|
||||||
def morning_eligible(plan):
|
def morning_eligible(plan):
|
||||||
"""行情日后的首个交易日才是其真实晨版决策日;晚生成不能回填历史。"""
|
"""行情日后首个交易日开盘前才是晨版;盘中补发不冒充晨版历史。"""
|
||||||
from zoneinfo import ZoneInfo
|
from zoneinfo import ZoneInfo
|
||||||
from chinese_calendar import is_holiday
|
from chinese_calendar import is_holiday
|
||||||
try:
|
try:
|
||||||
|
|
@ -142,7 +142,9 @@ def morning_eligible(plan):
|
||||||
while day.weekday() >= 5 or is_holiday(day):
|
while day.weekday() >= 5 or is_holiday(day):
|
||||||
day += dt.timedelta(days=1)
|
day += dt.timedelta(days=1)
|
||||||
cutoff = dt.datetime.fromisoformat(plan['decision']['cutoff_at'])
|
cutoff = dt.datetime.fromisoformat(plan['decision']['cutoff_at'])
|
||||||
return cutoff.tzinfo is not None and cutoff.astimezone(ZoneInfo('Asia/Shanghai')).date() == day
|
local = cutoff.astimezone(ZoneInfo('Asia/Shanghai'))
|
||||||
|
return (cutoff.tzinfo is not None and local.date() == day
|
||||||
|
and local.time().replace(tzinfo=None) < dt.time(9, 30))
|
||||||
except (KeyError, TypeError, ValueError):
|
except (KeyError, TypeError, ValueError):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
@ -208,6 +210,10 @@ def publish(root, plan, inputs, params, *, cutoff_at, reason):
|
||||||
p['decision'] = {'id': did, 'parent_id': (old or {}).get('decision', {}).get('id'),
|
p['decision'] = {'id': did, 'parent_id': (old or {}).get('decision', {}).get('id'),
|
||||||
'ancestor_ids': ((ancestors or []) + [prior['id']]) if prior else [],
|
'ancestor_ids': ((ancestors or []) + [prior['id']]) if prior else [],
|
||||||
'cutoff_at': cutoff_at, 'input_hash': ih, 'params_hash': ph, 'reason': reason}
|
'cutoff_at': cutoff_at, 'input_hash': ih, 'params_hash': ph, 'reason': reason}
|
||||||
|
p['decision']['publication_kind'] = ('revision' if prior else
|
||||||
|
'morning' if morning_eligible(p) else 'recovery')
|
||||||
|
if not prior and p['decision']['publication_kind'] == 'recovery':
|
||||||
|
p['decision']['reason'] = '数据恢复后补发'
|
||||||
p['generated_at'] = now()
|
p['generated_at'] = now()
|
||||||
p['traceability'] = 'captured_inputs'
|
p['traceability'] = 'captured_inputs'
|
||||||
# 返回与落盘同一 JSON 形状(元组等不得在内存出口与历史出口有两种表示)。
|
# 返回与落盘同一 JSON 形状(元组等不得在内存出口与历史出口有两种表示)。
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,21 @@ class VersionsTest(unittest.TestCase):
|
||||||
return pv.publish(self.root, p or sample(), inputs or {'x': 1}, params or {},
|
return pv.publish(self.root, p or sample(), inputs or {'x': 1}, params or {},
|
||||||
cutoff_at=CUT, reason='测试')
|
cutoff_at=CUT, reason='测试')
|
||||||
|
|
||||||
|
def test_intraday_recovery_is_queryable_but_not_morning_history(self):
|
||||||
|
with pv.writer(self.root):
|
||||||
|
result = pv.publish(self.root, sample(), {'x': 1}, {},
|
||||||
|
cutoff_at='2026-10-15T10:00:00+08:00', reason='晨版生成')
|
||||||
|
self.assertEqual(result['decision']['publication_kind'], 'recovery')
|
||||||
|
self.assertEqual(result['decision']['reason'], '数据恢复后补发')
|
||||||
|
self.assertFalse(pv.morning_eligible(result))
|
||||||
|
self.assertEqual(pv.load(self.root, decision_id=result['decision']['id']), result)
|
||||||
|
self.assertEqual(pv.load(self.root, DAY, morning=True), result)
|
||||||
|
early = copy.deepcopy(result)
|
||||||
|
early['decision']['cutoff_at'] = '2026-10-15T09:29:59+08:00'
|
||||||
|
self.assertTrue(pv.morning_eligible(early))
|
||||||
|
early['decision']['cutoff_at'] = '2026-10-15T09:30:00+08:00'
|
||||||
|
self.assertFalse(pv.morning_eligible(early))
|
||||||
|
|
||||||
def test_append_idempotent_and_return_to_previous_inputs(self):
|
def test_append_idempotent_and_return_to_previous_inputs(self):
|
||||||
a = self.publish()
|
a = self.publish()
|
||||||
self.assertEqual(a, self.publish())
|
self.assertEqual(a, self.publish())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue