-
Notifications
You must be signed in to change notification settings - Fork 0
#195 - Update rules for service chapter "Merged PRs Linked to 'Not Cl… #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#195 - Update rules for service chapter "Merged PRs Linked to 'Not Cl… #196
Conversation
…osed' Issue" - Improved rules for deciding when hierarchy issue can be included into service chapter "Merged PRs Linked to 'Not Closed' Issue". Hierarchy issue can be open when cotains merged PRs.
WalkthroughReworks service_chapters.populate else-branch to handle open vs closed IssueRecord/SubIssueRecord/HierarchyIssueRecord, add module logger, and log when open issues with linked PRs are collected. Tests updated to collapse per-PR "Merged PRs Linked to 'Not Closed' Issue" sections into a single declarative line. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Builder
participant ServiceChapters as ServiceChapters.populate
participant Record as Issue/SubIssue/HierarchyRecord
participant Chapters as Chapters Index
participant Buckets as Buckets (MERGED_PRS..., OTHERS_NO_TOPIC)
note over ServiceChapters: Else-branch control flow (modified)
Builder->>ServiceChapters: populate(records)
loop For each record
ServiceChapters->>Record: inspect type/status/PR count
alt Record is open
alt HierarchyIssueRecord and present in Chapters
ServiceChapters->>ServiceChapters: log skip (hierarchy open)
else Issue/SubIssue with PRs (>0)
ServiceChapters->>Buckets: add to MERGED_PRS_LINKED_TO_NOT_CLOSED_ISSUES
ServiceChapters->>ServiceChapters: debug log (open issue with PRs)
else Open with no PRs
ServiceChapters->>ServiceChapters: no-op
end
else Record is closed
ServiceChapters->>Buckets: add to OTHERS_NO_TOPIC if not recorded
end
end
ServiceChapters-->>Builder: done
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/release_notes/builder/test_release_notes_builder.py (1)
1561-1563
: Remove leftover debug prints from tests.The added
print("XXX")
wrappers only add noise to test output and look like forgotten debugging aids. Please drop them.- print("XXX") - print(actual_release_notes) - print("XXX")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
release_notes_generator/chapters/service_chapters.py
(4 hunks)tests/release_notes/builder/test_release_notes_builder.py
(4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
release_notes_generator/chapters/service_chapters.py (4)
release_notes_generator/model/record/hierarchy_issue_record.py (3)
HierarchyIssueRecord
(16-196)pull_requests_count
(84-99)to_chapter_row
(117-182)release_notes_generator/model/record/issue_record.py (5)
IssueRecord
(17-268)pull_requests_count
(248-254)is_open
(52-53)record_id
(44-45)to_chapter_row
(130-156)release_notes_generator/model/record/record.py (5)
Record
(32-258)is_open
(112-117)is_present_in_chapters
(49-55)record_id
(94-99)to_chapter_row
(154-163)release_notes_generator/model/record/sub_issue_record.py (1)
SubIssueRecord
(15-26)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
release_notes_generator/chapters/service_chapters.py (1)
129-145
: Guard or document the unchecked IssueRecord cast
In release_notes_generator/chapters/service_chapters.py line 129, wrap the call topull_requests_count()
in anisinstance(record, IssueRecord)
check—or add a comment explaining why only IssueRecord subclasses ever reach this branch—to prevent a future AttributeError if new Record types are introduced.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
release_notes_generator/chapters/service_chapters.py
(3 hunks)tests/release_notes/builder/test_release_notes_builder.py
(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
release_notes_generator/chapters/service_chapters.py (4)
release_notes_generator/model/record/hierarchy_issue_record.py (3)
HierarchyIssueRecord
(16-196)pull_requests_count
(84-99)to_chapter_row
(117-182)release_notes_generator/model/record/issue_record.py (5)
IssueRecord
(17-268)pull_requests_count
(248-254)is_open
(52-53)record_id
(44-45)to_chapter_row
(130-156)release_notes_generator/model/record/record.py (5)
Record
(32-258)is_open
(112-117)is_present_in_chapters
(49-55)record_id
(94-99)to_chapter_row
(154-163)release_notes_generator/model/record/sub_issue_record.py (1)
SubIssueRecord
(15-26)
🔇 Additional comments (4)
tests/release_notes/builder/test_release_notes_builder.py (1)
272-272
: LGTM! Test expectations correctly updated.The test updates properly reflect the new behavior where hierarchical issues with labels/types are placed in dedicated chapters (e.g., "Epics"), leaving the service chapter with its empty-state message rather than duplicating entries.
Also applies to: 336-336, 403-403
release_notes_generator/chapters/service_chapters.py (3)
21-21
: LGTM! Proper logging and import additions.The logging infrastructure and new record type imports correctly support the enhanced else-branch logic that handles hierarchical and sub-issue records.
Also applies to: 28-28, 32-32, 44-44
133-145
: LGTM! Correctly implements the PR objectives.The logic properly handles the new requirements:
- Line 134-135: Skips open HierarchyIssueRecords already present in other chapters (e.g., "Epics"), preventing duplication
- Lines 136-142: Adds open issues/sub-issues with linked PRs to the MERGED_PRS_LINKED_TO_NOT_CLOSED_ISSUES chapter, fulfilling the PR objective that "hierarchical issues which are open but contain merged PRs are not treated as errors"
- Lines 143-145: Preserves original behavior for open issues without PRs (no-op)
The debug logging at lines 135 and 141 aids troubleshooting.
146-149
: LGTM! Appropriate fallback for edge cases.The else clause (lines 146-149) provides a safe fallback for closed records not handled by earlier branches, adding them to OTHERS_NO_TOPIC while preventing duplicates by checking
used_record_numbers
.
Release Notes:
Summary by CodeRabbit
Bug Fixes
Chores
Tests
Fixes #195