Skip to content

Conversation

@chhoumann
Copy link
Owner

@chhoumann chhoumann commented Feb 1, 2026

Fixes #593

Corrects end-of-section detection so captures configured with “Insert at end of section” append in-order instead of stacking under the header.

Adds a regression test for headings with only subsections.

@vercel
Copy link

vercel bot commented Feb 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
quickadd Ready Ready Preview Feb 1, 2026 1:40pm

@coderabbitai
Copy link

coderabbitai bot commented Feb 1, 2026

📝 Walkthrough

Walkthrough

Fixes a bug in the getEndOfSection helper by changing it to return the actual line number of the next heading instead of its index in the headings array, with additional test coverage for the subsections-false scenario.

Changes

Cohort / File(s) Summary
getEndOfSection Implementation
src/formatters/helpers/getEndOfSection.ts
Replaces Array.findIndex() with Array.find() to return the next heading's line property instead of array index; returns null if no heading exists. Variable renamed from nextheading to nextHeading.
getEndOfSection Tests
src/formatters/helpers/getEndOfSection.test.ts
Adds test case covering scenario where target is a heading with only subsections and shouldConsiderSubsections is false, verifying end index remains 2.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A heading's line, not its place in the queue,
Now finds the right end, shiny fresh and new,
No more reversed notes in topsy-turvy row,
The section's true boundary helps order flow! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main fix: correcting end-of-section insertion to append items in the correct order rather than stacking them.
Linked Issues check ✅ Passed The changes fix the end-of-section detection logic by changing from index-based to line-based lookup, which addresses the ordering issue reported in issue #593.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the end-of-section detection and adding regression test coverage for the reported issue.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/593-insert-end-of-section

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.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional flags.

Open in Devin Review

@cloudflare-workers-and-pages
Copy link

Deploying quickadd with  Cloudflare Pages  Cloudflare Pages

Latest commit: b89fd39
Status:🚫  Deploy failed.

View logs

@chhoumann chhoumann merged commit 0eeedb3 into master Feb 1, 2026
4 of 5 checks passed
@chhoumann chhoumann deleted the fix/593-insert-end-of-section branch February 1, 2026 13:44
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.

[BUG] Does not add note at the End of the section

2 participants