ai-coding-minesIndexGitHub

An empty response is not a state

Write APIs

Symptom

Single-record fetch returned an empty object {}. Judged dozens of items as "sales suspended" and ran unnecessary resume calls on ~100.

Reality

All were selling normally. The single-fetch path itself was PRECONDITION_FAILED; the query never happened at all.

First confirm the query actually happened. Don't read a state out of an empty response.

Automation stepped on the same shape

A stock-watch batch was judging external fetch failures as "sold out." When the source blocked us and returned empty, the item went straight onto the sold-out list.

→ Separated fetch failure from real state with a _srcfail flag. And when fetch failures exceed twice the real sold-outs and there are 10+ of them, raise a "verdict unreliable" warning.

If there is no distinct value for "failed," failure will always disguise itself as some normal value.