Skip to content

Conversation

@famouswizard
Copy link
Contributor

found a couple of small spots that could throw errors if the heading match didn’t have all the expected groups.

  • added ?. so it won’t blow up when m.groups.text is missing.
  • added a start && check before touching start.groups.

this pr makes the heading check a bit safer and avoids random crashes on empty headings.

PR Checklist

  • Tests
  • Documentation
  • Changeset entry (run npx changeset add)

@famouswizard famouswizard requested a review from a team as a code owner November 4, 2025 12:02
@changeset-bot
Copy link

changeset-bot bot commented Nov 4, 2025

⚠️ No Changeset found

Latest commit: 280500c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

Walkthrough

A conditional check in the extractSection function within scripts/release/workflow/github-release.js was refactored to use optional chaining for m.groups.text and add a guard condition for the start variable. This change prevents potential runtime errors when text is undefined while preserving the original end-detection logic. The control flow remains unchanged: it identifies the start heading matching the target heading, then locates the next heading with equal or lesser leading hashes to set the end position.

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing crashes caused by missing heading data, which aligns with the changeset's focus on adding defensive checks for undefined group properties.
Description check ✅ Passed The description is directly related to the changeset, explaining the specific safety improvements (optional chaining and start checks) made to prevent crashes when heading groups are missing.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 04e683b and 280500c.

📒 Files selected for processing (1)
  • scripts/release/workflow/github-release.js (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: slither
  • GitHub Check: coverage
  • GitHub Check: tests-foundry
  • GitHub Check: halmos
  • GitHub Check: tests
  • GitHub Check: tests-upgradeable
🔇 Additional comments (1)
scripts/release/workflow/github-release.js (1)

35-37: LGTM! Good defensive programming.

Both changes correctly prevent crashes:

  • Optional chaining handles headings without text (per the regex, the text group is optional)
  • The start && guard prevents accessing start.groups before start is set, which could happen if no heading matches on the first iteration

The logic remains correct: find the start heading, then find the next heading at the same or higher level to determine the end boundary.


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.

@Amxx Amxx added the CI label Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants