Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: text partitioning logic #245

Merged
merged 5 commits into from May 22, 2022
Merged

fix: text partitioning logic #245

merged 5 commits into from May 22, 2022

Conversation

piksel
Copy link
Member

@piksel piksel commented May 22, 2022

The fix in #240 only addressed a specific issue, regarding repeated sequences of strings with no whitespace that were exact multiples of the maximum allow chunk size. It just moved the problem to another offset instead.

This does instead fix the real underlying issue and fixing one oddity with previous implementation (why a text string that were the same length as the chunk size would not fit inside one chunk).

Additionally, this includes a test iterating through 8000 text lengths and verifying the contents as well as the chunk sizes.
The general problem with the test is that the logic for calculating the expected sizes works the same way as the implementation. But matched with the unaligned limits and iteration, it should verify the logic sufficiently.

Fixes #244.

@codecov
Copy link

codecov bot commented May 22, 2022

Codecov Report

Merging #245 (c12a45e) into main (bafa90a) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #245      +/-   ##
==========================================
- Coverage   77.55%   77.54%   -0.01%     
==========================================
  Files          95       95              
  Lines        2860     2859       -1     
==========================================
- Hits         2218     2217       -1     
  Misses        469      469              
  Partials      173      173              
Impacted Files Coverage Δ
pkg/util/util.go 100.00% <ø> (ø)
pkg/util/partition_message.go 90.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bafa90a...c12a45e. Read the comment docs.

@piksel
Copy link
Member Author

piksel commented May 22, 2022

There is something odd going on with the coverage. There is one less covered line, but that line has been removed in this PR, so it shouldn't count.

@piksel piksel merged commit ef1a21e into main May 22, 2022
@piksel piksel deleted the fix/partition-sizes branch May 22, 2022 11:14
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.

Sending 1999, 3999 or 5999 characters to Discord panics in util.PartitionMessage (index out of range)
1 participant