Search answers carry no effect id: a superseded search response is kept as the current results #353

Open
opened 2026-11-12 20:41:41 +00:00 by charles · 0 comments
Owner

Found in review of PR #349 (Text chat 17, #267), branch textchat-17-core-search.

ApiResult::SearchResults(Box<SearchResponse>) (crates/fluxer-core/src/event.rs:207, the Text chat 10 event shape) carries no effect id, so Search::answer (crates/fluxer-core/src/chat/search.rs) cannot tell which ApiRequest::SearchMessages an answer belongs to. It only checks that some request is outstanding (loading.take()).

Steps to reproduce (reducer level):

  1. Submit query A (effect id a).
  2. Before A is answered, submit query B (effect id b; loading = Some(b)).
  3. A's response arrives first: it is taken as B's results and loading is cleared.
  4. B's response arrives: dropped as unawaited.

Sort, page and scope changes made while a search is in flight have the same problem.

Fix: carry the request's EffectId in the result (e.g. ApiResult::SearchResults { id, response }, matching how EffectFailed { id, .. } is already matched against loading), have the runtime (Text chat 21) fill it, and compare it in answer. This changes the Text chat 10 event shape, so it is its own change rather than part of #267.

Found in review of PR #349 (Text chat 17, #267), branch `textchat-17-core-search`. `ApiResult::SearchResults(Box<SearchResponse>)` (`crates/fluxer-core/src/event.rs:207`, the Text chat 10 event shape) carries no effect id, so `Search::answer` (`crates/fluxer-core/src/chat/search.rs`) cannot tell which `ApiRequest::SearchMessages` an answer belongs to. It only checks that *some* request is outstanding (`loading.take()`). Steps to reproduce (reducer level): 1. Submit query A (effect id a). 2. Before A is answered, submit query B (effect id b; `loading = Some(b)`). 3. A's response arrives first: it is taken as B's results and `loading` is cleared. 4. B's response arrives: dropped as unawaited. Sort, page and scope changes made while a search is in flight have the same problem. Fix: carry the request's `EffectId` in the result (e.g. `ApiResult::SearchResults { id, response }`, matching how `EffectFailed { id, .. }` is already matched against `loading`), have the runtime (Text chat 21) fill it, and compare it in `answer`. This changes the Text chat 10 event shape, so it is its own change rather than part of #267.
charles added this to the Text chat milestone 2026-11-12 20:41:41 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#353
No description provided.