Skip to content

Conversation

miroslavpojer
Copy link
Collaborator

@miroslavpojer miroslavpojer commented Sep 9, 2025

Release Notes:

  • Add issue type attribute.

Summary by CodeRabbit

  • New Features

    • Exposed issue type on issue records, enabling consumers to access and use issue type information without altering existing behavior.
  • Documentation

    • Updated coverage instructions to a two-step workflow, including generating an HTML coverage report.
  • Tests

    • Added tests for issue records to validate issue type handling.
    • Added tests for pull request records covering CodeRabbit summary filtering and commit lookup.
    • Removed an unused import in test code.

@miroslavpojer miroslavpojer self-assigned this Sep 9, 2025
Copy link

coderabbitai bot commented Sep 9, 2025

Walkthrough

Adds issue_type property to IssueRecord with initialization from issue.type.name. Updates DEVELOPER.md coverage instructions to include HTML report. Adds new tests for IssueRecord issue_type behavior, PullRequestRecord release notes parsing/commit retrieval, and removes an unused import in a test.

Changes

Cohort / File(s) Summary
Documentation
DEVELOPER.md
Updates coverage command example to two-step workflow; adds --cov-report=html.
Model: IssueRecord
release_notes_generator/model/issue_record.py
Adds internal _issue_type initialized from issue.type.name when present; exposes read-only property issue_type: Optional[str].
Tests: release notes model
tests/release_notes/model/test_issue_record.py, tests/release_notes/model/test_pull_request_record.py
New tests for IssueRecord.issue_type handling and PullRequestRecord get_rls_notes filtering/get_commit lookup.
Tests: release notes misc
tests/release_notes/test_record_factory.py
Removes unused import MockLabel.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • Zejnilovic
  • OlivieFranklova

Pre-merge checks (1 passed, 4 warnings)

❌ Failed checks (4 warnings)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning This pull request introduces the new issue_type property on IssueRecord with accompanying tests, which is a prerequisite for handling release notes on issues. However, it does not update the release notes generator or record factory to actually include issues as a source of release notes in the output. The linked issue #162 specifically requires not only support for issue metadata but also integrating issue-based release notes into the generation pipeline. As implemented, the core functionality of producing release notes from issues remains unaddressed. Please extend the implementation to integrate issue release notes into the generator or record factory so that issues are fully supported as a source of release notes, fulfilling the linked issue requirements.
Out of Scope Changes Check ⚠️ Warning This pull request combines the core feature of adding an issue_type attribute with unrelated changes such as a documentation update to the code coverage example in DEVELOPER.md, new tests for PullRequestRecord behavior, and removal of an unused import in a test file. None of these modifications pertain to adding release notes support for issues and therefore are out of scope for issue #162. Including such disparate changes hinders focused review and muddy the feature implementation context. These unrelated updates should be extracted into separate, dedicated pull requests. Please remove the DEVELOPER.md coverage example change, the PullRequestRecord tests, and the unused import removal from this pull request and place them in separate PRs so that this PR focuses solely on adding release notes support for issues.
Description Check ⚠️ Warning The current description does not follow the repository template as it uses the placeholder '{PR Summary}' instead of a real summary and omits the entire Checklist and Additional Context sections. It only includes a brief 'Release Notes' block and a Fixes reference but lacks the required structural sections and content. As a result the description is incomplete and does not provide necessary information for reviewers. This fails to meet the expected template standards. Please replace the '{PR Summary}' placeholder with an actual summary, add the Checklist section with completed tasks, and include an Additional Context section to fully comply with the repository’s description template.
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title ‘#162 - Introduce presence of Release Notes to Issues’ accurately reflects the main functional change of the pull request, which is adding support for release notes on issues while omitting peripheral details. It succinctly conveys the key feature and aligns with the linked issue objectives. Including the issue number aids traceability without adding noise. Therefore it meets the criteria for a clear and concise title.

