Skip to content

Fix IELR follow-kernel item filtering - #808

Open
ydah wants to merge 1 commit into
masterfrom
fix/ielr-follow-kernel-filter
Open

Fix IELR follow-kernel item filtering#808
ydah wants to merge 1 commit into
masterfrom
fix/ielr-follow-kernel-filter

Conversation

@ydah

@ydah ydah commented Sep 6, 2026

Copy link
Copy Markdown
Member

States#compute_follow_kernel_items assigned 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 in lhs_contributions and goto_follow_set admitted 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 zip each boolean to its corresponding kernel when building state.follow_kernel_items.
  • Add a spec that validates follow_kernel_items stores 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 thread spec/lrama/states_spec.rb
Comment on lines +1893 to +1894
expect(values).to include(false)
expect(values).to all(satisfy("be a boolean") { |value| value == true || value == false })
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.

2 participants