Skip to content

Project Tango v3.0.1 — lookback window fix, restored-state validation

Choose a tag to compare

@CoderGamerUnknow CoderGamerUnknow released this 04 Oct 10:59
· 16 commits to main since this release

Bug fixes

A bug-fix release: no API changes, no new tools, no behaviour change beyond the two defects below.

smart_restock_predictor measured one day more than it reported

The sales lookback window subtracted the full salesLookbackDays from its anchor date while the window filter includes both bounds — so a 30-day lookback actually covered 31 calendar days of demand and still divided by 30. Every velocity ran about 3% high, daysOfCover ran low, and recommendedReorderQuantity came out too large.

The window now spans exactly salesLookbackDays calendar days counting the anchor day, so the reported window.start/window.end match the arithmetic that produced the figures.

Verified end to end: a product selling 1 unit/day for 30 days, plus one order a week older than the window, previously reported unitsSoldInWindow: 31, dailyVelocity: 1.033, daysOfCover: 1.9, reorder 20. It now reports 30, 1, 2, 19.

Non-finite numbers in a restored state file broke every analytics tool

The state store validated restored records with typeof x === "number", which accepts Infinity — the value JSON.parse("1e999") produces — and fractional quantities. Those passed validation, reached the catalog, and then failed the tools' own declared output schemas:

MCP error -32602: Output validation error: Invalid structured content for tool
analyze_sales_metrics: Invalid input: expected number, received Infinity

One bad field in one record turned analyze_sales_metrics, smart_restock_predictor and find_orders into hard failures for the whole dataset. JSON.stringify cannot express either value, so only a hand-edited or foreign-written state file could produce it — but the file's stated contract is that an unreadable state degrades to the seed dataset rather than taking the tools down.

Record validation now requires finite numbers, and integers where the schemas declare them, so such records are dropped and warned about like any other malformed record.

Verification

Gate Result
npm run typecheck 0
npm run lint 0 errors, 0 suppressions
npm run test:coverage 210/210 tests, 42 suites, above the 98/94/96 floors
npm run build 0
Live stdio run 8 tools, 30-day window matches policy, write path intact

Upgrade

Drop-in: no tool names, parameters or response fields changed. If you compare restock output against v3.0.0, reorder quantities will be slightly lower — that is the over-ordering being corrected, not a regression.