diff --git a/plan_inputs.py b/plan_inputs.py index 044589a..922f6b4 100644 --- a/plan_inputs.py +++ b/plan_inputs.py @@ -150,6 +150,9 @@ class Config: bundle = _active.get() if bundle is not None and name in bundle.params: return bundle.params[name] + # 老冻结版本从未启用新规则,不能继承今天服务器的开关。 + if bundle is not None and bundle.replay and name == 'PLAN_RATING_PRIORITY_ENABLED': + return False return getattr(self.module, name) diff --git a/test_rating_priority.py b/test_rating_priority.py index 0974749..e65a5ff 100644 --- a/test_rating_priority.py +++ b/test_rating_priority.py @@ -69,6 +69,13 @@ class PriorityTest(unittest.TestCase): self.assertEqual(rows['SH600001']['rating_priority']['status'],'expired') with self.assertRaises(OSError): sources.company_reviews(['SH600001'],'2026-11-04',read_pg=lambda sql,args: read(sql,args) if 'company_review_runs' in sql else (_ for _ in ()).throw(OSError('history unavailable')),cutoff_at=EDGE,include_rating=True) + def test_old_frozen_params_do_not_inherit_current_enabled_switch(self): + with patch.object(config, 'PLAN_RATING_PRIORITY_ENABLED', True): + with pi.Bundle(records={}, params={}).use(): + self.assertFalse(plan.config.PLAN_RATING_PRIORITY_ENABLED) + with pi.Bundle(params={}).use(): + self.assertTrue(plan.config.PLAN_RATING_PRIORITY_ENABLED) + def test_frozen_replay_does_not_read_or_expire(self): source=lambda *a,**kw: {'SH600001':{**review(),'rating_priority':rating.evaluate(review(),history(),kw['cutoff_at'])}} bundle=pi.Bundle(params={'PLAN_RATING_PRIORITY_ENABLED':True},cutoff_at='2026-11-05T08:59:00+08:00')