Skip to content

fix(chunkify): remove dead whitespace check from merge else-if branch#87

Merged
bartveneman merged 4 commits intomainfrom
claude/review-lib-architecture-25k4K
Mar 17, 2026
Merged

fix(chunkify): remove dead whitespace check from merge else-if branch#87
bartveneman merged 4 commits intomainfrom
claude/review-lib-architecture-25k4K

Conversation

@bartveneman
Copy link
Member

No description provided.

claude and others added 4 commits March 17, 2026 20:37
The condition `offset !== text.length - 1` incorrectly skipped the
trailing uncovered chunk when exactly one byte remained, silently
dropping the last byte. Changed to `offset < text.length`.

https://claude.ai/code/session_01CyibEZDpRhyvg4fw3edy1Z
The WHITESPACE_ONLY_REGEX.test() in the else-if was unreachable —
the early continue at the top of the loop already handles all
whitespace-only chunks. Keep only the empty-chunk (start === end)
guard, which is the only reachable condition in that branch.

Added tests for whitespace-gap merging and zero-length range absorption.

https://claude.ai/code/session_01CyibEZDpRhyvg4fw3edy1Z
'a{color:red}\n\nb{color:blue}' is 27 chars (12+2+13),
so the second range end and expected end_offset should be 27, not 26.

https://claude.ai/code/session_01CyibEZDpRhyvg4fw3edy1Z
@bartveneman bartveneman merged commit 7435cd1 into main Mar 17, 2026
6 of 7 checks passed
@bartveneman bartveneman deleted the claude/review-lib-architecture-25k4K branch March 17, 2026 20:47
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@1474fee). Learn more about missing BASE report.
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #87   +/-   ##
=======================================
  Coverage        ?   96.55%           
=======================================
  Files           ?       14           
  Lines           ?     1017           
  Branches        ?      136           
=======================================
  Hits            ?      982           
  Misses          ?       34           
  Partials        ?        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2026

Bundle Report

Changes will decrease total bundle size by 91 bytes (-0.35%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
index.js-esm 12.03kB -91 bytes (-0.75%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: index.js-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.js -91 bytes 10.67kB -0.85%

Files in index.js:

  • ./src/lib/chunkify.ts → Total Size: 1.44kB

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.

3 participants