Disable TopK/filtered pruning, preserve legacy threshold behavior #682
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 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.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #682"
general
weight: 0.35
tlwillke
This is a hotfix for JV 4.0.0-rc.8. Resolves #678.
Summary
This hotfix disables the unsafe
threshold == 0graph-search pruning path while preserving legacy threshold-search behavior for compatibility.GraphSearcher.usePruning(boolean)is now deprecated and retained only for source and binary compatibility. Calls to this method no longer enable TopK or filtered-search pruning.Threshold searches, where
threshold > 0, continue to use the existing legacy threshold early-termination path. This is intentional because threshold search may already be used by customers, and changing that behavior in this hotfix could be a compatibility break.In short:
Why This Change Is Needed
The existing TopK/filtered pruning implementation did not demonstrate reliable value and carried recall risk.
The original pruning design had several problems:
1. Pruning was used to skip graph expansion.
The search could pop a candidate and skip expanding its neighbors, then continue searching. In graph search, expansion is how better candidates are discovered, so this changes the traversal and can reduce recall.
2. TopK pruning was redundant with standard graph-search termination.
Plain TopK already has the standard frontier-vs-result-queue termination condition. Adding another relaxed-monotonicity signal can only terminate earlier than the normal search and therefore risks recall loss.
3. Filtered TopK did not show useful benefit.
This implementation already applies
acceptOrdsduring traversal. In low-cardinality filtering tests, additional pruning saved almost no visits while sometimes reducing recall.4. Threshold pruning is imperfect but may be in use.
Diagnostic threshold testing showed that the legacy threshold path can save substantial work for very selective thresholds, but it can lose recall for less-selective thresholds. Because this behavior existed previously, this hotfix preserves it rather than changing threshold semantics.
Evidence From Filtering Tests
Filtered TopK was the primary case where pruning was expected to help. The observed benefit was negligible.
| Filter selectivity | Hierarchy | Visit reduction from pruning | Recall delta from pruning |
|---:|---:|---:|---:|
| 50% | off | 0.81% | -0.0082 |
| 10% | off | 0.05% | -0.0006 |
| 2% | off | 0.01% | -0.0003 |
| 50% | on | 0.06% | -0.0006 |
| 10% | on | 0.02% | -0.0001 |
| 2% | on | 0.00% | 0.0000 |
This indicates that the existing filtered-search implementation already gets the useful behavior from applying
acceptOrdsduring traversal, and the additional relaxed pruning tracker does not provide meaningful value.Evidence From Threshold Diagnostics
Threshold pruning remains preserved for compatibility, but diagnostic testing showed why it should not be expanded or treated as a validated general pruning mechanism.
| Expected threshold matches | Visit reduction from legacy threshold pruning | Recall with pruning |
|---:|---:|---:|
| 25 | 79.05% | 1.000 |
| 100 | 79.05% | 0.932 |
| 500 | 68.50% | 0.618 |
Implementation Notes
GraphSearcher.usePruning(boolean)The API is deprecated and retained for compatibility.
Compatibility Notes
usePruning(boolean)method still exists.usePruning(true)no longer enable TopK or filtered pruning.Tests Added / Updated
TestPruningCompatibilityAdds explicit coverage for the new compatibility contract.
testScoreTrackerFactoryPolicyVerifies tracker selection:
This confirms that
RelaxedMonotonicityTrackeris disabled forthreshold == 0, while legacy threshold behavior is preserved.testUsePruningIgnoredForTopKAndFilteredTopKVerifies that
usePruning(true)has no effect for:The test compares pruning-on and pruning-off searches over the same graph, queries, and filters, and asserts:
testUsePruningIgnoredForThresholdSearchVerifies that
usePruning(true)andusePruning(false)produce identical threshold-search behavior.This confirms that the public pruning API is ignored, while the legacy threshold path remains unchanged.
TestLowCardinalityFilteringKeeps coverage for filtered TopK search behavior and filter correctness.
The test evaluates filtered search across multiple selectivities:
For each selectivity, the test compares pruning-off and pruning-on behavior over the same graph, queries, and filter set. It validates that returned nodes satisfy
acceptOrdsand records the visit/recall effect of pruning.This test documents why filtered TopK pruning is being disabled: the measured visit reduction was negligible while recall could decrease slightly.
Test2DThresholdContinues to validate legacy threshold-search behavior.
This test is retained because threshold searches are intentionally preserved for compatibility. It checks that threshold queries continue to return sufficient matching nodes and meet the existing visited/recall expectations.
Release Note Text
Future Work
Any future pruning implementation should be reintroduced only after a separate redesign and validation effort. A replacement should: