Fix IELR follow-kernel item filtering - #808
Open
ydah wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new spec currently asserts the presence of false, which isn’t guaranteed by the behavior under test and could cause future false-negative failures.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes an IELR follow-kernel filtering bug in States#compute_follow_kernel_items where each kernel was incorrectly assigned the entire boolean array (truthy) instead of a per-kernel boolean, making follow-kernel filtering ineffective and potentially overestimating IELR contributions.
Changes:
- Convert the follow-kernel bitmap to a boolean array once, then
zipeach boolean to its corresponding kernel when buildingstate.follow_kernel_items. - Add a spec that validates
follow_kernel_itemsstores actual booleans (not arrays).
File summaries
| File | Description |
|---|---|
| lib/lrama/states.rb | Fixes follow-kernel item assignment by pairing each kernel with its corresponding boolean bit. |
| spec/lrama/states_spec.rb | Adds a regression spec to ensure follow-kernel item values are booleans. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1893
to
+1894
| expect(values).to include(false) | ||
| expect(values).to all(satisfy("be a boolean") { |value| value == true || value == false }) |
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.
States#compute_follow_kernel_itemsassigned the complete boolean array to every kernel instead of assigning each bitmap bit to its corresponding kernel.As both
[false]and[true]are truthy in Ruby, the checks inlhs_contributionsandgoto_follow_setadmitted every kernel. This made the follow-kernel filter ineffective and could overestimate IELR contributions.Convert the bitmap to booleans once and zip each boolean with its corresponding kernel.