Skip to content

Commit eafa5d0

Browse files
Pigbibicodex
andcommitted
fix: deduplicate monthly Russell execution
Co-Authored-By: Codex <noreply@openai.com>
1 parent 188a46b commit eafa5d0

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

decision_mapper.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,13 @@ def _build_weight_translation_annotations(
388388
else None
389389
),
390390
signal_date=(
391-
str(execution_annotations.get("signal_date") or diagnostics.get("signal_date") or "").strip() or None
391+
str(
392+
execution_annotations.get("signal_date")
393+
or diagnostics.get("signal_date")
394+
or diagnostics.get("snapshot_as_of")
395+
or ""
396+
).strip()
397+
or None
392398
),
393399
effective_date=(
394400
str(execution_annotations.get("effective_date") or diagnostics.get("effective_date") or "").strip()

main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,15 @@ def _summarize_cycle_result_for_report(cycle_result, *, dry_run: bool) -> dict:
295295
summary["quote_snapshot"] = {
296296
"quotes": [dict(snapshot) for snapshot in quote_snapshots],
297297
}
298+
execution = dict(getattr(cycle_result, "execution", {}) or {})
299+
for field in (
300+
"signal_date",
301+
"effective_date",
302+
"execution_timing_contract",
303+
"execution_calendar_source",
304+
):
305+
if execution.get(field) not in (None, ""):
306+
summary[field] = execution[field]
298307
return summary
299308

300309

tests/test_decision_mapper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ def test_translates_weight_decision_for_russell_strategy(self):
483483
"signal_description": "risk on",
484484
"status_description": "breadth=62.0% | regime=risk_on | benchmark=up",
485485
"benchmark_symbol": "SPY",
486+
"snapshot_as_of": "2026-07-31",
486487
},
487488
)
488489
snapshot = PortfolioSnapshot(
@@ -506,6 +507,7 @@ def test_translates_weight_decision_for_russell_strategy(self):
506507
self.assertEqual(plan["allocation"]["targets"]["AAPL"], 2550.0)
507508
self.assertEqual(plan["allocation"]["targets"]["BOXX"], 1700.0)
508509
self.assertEqual(plan["execution"]["signal_display"], "risk on")
510+
self.assertEqual(plan["execution"]["signal_date"], "2026-07-31")
509511
self.assertEqual(
510512
plan["execution"]["status_display"],
511513
"breadth=62.0% | regime=risk_on | benchmark=up",

tests/test_request_handling.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,10 @@ def test_cycle_result_summary_counts_dry_run_order_previews(self):
854854
skip_logs=("skip",),
855855
note_logs=("note",),
856856
action_done=True,
857+
execution={
858+
"signal_date": "2026-07-31",
859+
"execution_timing_contract": "monthly_snapshot_window",
860+
},
857861
dry_run_orders=(
858862
{"symbol": "02800.HK", "side": "buy", "quantity": 100, "status": "dry_run"},
859863
{"symbol": "03033.HK", "side": "buy", "quantity": 200, "status": "dry_run"},
@@ -872,6 +876,8 @@ def test_cycle_result_summary_counts_dry_run_order_previews(self):
872876
self.assertEqual(summary["orders_skipped_count"], 1)
873877
self.assertEqual(summary["notes_count"], 1)
874878
self.assertTrue(summary["dry_run_order_preview_available"])
879+
self.assertEqual(summary["signal_date"], "2026-07-31")
880+
self.assertEqual(summary["execution_timing_contract"], "monthly_snapshot_window")
875881
self.assertEqual(summary["orders_previewed"][0]["symbol"], "02800.HK")
876882
self.assertEqual(summary["quote_snapshot"]["quotes"][0]["symbol"], "02800.HK")
877883

0 commit comments

Comments
 (0)