Skip to content

fix(release): skip comments and fences in changelog sections - #1335

Open
vchamarthi wants to merge 5 commits into
intel:mainfrom
vchamarthi:issue-1290-release-respect-comments-and-fences
Open

vchamarthi wants to merge 5 commits into
intel:mainfrom
vchamarthi:issue-1290-release-respect-comments-and-fences

Conversation

@vchamarthi

@vchamarthi vchamarthi commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #1290. check_release.py accepted a ## [X] section whose only bullet sat inside a multiline <!-- --> comment, and --notes stopped at a ## heading inside a fenced example. I made both follow the Markdown the maintainer sees.

Changes

  • release_notes uses _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.
  • New _has_entry looks 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).
  • Tests and a Fixed fragment in changelog.d/.
  • docs/releasing.md says the check ignores comments and fences.
  • Inline code spans (including longer delimiters and multiline spans) are ignored when looking for <!--, 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.py changes. 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.py passes (71 tests), and python -m ruff check on both changed .py files 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.

  • I chose Bullets inside fenced code blocks do not count as entries over Ignoring only HTML comments for the entry check: The issue asks the check to respect fences, and a fenced example is not a release entry. Is that the behaviour you want?
  • I chose Line scan with fence state in release_notes over 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

  • Tests added/updated and pytest passes
  • ruff, mypy, and schema checks pass
  • Docs updated (or N/A) — see the docs-drift checklist in CONTRIBUTING.md
  • Self-reviewed per "Before opening a PR" in AGENTS.md
  • Each new raise/exit and test names the doc, contract or issue it traces to
  • No ad-hoc run artifacts committed
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml)
Checklist evidence
  • Tests added/updated and pytest passes: 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 change
  • ruff, 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 base
  • Docs updated (or N/A): updated: dokimi/docs/releasing.md
  • Self-reviewed per "Before opening a PR" in AGENTS.md: nothing left open; mutation of changed lines ran
  • Each new raise/exit and test names the doc, contract or issue it traces to: every new error path and test names a doc, contract or issue
  • No ad-hoc run artifacts committed: 1 added file(s), none a run's output
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml): no new source file

Fixes #1290.

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>
@vchamarthi
vchamarthi requested a review from a team as a code owner November 27, 2026 02:51
Copilot AI balanced review requested due to automatic review settings November 27, 2026 02:51
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
Comment thread dokimi/scripts/check_release.py Fixed
@codecov-commenter

codecov-commenter commented Nov 27, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.19%. Comparing base (24984bd) to head (6924ac1).
⚠️ Report is 18 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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     

see 47 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
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

Comment thread dokimi/scripts/check_release.py Resolved
Comment thread dokimi/scripts/check_release.py Resolved
Comment thread dokimi/scripts/check_release.py Resolved
Comment thread dokimi/scripts/check_release.py Resolved
@exai-bot

exai-bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🔍 OpenCodeReview found 2 issue(s) in this PR.

CI at 6924ac1: 20 passing, 4 skipped.

By label: 1 should fix, 1 not shown by a run

Label Location Finding
should fix check_release.py:129 Positive indentation does not necessarily keep a fence inside the preceding list item.
not shown by a run check_release.py:50-52 Block quotes are incorrectly retained as lazy list continuations.
Test notes (2)
  • dokimi/scripts/check_release.py:129: With in_list = listed or (in_list and fence.start(1) > 0) # an indented fence stays in its item changed to in_list = listed or (in_list and fence.start(1) >= 0) # an indented fence stays in its item, the tests still pass: dokimi/tests/test_check_release.py. A value exactly at the boundary gives the same result either way here, so no test says which one is meant.
  • dokimi/scripts/check_release.py:43: With return bool(re.match(r" {0,3}(?:[-*+]|1[.)]) ", line)) changed to return None, the tests still pass: dokimi/tests/test_check_release.py. If this condition matters, a test should pin it.
Review details
  • Commit reviewed: 6924ac1 against merge base 8f6a804
  • Coverage: 2 files in 1 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 197k tokens (137k from cache), 1m13s
  • Tool calls: 9 (4 file_read, 3 pr_threads, 2 code_comment)
  • small change set: 2 files

