Fix OCP manifest start/end dates to reflect full range across all generators#623
Fix OCP manifest start/end dates to reflect full range across all generators#623
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the OCP report generation to ensure the manifest start and end dates reflect the full range across all generators instead of just the last one. It includes a version bump to 5.4.2 and a new test case. Feedback was provided regarding the initialization of manifest dates, which could lead to swapped values if no generators are processed, and the need to update other references to gen_start_date for consistency.
| manifest_start_date = month.get("end") | ||
| manifest_end_date = month.get("start") |
There was a problem hiding this comment.
The initialization of manifest_start_date and manifest_end_date to the month's boundaries in reverse order is a functional way to find the min/max within the loop. However, if no generators are processed or if all are skipped (lines 936-939), the manifest will be generated with swapped start and end dates (e.g., start at the end of the month and end at the start).
Additionally, note that gen_start_date is still used outside the generator loop at line 976 (for the filename year) and line 1095 (for the payload key). To fully align with the PR's objective of reflecting the full reporting range and to avoid relying on loop-leaked variables, those instances should also be updated to use manifest_start_date.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #623 +/- ##
=======================================
- Coverage 93.7% 93.6% -0.1%
=======================================
Files 56 56
Lines 4800 4806 +6
Branches 674 676 +2
=======================================
+ Hits 4496 4499 +3
- Misses 164 165 +1
- Partials 140 142 +2 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude noreply@anthropic.com
Issue:
The manifest start and end fields were set from gen_start_date/gen_end_date after the generator loop, which meant they always reflected the last generator's date window rather than the actual reporting range. In a static YAML with multiple generators having different start_date/end_date attributes, the manifest would misreport its coverage — potentially excluding earlier generators entirely.
Fix: track manifest_start_date = min(gen_start_date) and manifest_end_date = max(gen_end_date) across all generators in the loop, and use those for the manifest instead.
A new test (test_ocp_create_report_manifest_dates_span_all_generators) covers the scenario: two generators where the second has a narrower window than the first, asserting the manifest covers the full union of both.