Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions scripts/run_monthly_review_briefing.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ def load_track_summary(path: Path) -> list[dict[str, str]]:
def load_optional_track_summary(path: Path) -> list[dict[str, str]]:
if not path.exists():
return []
with path.open("r", encoding="utf-8", newline="") as handle:
reader = csv.DictReader(handle)
return list(reader)
return load_track_summary(path)


def _safe_int(value: Any, default: int = 0) -> int:
Expand Down
12 changes: 12 additions & 0 deletions tests/test_monthly_review_briefing.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ def test_build_review_payload_requires_shadow_outputs(self) -> None:
with self.assertRaisesRegex(RuntimeError, "monthly shadow build outputs are required"):
MODULE.require_shadow_outputs(inputs)

def test_build_review_inputs_rejects_empty_track_summary(self) -> None:
with tempfile.TemporaryDirectory() as tmp_dir:
output_dir = self.write_fixture_files(Path(tmp_dir))
track_summary = output_dir / "shadow_candidate_tracks" / "track_summary.csv"
track_summary.write_text(
"track_id,profile_name,target_mode,source_track,candidate_status,release_count,first_as_of_date,last_as_of_date,release_index_path\n",
encoding="utf-8",
)

with self.assertRaisesRegex(ValueError, "CSV is empty"):
MODULE.build_review_inputs(output_dir)


if __name__ == "__main__":
unittest.main()