| _hot = None
|
| monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x11dda9a90>
|
|
|
| @pytest.mark.unit
|
| def test_rollover_route_routed_carries_flip_result(_hot, monkeypatch):
|
| """A routed action retains the downstream flip result (bug fbf0f724a80b). The audit row's flip field
|
| MUST equal the flip_account return value so a reader can replay the exact downstream outcome."""
|
| _exec_on(monkeypatch)
|
| db = _FakeDB()
|
| flip_result = {"action": "flip", "target_symbol": BULL, "filled_qty": 100}
|
| seen = {}
|
|
|
| def _flip(nick, day, now_et, direction, **kw):
|
| seen.update(kw)
|
| return flip_result
|
|
|
| dec = _llm("bull", size=1.0, decision="LONG")
|
| out = CEL.execute_rollover_onset(
|
| "yuchao", DAY, datetime(2026, 7, 1, 10, 30, tzinfo=ET), "up", execute=True,
|
| ctx_builder=lambda d, c, a: _roll_ctx(), decider=dec, flip_fn=_flip,
|
| db_factory=lambda: db)
|
| assert out["action"] == "flip"
|
| rows = db[CEL.PERIODIC_SIGNAL_ROUTES].docs
|
| assert len(rows) == 1
|
| r = rows[0]
|
| assert r["status"] == "routed" and r["flip"] == flip_result
|
| assert r["reasoning_join_key"]["event_et"] == "10:00:00"
|
| > assert r["reasoning_join_key"]["kind"] == "rollover_up_onset"
|
| E AssertionError: assert 'rollover' == 'rollover_up_onset'
|
| E
|
| E - rollover_up_onset
|
| E + rollover
|
|
|
| ../robinhood-pm-fbf0f724a80b/tests/services/test_combined_engine_live.py:1008: AssertionError
|