Repository navigation
fix(release): skip comments and fences in changelog sections - #1335
vchamarthi wants to merge 5 commits into
Conversation
check_release.py counted a bullet inside an HTML comment as a release entry, and --notes cut the section at a heading inside a fenced block. Scan the changelog line by line with fence state, and look for entries outside comments and fences. Fixes intel#1290 Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1335 +/- ##
==========================================
+ Coverage 96.16% 96.19% +0.03%
==========================================
Files 499 499
Lines 66069 66661 +592
Branches 11470 11593 +123
==========================================
+ Hits 63532 64126 +594
+ Misses 1567 1563 -4
- Partials 970 972 +2 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
_CODE_SPANonly matches inline code spans whose contents contain no backticks. Valid Markdown… · New_CODE_SPANonly matches inline code spans whose contents contain no backticks. Valid Markdown… · New The behavior \"ignore<!--inside inline code spans\" is tested for simple single-backtick spans,… · New This uses a backslash for line continuation inside a multi-clause conditional, which is easy to… · New
What changed in this PR
Updates the release-check logic to treat CHANGELOG.md like Markdown renderers do by ignoring headings/bullets inside HTML comments and fenced code blocks when extracting release notes and validating entries (fixes #1290).
Changes:
- Add fence/comment visibility tracking and update
release_notes()to ignore section terminators inside fences/comments. - Add
_has_entry()to only count bullets that are visible (outside fences/comments) for release validation. - Add targeted tests plus small doc/changelog updates describing the new behavior.
| File | Description |
|---|---|
| dokimi/scripts/check_release.py | Implements comment/fence-aware parsing for notes extraction and bullet detection. |
| dokimi/tests/test_check_release.py | Adds regression coverage for commented/fenced headings and bullets in changelog sections. |
| dokimi/docs/releasing.md | Documents that the release check ignores comments and fenced code blocks. |
| dokimi/changelog.d/20261126_160000_release-check-comments-fences.md | Records the fix in the changelog fragments. |
Review effort: Lite
|
🔍 OpenCodeReview found 2 issue(s) in this PR. CI at By label: 1 should fix, 1 not shown by a run
Test notes (2)
Review details
|
Replace the line-local regex masking in check_release.py with one scan that handles multiline and longer-delimiter code spans, keeps backticks inside comments literal, ignores escaped comment openers and keeps the comment state of a section heading when checking its entries. This also removes the _COMMENT regex CodeQL flagged. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
@github-advanced-security, this is ready for another look: 1 commit on Changes:
PR description updated:
Threads and comments:
What I checked on the new commit:
What each test shows
|
Only a 1. item interrupts a paragraph a code span lives in. A fence may open on a list item's line; it ends with the item and closes on a fence at most three spaces past the item's content indent. Indented code opens no comment. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
This is ready for another look: I've pushed 1 commit on Threads:
What I checked on the new commit:
What each test shows
|
Close a fence only with its own delimiter, refuse a 2. item inside a paragraph as a fence opener (not after a heading, comment line or thematic break), keep list state when a fence opens on an item line or its continuation line, keep it through lazy continuation lines, and end the item at a thematic break. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
This is ready for another look: I've pushed 1 commit on Threads:
What I checked on the new commit:
What each test shows
|
| if _LIST.match(line) or not (para and in_list) or _BLOCK.match(line): | ||
| return bool(_LIST.match(line)) | ||
| return True |
There was a problem hiding this comment.
Block quotes are incorrectly retained as lazy list continuations.
Trigger: text = "## [0.2.0]\n\n1. Top.\n> Quote outside the list.\n\n - Code example only.\n".
Evidence: > Quote outside the list. matches neither _LIST nor _BLOCK, so this helper returns True; the later four-space line bypasses indented-code handling and _section_has_entry(text, "0.2.0") returns True. In Markdown, the unindented block quote ends the list, and the only bullet is an indented code example.
Impact: problems() accepts a release with no visible bullet entries. Recognize block-quote openers as paragraph interruptions before preserving list state, and add this regression test.
Workaround: insert a blank line before the block quote.
Not shown by a run: No run or reading could show it.
| if fence: | ||
| listed = bool(_LIST.match(line)) | ||
| opener, base, para = fence[1], (fence.start(1) if listed else 0), False | ||
| in_list = listed or (in_list and fence.start(1) > 0) # an indented fence stays in its item |
There was a problem hiding this comment.
Positive indentation does not necessarily keep a fence inside the preceding list item.
Trigger: text = "## [0.2.0]\n\n1. Top.\n ~~~\n example\n ~~~\n\n - Code example only.\n".
Evidence: the ordered item's content requires three spaces, so the one-space fence is outside the list, but fence.start(1) > 0 preserves in_list. After the closer and blank line, the indented-code branch is bypassed and _section_has_entry(text, "0.2.0") returns true for the code example.
Impact: problems() accepts a section without a visible release bullet. Track the item's required content indentation and retain its state only when the fence belongs to that container; add a regression alongside the three-space continuation test.
Workaround: put the outside-list fence at column zero.
Should fix: A run shows it; it was not judged to be met in ordinary use.
Shown by running: exit 1 (at the head) · exit 1 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)
python dokimi/scripts/proof_c2.py
What the proof does: Loads check_release.py from the same folder as the proof and asserts _section_has_entry is False when a one-space fence precedes an indented code bullet.
The problem shows as the output FENCE-INDENT: indented code counted as entry.
Script: dokimi/scripts/proof_c2.py (12 lines).
FENCE-INDENT: indented code counted as entry



