Improve search logic (#6637)

# Description of Changes
Search has got significantly worse since #6581, where I added all the
missing tags for tools that should have been there for months. Turns out
that the fuzzy matching search logic has always been way too permissive
to match words with Levenshtein distances way too far away from the
target word, so long searches include way too much stuff. The new tags
just exposed that underlying logic issue. This PR makes the Levenshtein
logic much stricter, so it is still tolerant to minor typos in tool
names, but doesn't match completely inappropriate strings.
This commit is contained in:
James Brunton
2026-06-12 10:34:11 +01:00
committed by GitHub
parent ea102cdb93
commit d363a1e957
4 changed files with 149 additions and 14 deletions
@@ -52,14 +52,14 @@ public class PaygWebMvcConfig implements WebMvcConfigurer {
/**
* The {@code EntitlementGuard} runs BEFORE the charge interceptor. Spring runs interceptors in
* ascending order on the way in and skips a later interceptor's {@code preHandle} (and its
* {@code afterCompletion}) entirely once an earlier one returns {@code false} — so a request the
* guard refuses (over its free allowance / spending cap, or with no subscription to bill)
* {@code afterCompletion}) entirely once an earlier one returns {@code false} — so a request
* the guard refuses (over its free allowance / spending cap, or with no subscription to bill)
* short-circuits with its 402 before the charge interceptor ever runs. A blocked request
* therefore never opens a process, materialises inputs, or writes a charge: a refused operation
* must not bill, and running the guard first guarantees that structurally rather than by
* compensating after the fact. Stays above the legacy {@code UnifiedCreditInterceptor} (default
* order 0, only registered under the {@code legacy-credits} profile) so a legacy rejection still
* wins.
* order 0, only registered under the {@code legacy-credits} profile) so a legacy rejection
* still wins.
*/
public static final int ENTITLEMENT_GUARD_ORDER = 900;