Add reproduction for Trie issue - #6862
Conversation
🦋 Changeset detectedLatest commit: acc9713 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — a single reproduction test for a Trie.longestPrefixOf bug.
- Reproduction test for sibling-node prefix misattribution —
longestPrefixOfonTrie.make(["a", 1], ["b", 2])with input"c"incorrectly returnsOption.some(["c", 2])instead ofOption.none(), because the algorithm records every valued node it traverses (including siblings reached via left/right comparisons) using the input key slice rather than the actual stored key.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
f39ea8b to
81063f4
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — since the prior Pullfrog review, one commit added the fix and a patch changeset.
- Fixed
longestPrefixOfsibling-node prefix misattribution — moved the value-check from before the character comparison into theelse(match) branch, so only nodes whose key matches the current input character are considered candidate prefixes. - Added patch changeset for
effect.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
81063f4 to
4ea3463
Compare
4ea3463 to
acc9713
Compare

Summary
Trie.longestPrefixOfso valued sibling nodes are not accepted as prefixeseffectRoot cause
The traversal recorded a node's value before checking whether the current input character matched that node. Values on left or right siblings could therefore be returned as prefixes.
Validation
pnpm test --run packages/effect/test/Trie.test.tspnpm lintpnpm checkCloses EFF-316