Skip to content

fix(search): group entity-choice menus by entity_choice - #66

Merged
jm-rivera merged 1 commit into
devfrom
fix/entity-choice-menus
Oct 25, 2026
Merged

jm-rivera merged 1 commit into
devfrom
fix/entity-choice-menus

Conversation

@jm-rivera

Copy link
Copy Markdown
Contributor

Entity-choice menus group by entity_choice when the API sends it, and by mention text when it does not. entityChoiceGroups in src/lib/search/parsedEdit.ts puts an option with a numeric entity_choice in the no_data.ambiguous_entities group of that index, and ambiguousWordingGroup in src/lib/search/view.ts matches 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_choice is optional in src/lib/search/types.ts until 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 typecheck and pnpm lint pass, and node --test src/lib/search/test/*.test.ts passes 950 of 950. The three new Congo assertions fail on dev's parsedEdit.ts and view.ts, and the existing fixtures without the field pass unchanged. The full pnpm test fails 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

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>
@jm-rivera
jm-rivera marked this pull request as ready for review October 25, 2026 12:40
@jm-rivera
jm-rivera merged commit d7e715e into dev Oct 25, 2026
2 checks passed
@jm-rivera
jm-rivera deleted the fix/entity-choice-menus branch October 26, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant