Fix trailing uncovered chunk generation in chunkify#86
Merged
bartveneman merged 1 commit intomainfrom Mar 17, 2026
Merged
Conversation
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
Bundle ReportChanges will decrease total bundle size by 6 bytes (-0.02%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: index.js-esmAssets Changed:
Files in
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #86 +/- ##
==========================================
- Coverage 96.56% 96.07% -0.50%
==========================================
Files 14 14
Lines 1020 1020
Branches 136 136
==========================================
- Hits 985 980 -5
- Misses 34 39 +5
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixed a bug in the
chunkifyfunction where the condition for appending a trailing uncovered chunk was incorrect, causing it to miss the last byte when it wasn't covered by any range.Changes
offset !== stylesheet.text.length - 1tooffset < stylesheet.text.lengthto correctly detect when a trailing uncovered chunk should be appendedImplementation Details
The original condition used
!==which only appended a chunk when the offset was not exactly one position before the end. This failed to handle the case where the last byte needed to be marked as uncovered. The corrected condition<properly checks if there are any remaining bytes after the current offset that need to be included in the coverage map.https://claude.ai/code/session_01CyibEZDpRhyvg4fw3edy1Z