CASE STUDY · CLIENT NAME REMOVED
A walkthrough of a web app
7 defects found, 6 fixed and proven
While filming this app, Vidabug met 7 defects. The most serious: A job card's part could not be linked to a stock item: the 'Part (stock item)' field was a plain text box. Each is below: what went wrong, why, and how to avoid it in your own software.
What went wrong, and how to avoid it
- A job card's part could not be linked to a stock item: the 'Part (stock item)' field was a plain text box Why: The pack field type PRODUCT had no editor in src/features/industryCrm/ui/fields.tsx (FieldInput's switch fell through to the default text input), while the server expects a product id (GoodsStockService reads domain_inventory_product by that id).Avoid it: How it was fixed: src/features/industryCrm/ui/fields.tsx: a ProductPicker over the existing products lookup (/industry-crm/products/lookup) for PRODUCT fields, storing the product id and showing its. Add a test for the failing action and the edge case behind it, so a regression is caught before users meet it.
- Job margin counted VAT as profit and ignored the cost of the parts Why: server/kernel/industryCrm/WorkMoneyService.js _summary() took the VAT-inclusive invoice totals as revenue and subtracted only the cost of logged time; the goods cost stamped on the invoice lines (unit_cost_cents) was never read.Avoid it: How it was fixed: server/kernel/industryCrm/WorkMoneyService.js: invoices carry their net (subtotal) and the cost of the goods they sold; margin = revenue before VAT - time cost - goods cost. src/fe. Check the inputs and states this screen accepts, and cover the unhappy path in tests, not only the happy one.
- Stock journals were labelled 'Manual' and could be reversed by hand, splitting the stock ledger from the books Why: The stock ledger posts as source MANUAL with origin STOCK_*, but server/kernel/accounting/ac01/ownedJournals.js did not list the STOCK_ origins among journals a module owns, and the journals screen labelled and offered reversal by source_type alone.Avoid it: How it was fixed: server/kernel/accounting/ac01/ownedJournals.js: STOCK_OPENING, STOCK_RECEIPT, STOCK_TRANSFER, STOCK_ADJUSTMENT, STOCK_SCRAP, STOCK_COUNT and STOCK_COST_TRUEUP are owned by Stock (4. Check the inputs and states this screen accepts, and cover the unhappy path in tests, not only the happy one.
- Parts used from the service van are taken out of stock at the default warehouse when the job is invoiced Why: Invoice lines support a 'leaves stock from' place (receivable_invoice_line.stock_location_id, used by ReceivablesInvoiceService._stampCostAndIssueStock), but nothing in the web app sets it, and QuoteService.convert does not carry a place from the job card, so every issue falls back to the default plAvoid it: How it was fixed: Not repaired in this production: it needs a product decision (where the job's place is kept: on the job card, on each quotation line, or chosen when the invoice is issued) and a fi. Check the inputs and states this screen accepts, and cover the unhappy path in tests, not only the happy one.