feat: add {progress} format token to hierarchy issue rows#279
Conversation
Add a `progress` property to `HierarchyIssueRecord` that returns 'X/Y done'
counting direct closed children vs total direct children (sub-issues and
sub-hierarchy-issues, no recursion). Leaf nodes return '' so the token
collapses cleanly in bare whitespace context via `format_row_with_suppression`.
Register `progress` in `SUPPORTED_ROW_FORMAT_KEYS_HIERARCHY_ISSUE` so the
format-string validator accepts it without stripping.
- release_notes_generator/utils/constants.py: add "progress" to supported keys
- release_notes_generator/model/record/hierarchy_issue_record.py: add progress
property; pass format_values["progress"] in to_chapter_row()
- tests/unit/release_notes_generator/model/test_hierarchy_issue_record.py: new
file — 9 tests covering leaf, partial, full, all-open, mixed children,
row rendering, whitespace suppression, delimiter adjacency, per-level
independence
- docs/features/issue_hierarchy_support.md: document {progress} token and
update Example Result section
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (24)
💤 Files with no reviewable changes (4)
✅ Files skipped from review due to trivial changes (16)
WalkthroughAdds a Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
Pull request overview
Adds an opt-in {progress} format token for hierarchy issue rows so release notes can show direct child completion (closed/total) per hierarchy level.
Changes:
- Add
HierarchyIssueRecord.progressand expose it as{progress}inrow-format-hierarchy-issue. - Extend hierarchy row-format keyword validation to allow
progress. - Add unit tests covering leaf suppression, formatting behavior, and per-level counting; update hierarchy docs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
release_notes_generator/model/record/hierarchy_issue_record.py |
Computes direct-child progress and injects it into hierarchy row formatting values. |
release_notes_generator/utils/constants.py |
Adds progress to supported hierarchy row-format keys for validation/cleaning. |
tests/unit/release_notes_generator/model/test_hierarchy_issue_record.py |
New unit tests for progress computation and rendering/suppression behavior. |
docs/features/issue_hierarchy_support.md |
Documents {progress} token and updates examples (currently inconsistent with actual rendering behavior). |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/unit/release_notes_generator/model/test_hierarchy_issue_record.py (1)
30-63: Consider de-duplicating the mock issue builders.
_make_hierarchy_issueand_make_sub_issuerepeat almost the same mock setup; a shared helper would reduce maintenance overhead.Optional refactor sketch
+def _make_issue_mock(mocker, number: int, state: str, title_prefix: str) -> Issue: + issue = mocker.Mock(spec=Issue) + issue.number = number + issue.title = f"{title_prefix}{number}" + issue.state = state + issue.state_reason = None + issue.body = "" + issue.type = None + issue.created_at = datetime.now() + issue.closed_at = datetime.now() if state == IssueRecord.ISSUE_STATE_CLOSED else None + issue.repository.full_name = "org/repo" + issue.user = None + issue.assignees = [] + issue.get_labels.return_value = [] + issue.get_sub_issues.return_value = [] + return issue + def _make_hierarchy_issue(mocker, number: int, state: str) -> Issue: - issue = mocker.Mock(spec=Issue) - issue.number = number - issue.title = f"HI{number}" - issue.state = state - issue.state_reason = None - issue.body = "" - issue.type = None - issue.created_at = datetime.now() - issue.closed_at = datetime.now() if state == IssueRecord.ISSUE_STATE_CLOSED else None - issue.repository.full_name = "org/repo" - issue.user = None - issue.assignees = [] - issue.get_labels.return_value = [] - issue.get_sub_issues.return_value = [] - return issue + return _make_issue_mock(mocker, number, state, "HI") def _make_sub_issue(mocker, number: int, state: str) -> SubIssueRecord: - issue = mocker.Mock(spec=Issue) - issue.number = number - issue.title = f"SI{number}" - issue.state = state - issue.state_reason = None - issue.body = "" - issue.type = None - issue.created_at = datetime.now() - issue.closed_at = datetime.now() if state == IssueRecord.ISSUE_STATE_CLOSED else None - issue.repository.full_name = "org/repo" - issue.user = None - issue.assignees = [] - issue.get_labels.return_value = [] - issue.get_sub_issues.return_value = [] - return SubIssueRecord(issue) + return SubIssueRecord(_make_issue_mock(mocker, number, state, "SI"))🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/unit/release_notes_generator/model/test_hierarchy_issue_record.py` around lines 30 - 63, Both _make_hierarchy_issue and _make_sub_issue duplicate the same mock Issue construction; extract a shared helper (e.g., _build_mock_issue) that accepts parameters like mocker, number, state and returns the configured mock Issue, then have _make_hierarchy_issue call this helper and return the Issue, and have _make_sub_issue call the helper and wrap the returned mock with SubIssueRecord(issue); update references to IssueRecord.ISSUE_STATE_CLOSED, get_labels, get_sub_issues, repository.full_name, and other fields inside the new helper to preserve current behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/unit/release_notes_generator/model/test_hierarchy_issue_record.py`:
- Around line 30-63: Both _make_hierarchy_issue and _make_sub_issue duplicate
the same mock Issue construction; extract a shared helper (e.g.,
_build_mock_issue) that accepts parameters like mocker, number, state and
returns the configured mock Issue, then have _make_hierarchy_issue call this
helper and return the Issue, and have _make_sub_issue call the helper and wrap
the returned mock with SubIssueRecord(issue); update references to
IssueRecord.ISSUE_STATE_CLOSED, get_labels, get_sub_issues,
repository.full_name, and other fields inside the new helper to preserve current
behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 10deba2a-7631-442d-9126-915ea7ca67e3
📒 Files selected for processing (4)
docs/features/issue_hierarchy_support.mdrelease_notes_generator/model/record/hierarchy_issue_record.pyrelease_notes_generator/utils/constants.pytests/unit/release_notes_generator/model/test_hierarchy_issue_record.py
…y support documentation
tests/unit/release_notes_generator/model/test_hierarchy_issue_record.py
Outdated
Show resolved
Hide resolved
tests/unit/release_notes_generator/model/test_hierarchy_issue_record.py
Outdated
Show resolved
Hide resolved
tests/unit/release_notes_generator/model/test_hierarchy_issue_record.py
Outdated
Show resolved
Hide resolved
- Fixed issue introduce by new code.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/unit/release_notes_generator/model/conftest.py`:
- Around line 29-30: The fixtures make_hierarchy_issue and make_sub_issue need
explicit type annotations: add MockerFixture to the mocker parameter and
annotate the fixture return type as a Callable (e.g., Callable[..., dict] or
Callable[..., YourIssueType]) to satisfy mypy; import MockerFixture from
pytest_mock and Callable from typing, then update the signatures for
make_hierarchy_issue(mocker: MockerFixture) -> Callable[...] and
make_sub_issue(mocker: MockerFixture) -> Callable[...] accordingly and adjust
any inline return/type hints to match the actual returned callable shape.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c208aecb-f692-4b20-b06d-51fdee408070
📒 Files selected for processing (4)
.github/copilot-instructions.mdrelease_notes_generator/model/record/hierarchy_issue_record.pytests/unit/release_notes_generator/model/conftest.pytests/unit/release_notes_generator/model/test_hierarchy_issue_record.py
🚧 Files skipped from review as they are similar to previous changes (2)
- tests/unit/release_notes_generator/model/test_hierarchy_issue_record.py
- release_notes_generator/model/record/hierarchy_issue_record.py
tmikula-dev
left a comment
There was a problem hiding this comment.
Logic looks correct to me, I like the feature. Please react to the comments, that I left in the review.
tests/unit/release_notes_generator/model/test_hierarchy_issue_record.py
Outdated
Show resolved
Hide resolved
tmikula-dev
left a comment
There was a problem hiding this comment.
Great, thanks. Approving.
Overview
Adds a
{progress}format token torow-format-hierarchy-issue. When enabled, each hierarchy issue row shows how many of its direct sub-issues are closed vs total (e.g.2/3 done). Leaf nodes (no direct sub-issues) return an empty string so the token collapses cleanly without leaving extra whitespace. Progress counts direct children only — no recursive aggregation — so each level in a nested hierarchy reports independently.The token is opt-in: the default row format is unchanged, making this fully backward-compatible.
Release Notes
{progress}format token torow-format-hierarchy-issueshowing direct sub-issue completion asX/Y done{progress}cleanly via whitespace normalisationRelated
Closes #277
Summary by CodeRabbit
New Features
Documentation
Tests