Comment thread dokimi/scripts/check_release.py Resolved
Comment thread dokimi/scripts/check_release.py Resolved
Comment thread dokimi/scripts/check_release.py Resolved
Comment thread dokimi/scripts/check_release.py Resolved
Comment thread dokimi/scripts/check_release.py Resolved
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>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

@github-advanced-security, this is ready for another look: 1 commit on issue-1290-release-respect-comments-and-fences (5ad161f..861d93c) answers your thread.

Changes:

  • A <!-- in a multiline code span no longer hides the next release heading.
  • Backticks inside a comment no longer hide its -->.
  • An escaped \<!-- opens no comment.
  • A comment opened on the section heading hides the entries under it.
  • A code span no longer runs past a heading or into a following HTML comment block.
  • A code span no longer runs past a list item.

PR description updated:

  • Inline code spans (including longer delimiters and multiline spans) are ignored when looking for <!--, 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.

Threads and comments:

  • I answered each one in its thread: 11 fixed.

What I checked on the new commit:

  • One thread I marked fixed has no test of its own; the reply there says what changed.
  • All 3 new tests fail before the fix and pass after it.
  • The full test suite passes with main merged in (30,652 tests), apart from 1 failure main has too.
What each test shows
  • The new scanner tests: fails before, passes after.
  • The new scanner tests: fails before, passes after.
  • The new scanner tests: fails before, passes after.

Comment thread dokimi/scripts/check_release.py Resolved
Comment thread dokimi/scripts/check_release.py Resolved
Comment thread dokimi/scripts/check_release.py Resolved
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>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

This is ready for another look: I've pushed 1 commit on issue-1290-release-respect-comments-and-fences (861d93c..8f6a804).

Threads:

  • I answered each one in its thread: 3 fixed.

What I checked on the new commit:

  • 4 of 7 new tests fail before the fix and pass after it; the other 3 pass before the fix too, so they guard the change rather than reproduce a bug.
  • The full test suite passes with main merged in (30,978 tests), apart from 1 failure main has too.
What each test shows
  • ordered item: fails before, passes after.
  • list item fence: fails before, passes after.
  • indented code comment: fails before, passes after.
  • multi-digit item fence: passes before the fix too.
  • only 1. interrupts: passes before the fix too.
  • list fence ends with the item: passes before the fix too.
  • list fence closer indent: fails before, passes after.

Comment thread dokimi/scripts/check_release.py Resolved
Comment thread dokimi/scripts/check_release.py Resolved
Comment thread dokimi/scripts/check_release.py Resolved
Comment thread dokimi/scripts/check_release.py Resolved
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>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

This is ready for another look: I've pushed 1 commit on issue-1290-release-respect-comments-and-fences (8f6a804..6924ac1).

Threads:

  • I answered each one in its thread: 4 fixed.

What I checked on the new commit:

  • 4 of 8 new tests fail before the fix and pass after it; the other 4 pass before the fix too, so they guard the change rather than reproduce a bug.
  • The full test suite passes with main merged in (31,146 tests), apart from 1 failure main has too.
What each test shows
  • test_an_ordered_item_two_cannot_open_a_fence_inside_a_paragraph: fails before, passes after.
  • test_a_mixed_delimiter_line_does_not_close_a_fence: fails before, passes after.
  • test_a_nested_bullet_after_a_list_item_fence_counts: fails before, passes after.
  • test_a_nested_bullet_after_a_lazy_continuation_counts: fails before, passes after.
  • test_an_ordered_item_two_after_a_heading_opens_a_fence: passes before the fix too.
  • test_a_fence_on_a_continuation_line_keeps_the_item: passes before the fix too.
  • test_an_ordered_item_two_after_a_comment_line_opens_a_fence: passes before the fix too.
  • test_a_thematic_break_ends_the_list_item: passes before the fix too.

Comment on lines +50 to +52
if _LIST.match(line) or not (para and in_list) or _BLOCK.match(line):
return bool(_LIST.match(line))
return True

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · not shown by a run
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · should fix
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

This branch has not been deployed

No deployments
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.

release: respect comments and fences in changelog sections

5 participants