Munchable scans a barcode and checks the product against conditions the reader has. When the barcode is not in the catalogue, the app asks the reader to photograph the ingredients panel instead, and that capture becomes a row everyone else benefits from. Contributors get a subscription discount for finds.
That means a few hundred lines of code are answering questions like "is this barcode open for a capture", "what does an accepted capture do to the row that is already there", and "has this product actually been contributed, or does it merely exist". Getting those wrong does not throw. It quietly tells a user who just did the work that their product was not wanted, or it loses them a reward they earned.
Everything below lives in two files of pure functions with no I/O. The routes gather facts under a row lock and call them; the unit tests exercise the exact decision tables without a database.…