Poem

In burrows of code I hop and peek,
A new field found—issue types speak!
Tests nibble edges, crisp and bright,
Docs sprout leaves in HTML light.
With gentle paws I stamp “All clear!”
Release notes whisper, spring is here. 🥕

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/162---Introduce-presence-of-Release-Notes-to-Issues

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@miroslavpojer miroslavpojer merged commit a7b0e8c into master Sep 9, 2025
6 of 7 checks passed
@miroslavpojer miroslavpojer deleted the feature/162---Introduce-presence-of-Release-Notes-to-Issues branch September 9, 2025 07:37
@miroslavpojer miroslavpojer changed the title #162 - Introduce presence of Release Notes to Issues #162 - Ass support of Issue type to IssueRecord Sep 9, 2025
@miroslavpojer miroslavpojer changed the title #162 - Ass support of Issue type to IssueRecord #162 - Add support of Issue type to IssueRecord Sep 9, 2025
Copy link

@coderabbitai coderabbitai bot left a 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
DEVELOPER.md (1)

99-121: Fix repeated “my[py]” typos to “mypy”.

These appear multiple times in this section and are user-facing.

-This project uses the [my[py]](https://mypy.readthedocs.io/en/stable/) tool, a static type checker for Python.
+This project uses the [mypy](https://mypy.readthedocs.io/en/stable/) tool, a static type checker for Python.
@@
-my[py] configuration is in `pyproject.toml` file.
+mypy configuration is in `pyproject.toml` file.
@@
-Follow these steps to format your code with my[py] locally:
+Follow these steps to run mypy locally:
@@
-### Run my[py]
+### Run mypy
@@
-Run my[py] on all files in the project.
+Run mypy on all files in the project.
@@
-To run my[py] check on a specific file, follow the pattern `mypy <path_to_file>/<name_of_file>.py --check-untyped-defs`.
+To run mypy on a specific file, use `mypy <path_to_file>/<name_of_file>.py --check-untyped-defs`.
release_notes_generator/model/issue_record.py (1)

105-129: Also parse release notes from the Issue body (not only linked PRs).

PR objective mentions presence of Release Notes on issues; currently only PR bodies are parsed. Add Issue body parsing before iterating PRs.

 from typing import Optional, Any
+from typing import cast
@@
         # Code Rabbit detection regex
         cr_active: bool = ActionInputs.is_coderabbit_support_active()
 
+        # Check Issue body first
+        if self._issue.body:
+            if detection_regex.search(self._issue.body):
+                # reuse extractor; cast to satisfy type checker
+                release_notes += self._get_rls_notes_default(cast(Any, self._issue), line_marks, detection_regex)
+            elif cr_active:
+                cr_detection_regex: re.Pattern[Any] = re.compile(ActionInputs.get_coderabbit_release_notes_title())
+                if cr_detection_regex.search(self._issue.body):
+                    release_notes += self._get_rls_notes_code_rabbit(
+                        cast(Any, self._issue), line_marks, cr_detection_regex
+                    )
+
         # Iterate over all PRs
         for pull in self._pull_requests.values():
             if pull.body and detection_regex.search(pull.body):
                 release_notes += self._get_rls_notes_default(pull, line_marks, detection_regex)
             elif pull.body and cr_active:
                 cr_detection_regex: re.Pattern[Any] = re.compile(ActionInputs.get_coderabbit_release_notes_title())
 
                 if cr_detection_regex.search(pull.body):
                     release_notes += self._get_rls_notes_code_rabbit(pull, line_marks, cr_detection_regex)

Would you like a companion unit test that covers Issue body extraction (both default and CodeRabbit formats)?

🧹 Nitpick comments (6)
DEVELOPER.md (2)

138-140: Clarify that these are alternatives to avoid running tests twice.

Add a hint line so readers pick one command, not both.

 ```shell
-pytest --cov=. -v tests/ --cov-fail-under=80                      # Check coverage threshold
-pytest --cov=. -v tests/ --cov-fail-under=80 --cov-report=html    # Generate HTML report
+# Pick one of the following:
+pytest --cov=. -v tests/ --cov-fail-under=80                      # Check coverage threshold
+pytest --cov=. -v tests/ --cov-fail-under=80 --cov-report=html    # Generate HTML report

---

`146-148`: **Make HTML report opening cross-platform.**

“open” is macOS-specific; suggest a portable option.


```diff
-open htmlcov/index.html
+python -m webbrowser htmlcov/index.html  # cross-platform
+# or: xdg-open htmlcov/index.html        # Linux
+# or: start htmlcov\\index.html          # Windows
release_notes_generator/model/issue_record.py (2)

70-78: Docstring return type mismatch.

Property returns Optional[str] but docstring says str.

     @property
     def issue_type(self) -> Optional[str]:
         """
         Gets the type of the issue.
         Returns:
-            str: The type of the issue.
+            Optional[str]: The type of the issue, or None if not set.
         """
         return self._issue_type

255-260: Fix param type in docstring.

This helper accepts a PullRequest-like object with a body; current docstring mentions PullRequestRecord.

-        Parameters:
-            pull (PullRequestRecord): The pull request from which to extract release notes.
+        Parameters:
+            pull (PullRequest): The pull request from which to extract release notes.
tests/release_notes/model/test_pull_request_record.py (1)

49-49: Silence S101 (“assert”) in tests via Ruff config (optional).

If Ruff flags S101 in tests, configure per-file ignores in pyproject.

# pyproject.toml
[tool.ruff]
# ...
[tool.ruff.per-file-ignores]
"tests/**.py" = ["S101"]

Also applies to: 56-57

tests/release_notes/model/test_issue_record.py (1)

25-44: Helper is concise; consider freezing time (optional).

created_at = datetime.now() isn’t asserted, but if needed later, prefer a fixed datetime for determinism.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aa99988 and b65a948.

📒 Files selected for processing (5)
  • DEVELOPER.md (1 hunks)
  • release_notes_generator/model/issue_record.py (2 hunks)
  • tests/release_notes/model/test_issue_record.py (1 hunks)
  • tests/release_notes/model/test_pull_request_record.py (1 hunks)
  • tests/release_notes/test_record_factory.py (0 hunks)
💤 Files with no reviewable changes (1)
  • tests/release_notes/test_record_factory.py
🧰 Additional context used
🧬 Code graph analysis (2)
tests/release_notes/model/test_pull_request_record.py (2)
release_notes_generator/model/pull_request_record.py (1)
  • PullRequestRecord (15-286)
tests/conftest.py (1)
  • pull_request_record_merged (479-482)
tests/release_notes/model/test_issue_record.py (1)
release_notes_generator/model/issue_record.py (3)
  • IssueRecord (16-301)
  • issue (63-68)
  • issue_type (71-77)
🪛 Ruff (0.12.2)
tests/release_notes/model/test_pull_request_record.py

49-49: Use of assert detected

(S101)


56-56: Use of assert detected

(S101)


57-57: Use of assert detected

(S101)

tests/release_notes/model/test_issue_record.py

49-49: Use of assert detected

(S101)


55-55: Use of assert detected

(S101)

🔇 Additional comments (4)
release_notes_generator/model/issue_record.py (1)

30-34: Good addition: capture GitHub Issue Type.

Initialization handles None safely; aligns with the new tests.

tests/release_notes/model/test_pull_request_record.py (2)

25-50: CR summary ignore-case works and assertion is clear.

Good targeted fixture and patches; expected output matches parser behavior.


53-57: Commit lookup test covers both paths.

LGTM; considers present and missing SHAs.

tests/release_notes/model/test_issue_record.py (1)

46-55: Issue type initialization is correctly validated.

Both None and concrete type cases covered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant