Repository navigation
fix(search): group entity-choice menus by entity_choice - #66
Merged
Merged
Conversation
An option or slot token carrying entity_choice joins the
no_data.ambiguous_entities group of that index, so two groups written
alike ("aid from Congo to Congo") open two menus, each from its own
slot. Without the field, menus group by mention text as before.
Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Entity-choice menus group by
entity_choicewhen the API sends it, and by mention text when it does not.entityChoiceGroupsinsrc/lib/search/parsedEdit.tsputs an option with a numericentity_choicein theno_data.ambiguous_entitiesgroup of that index, andambiguousWordingGroupinsrc/lib/search/view.tsmatches a slot token the same way. "aid from Congo to Congo" then opens one menu from the "from" slot and another from the "to" slot, where grouping by text would merge them into one "Congo" menu of four options that pin either end.The field comes from DevelopmentFinanceObservatory/apis#119, which quotes both groups in the user's words. This change works against the API before and after that deploys: today's responses carry no field and group exactly as before.
entity_choiceis optional insrc/lib/search/types.tsuntil the vendored client carries it. A response that sends the field on its options but not its slot tokens, or the reverse, opens one menu from the what-token; the API sends it on both.Testing:
pnpm typecheckandpnpm lintpass, andnode --test src/lib/search/test/*.test.tspasses 950 of 950. The three new Congo assertions fail on dev'sparsedEdit.tsandview.ts, and the existing fixtures without the field pass unchanged. The fullpnpm testfails only the 25 Postgres-backed db, migration and share tests, which need a database this run did not have.Co-authored-by: Claude noreply@anthropic.com