Autocomplete Testing Skill
Validate the smart autocomplete engine against documented test scenarios.
Workflow
Read the test scenarios from
_study/AUTOCOMPLETE.md(Test Scenarios section).Read the relevant source files:
packages/core/src/autocomplete.ts- classifyInput(), suggest(), rankSuggestions()packages/core/src/address-parser.ts- getParser(), POSTCODE_RE, NUMBER_FIRSTpackages/core/src/search.ts- suggestionScore(), SearchCache
Trace the flow for the user's test case:
- What does
classifyInput(input, cc)return? (street/postcode/mixed/ready) - What parser does
getParser(cc)return? - What does
parseAddress(input)extract? (street, number, postcode, unit) - What SQL would
buildStreetSQL()orbuildPostcodeSQL()generate? - How would
rankSuggestions()order the results with the given city? - City search now uses
searchCities()JS array search (not DuckDB SQL). It does prefix match with contains fallback + similarity ranking preNormalize()can be used to pre-compute normalized names at prefetch time for faster search
- What does
Check for regressions against the 3 known issues:
- Issue 1: Duplicate cities (GROUP BY region, city dedup)
- Issue 2: City boost in ORDER BY (list_has_any tile overlap)
- Issue 3: Word match > prefix match (suggestionScore tiers)
Report whether the code correctly handles the test case, with the exact classification, SQL, and ranking that would be produced.
Key Constants to Check
NUMBER_FIRSTset in address-parser.ts must match pipeline SQL (addresses.sql line 143)POSTCODE_REpatterns per countrysuggestionScoretiers: 100=exact, 80=word, 60=prefix, 40=substring, 0-30=Jaccard
Source: walkthru-earth/geocoding-playground — distributed by TomeVault.