fix: avoid Invalid string length when combining many hashes#16
Merged
fix: avoid Invalid string length when combining many hashes#16
Invalid string length when combining many hashes#16Conversation
combineHashes joined the full hash list into one string before feeding sha256; on large graphs that string exceeds V8's max length. Update the hasher one entry at a time — sha256 is incremental, so the output is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
📖 Docs preview: https://maastrich.github.io/hashup/branches/pr-16/ |
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
Error: Invalid string lengthfromcombineHasheshashes.join("")over millions of 64-char entries exceeds V8's max string length (~512 MB) and throws at the join itself — before sha256 ever sees the inputhasher.update()instead. sha256 is incremental, so on inputs that used to succeed the output hash is byte-for-byte identicalTest plan
tests/combine-hashes.test.ts— output matchessha256(join)on small input; handles 10M hashes (640M chars) without throwing; assertshashes.join("")still throws on that size (regression guard)vp test— 91/91 passingvp checkclean🤖 Generated with Claude Code