Do not emit a leading boolean operator for the first enabled filter rule (fixes #76) #563
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 286 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.339
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #563"
general
weight: 0.35
pacmano1
Don't emit a leading boolean operator for the first enabled filter rule (fixes #76)
Problem
JavaScriptBuilder.appendFilterScriptbuilds the filter as one boolean expression,prefixing every enabled rule with its operator:
The operator of the first term is emitted too. Normally the first rule's operator is
NONE/null, so nothing is prepended. But when the first step is disabled, the nextenabled rule carries the
AND/ORit was given relative to the step above it, so theexpression starts with a dangling operator:
That is invalid JavaScript, so the channel fails to deploy. Multiple users have hit this
in production.
Fix
Skip the operator for the first enabled rule — it has nothing to combine with:
The channel now deploys and the disabled step does not execute, which is the expected
behavior described in the issue.
Tests
Added
JavaScriptBuilderTest.testFilterDisabledFirstRuleNoLeadingOperator: a disabledfirst step followed by an enabled
ANDrule must not produce a leading operator indoFilter(). The test fails onmainand passes with this change; the existingJavaScriptBuilderTestcases are unchanged (7 tests, 0 failures).A note on approach
The issue raised three possible directions: disallow saving this configuration, fix the
generated code, or reorder so the first enabled rule becomes the first. This PR takes the
second — fixing the generated code — as the least invasive change that produces the
issue's stated expected behavior. Happy to switch to validation-on-save or reordering if
you'd prefer one of those.