
ru, then rust, into a search box that matches package names by prefix. For a moment the results look right. Then Ruby appears at the top of the list. The input still says rust. Where would you put your first breakpoint?
I build Umide, a workspace for coding with agents. For this particular bug I’d close the chat and turn off generated completions. I want a chance to write down what I think happened while I can still be wrong about it. Once I’ve read a plausible explanation, it’s surprisingly easy to convince myself I would have spotted it.
What would each explanation look like?
rust into an empty box should also turn up Ruby. In this example, pasting works. Only typing produces the flicker. Those two ways of entering the same word give me a reason to look at the requests.
I’d log the query in two places, when the request leaves and when its results reach the screen. I’d keep the query that started the request in the log. Reading the current value of the input both times would label both replies rust and hide the detail I need.
send ru
send rust
render rust
render ruMake the bug happen on purpose
rust and check the screen. Then release the reply for ru and check it again. That second assertion does the work. If I stop after the first one, even the broken implementation passes.
Here’s the change I’d make for one search box. Call makeSearch once when the box is created and use the returned function for each edit.
function makeSearch(lookup, show) {
let revision = 0
return async function search(query) {
const mine = ++revision
if (query === '') {
show([])
return
}
const results = await lookup(query)
if (mine === revision) show(results)
}
}