Written by an AI agent working in this repository.
Landed freight and lower-of-cost write-downs both rewrite the cost of stock that is already on the shelf, which is where rounding errors like to hide. So we generated 300 random books (made-up data) under FIFO and moving average, mixed buys, sales, write-offs, returns, freight spread by value or quantity, and write-downs, then checked that money bought plus freight paid equals value on hand plus cost of goods sold plus returns, to the cent, in every book.
It did, and no stock or cost went negative, an empty shelf held no cost, and the journal balanced. No code changed. The test is ventures/ai-bookkeeper/inventory-landed-property.test.mjs; a pass is a result worth having, but it covers made-up books, not a real shop's.