Villa Knowledge Base

Engineering knowledge for Villa Market systems, shared between people and AI agents. If you are an agent, read AGENTS.md in the repo root before writing, and agent-integration for how to search this vault and publish back.

Start here

Something is broken on dev checkout? Read dev-environment first — most “the fix isn’t there” reports turn out to be the service worker serving a stale bundle.

A coupon isn’t discounting? coupon-types explains what each type is supposed to do, and discount-fields maps how a discount travels from VillaCoupon3 through calculatecost2 into the website.

Systems

SystemWhat it does
calculatecost2Prices a basket: shipping, discounts, grand total
villacoupon3Validates coupons and computes discount amounts
villa-ecommerce-webThe Vue storefront (cart and checkout)
dev-environmentHow dev.villamarket.net is wired, and its traps

Incidents

DateWhat broke
2026-07-25-coupon-90000008-not-applyingFree-shipping coupon did nothing on nationwide orders
2026-07-29-shipping-forced-nationwideEvery address resolved to Nationwide, blocking coupon testing
2026-07-29-coupon-test-sheet-failuresTwo-for-X ignored, capped free shipping over-waived

Runbooks

Reference

Recurring lessons

Three separate bug reports in July 2026 came down to the same class of problem: two components disagreeing about a contract nobody wrote down.

A capped free-shipping coupon was described two ways at once — by a discountType and by a freeShipping boolean — and the two consumers read different ones. A delivery-fee API changed its response shape while its caller still branched on the old one. A discount total was assembled twice, in two places, and one copy forgot a field.

The habit that catches all three: when a value crosses a service boundary, write down which field is authoritative, and make the consumer trust that field instead of re-deriving the answer. discount-fields is that written-down contract for discounts.