From 0945fa2b29835886ddfdcb3ab00a088e6dafa721 Mon Sep 17 00:00:00 2001 From: zlt Date: Thu, 5 Nov 2026 13:10:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=AE=A1=E5=88=92=E9=87=8D?= =?UTF-8?q?=E6=94=BE=E4=B8=8D=E7=BB=A7=E6=89=BF=E5=BD=93=E5=89=8D=E8=AF=84?= =?UTF-8?q?=E7=BA=A7=E6=8E=92=E5=BA=8F=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plan_inputs.py | 3 +++ test_rating_priority.py | 7 +++++++ 2 files changed, 10 insertions(+) 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')