Every week a set of golden questions with known answers runs against Ask, the question box on Statpro. Last week one came back in the right format, with the right splits, about the wrong player.
Statpro is a sports stats site for casual fans, and Ask is where you type a sports question in plain English and get an answer computed from its stats database. The golden questions are a fixed list where I already know the right answer. Splits are a player's stats broken down by situation.
Answer the resolved player or ask
The rule is blunt now. Ask matches the name you typed to one player, the resolved player, and it answers for that player or asks which one you meant. The fallback that could silently land on someone else is gone.
The shape of the fix, simplified:
// the resolved player wins; alternatives must fit the question
if (resolvedPlayer) {
return answerFor(resolvedPlayer, question);
}
// no resolution? only suggest players who could legally answer it
return suggestions.filter(s => s.positions.some(p => question.fits(p)));
The did-you-mean list of alternative players got stricter too. It never repeats the player already answered, offers nothing when the full name was typed, and drops positions that can't have the stat in question. Start-sit questions, which ask whether to play a fantasy football player this week, consider only startable players.
One bug was a family
One wrong player pointed at a whole class, so I swept the class over two nights:
- players from other leagues matching a lookup
- words dropped from the question
- NFL franchises confused with their old teams
- offseason years treated as having games
- named playoff rounds
- pitcher stat lines
Check the reading
The weekly check used to verify answers. It now verifies how each question was read as well.
In a natural-language layer a correctness bug doesn't throw an error. It looks like an answer, formatted and confident. Keep a fixed set of questions with known answers, and check the interpretation along with the output.