fix(economy): a dataset we could not parse is unmeasured, not zero #279

Merged
coilysiren merged 1 commit from coilyco-ops/unreadable-dataset-is-not-zero into main 2026-08-13 22:51:46 +00:00 AGit
Member

closes #283 - _fetch_dataset returned [] for any 200, so an unparseable body became a confident zero and a healthy verdict

Slice of #266, which stays open: the 25-tool audit and its generic invariant test are not this.

closes #283 - _fetch_dataset returned [] for any 200, so an unparseable body became a confident zero and a healthy verdict Slice of #266, which stays open: the 25-tool audit and its generic invariant test are not this.
get_economy reported govt_funds: 0 with datasets_unavailable: [] against
a server where get_currency read money.governmentHoldings as 87,912.99.
Same dataset, same server, same minute, two answers — and get_economy's
own govt_funds_note says the value comes from that dataset.

wages_total, taxes_paid, govt_funds_received and net_tax_flow were 0 too,
and health: "healthy" plus the narrative are derived from them, so the
reader got a conclusion built on unread inputs.

Everything downstream was already correct. _opt_last returns None when a
series is absent and 0.0 when it was read and empty, and fetch_economy
only files a name under datasets_unavailable when _fetch_dataset returns
None. The defect is that _fetch_dataset never returned None for a body it
could not read.

It returns a list — possibly empty — whenever the server answered 200,
including when the body is in a shape the parser does not know. A dict
under neither Values nor Points, rows keyed differently, or a non-list
non-dict payload all yield zero parsed points, and an empty list is then
indistinguishable from a genuinely idle dataset.

So it now counts what the body offered against what parsed. Offered rows
with nothing understood is unreadable and returns None. A genuinely empty
series still returns [], because nothing happened and nothing was read
are different facts and this issue exists to keep them apart.

That is the same shape as eco-app#269, where fetch_history recorded
transport failures instead of raising and the caller's except branch was
unreachable. Both make an unread state look measured.

Mutation: treating the empty parse as measured zero again fails the
unreadable-shape and unparseable-rows tests, and leaves the
genuinely-empty test green.

Slice of #266, which stays open: get_currency still turns a 401 into "no
currencies have been created or traded yet" with admin_ok true, and the
25-tool audit with its generic invariant test is not this.

Refs #266, #261

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Kai Siren <coilysiren@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
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
coilyco-gaming/eco-app!279
No description provided.