Summary
Fixes #1290.
check_release.pyaccepted a## [X]section whose only bullet sat inside a multiline<!-- -->comment, and--notesstopped at a##heading inside a fenced example. I made both follow the Markdown the maintainer sees.Changes
release_notesuses_visible, which tracks HTML comments and fenced blocks together (a fence marker in a comment and a comment marker in a fence mean nothing) (backtick or tilde, a closing fence at least as long as the opener), so headings,<a id=anchors and version headings inside a fence are ignored._has_entrylooks for a bullet only on lines outside fences and comments, after removing comments on the line itself (an unclosed one runs to the end of the line).Fixedfragment inchangelog.d/.docs/releasing.mdsays the check ignores comments and fences.<!--, backticks inside a comment are literal, an escaped\<!--opens no comment, a comment opened on a section heading hides the entries under it, a backtick fence cannot have a backtick in its info string, and the notes keep the first line's indentation instead of stripping it.Risk
Only
scripts/check_release.pychanges. The notes text itself is returned as before; an unclosed fence now runs to the end of the file, so a stray fence makes the release check fail rather than pass.Testing
python -m pytest -q -p no:cacheprovider tests/test_check_release.py tests/test_growth_ratchet.pypasses (71 tests), andpython -m ruff checkon both changed.pyfiles is clean. New tests cover comments (closed, unclosed, several), backtick and tilde fences, a longer opening fence, an unclosed fence and a version heading inside a fence. Every new test cites #1290 in its docstring. Two tests cover a version heading inside a comment and a fence marker inside a comment. Three more tests cover a comment opener in an inline code span, an indented code example and a triple-backtick inline span.Open questions
A bullet inside a fenced example does not count as an entry, since the issue asks to respect fences; say if you would rather only comments were ignored there.
release_notesover Masking the whole changelog and slicing the original: Smallest change and keeps the notes text untouched. Is that the behaviour you want?Revert
Revert the commit; nothing is stored.
Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)Checklist evidence
pytestpasses: 1 test file(s) changed; suite: 30451 passed; 1 failing test(s) fail on the base branch too: tests/test_repo_compare_interval.py::test_the_row_p_places_zero_where_large_deltas_round_p_at_zero_apart; 7 of 7 proof(s) fail before the changeruff,mypy, and schema checks pass: passed: ci.yml:static / ruff check, ci.yml:typecheck / mypy, ci.yml:static / schema-check, ci.yml:static / schema_compat vs the PR basedokimi/docs/releasing.mdAGENTS.md: nothing left open; mutation of changed lines ranraise/exit and test names the doc, contract or issue it traces to: every new error path and test names a doc, contract or issue.github/.licenserc.yaml): no new source fileFixes #1290.