Automation · built by Consigliere · November 21, 2026
Morning clear-to-build run
A step-by-step morning shortage run: open orders meet bills, stock and inbound parts, showing what can build today, what runs late, and what to expedite.
His notes on this demo
# Morning clear-to-build run (portfolio demo) **Goal (one sentence):** step through the run a planning agent would do before the morning shortage meeting: take open orders, their bills of material, stock on hand and inbound purchase orders, hand scarce parts to orders in due-date order, and say which orders can be built now, which will be late and by how much, and which parts to expedite first. ## What it shows An automation, shown one step at a time. Press **Step** to move through the run, or **Run all steps** to see it at once: 1. **Read and check the inputs.** Four comma-separated tables plus today's date. A bad row stops the run with a message naming the table and line (a problem with a whole bill, such as a component that has its own bill, names the item instead). A past-dated inbound line or a part with no stock row gives a warning, and the run continues. 2. **Explode the bills.** Total need per part against on hand plus inbound, with no timing yet. 3. **Hand out parts.** Orders are served earliest due date first, ties broken by order number. Each order is marked *build today*, *on time*, *late* (with days late and the part that holds it up), or *short* (with how many units are missing). 4. **Rank the parts holding orders up.** For each order a part holds up, it shows how many more units must arrive, and by what date, for that part to stop holding the order up. 5. **Draft the shortage-meeting note.** Plain text that pastes into an invite or a chat, with a copy button. Every table is editable, so a visitor can paste their own orders, bills, stock and inbound lines. An optional `value` column on orders switches the ranking to value held up. ## How to open it Open `index.html` in any modern browser by double-clicking it. There is no build step, no install and no network call: the page loads `model.js` and `sample-data.js` from the same folder. ## Rules the run follows - **Priority:** due date ascending, then order id. - **All-or-nothing kits:** if the supply on file can never cover an order, the order claims nothing. Its parts stay free for the orders behind it, so a later order can show as buildable while an earlier one is short (in the sample, SO-5111 is late but covered while SO-5110 is short). - **Claims are held:** an order claims its kit from the first day the whole kit is available. A claimed part is never lent to a later order and paid back. - **Past-dated inbound** counts as arriving today, with a warning. - **Pull-in quantity** for part P on order O = what earlier orders claimed of P + what O needs of P − the supply of P that lands by O's due date (or by today, if O is already past due). It assumes every earlier order keeps what it claimed. - **Ranking:** value held up (only if a value column is present), then orders held up, then finished units held up, then part id. An order held up by two or more parts counts under each, and is listed as held by another part too. ## Tests `test.mjs` is kept with the project source. It is not in the download, which holds the four files the page needs. Run it with `node test.mjs` (Node 18 or later, no packages). It has 12 groups of known answers worked out by hand: date parsing, 16 input-error cases, the warnings, a four-order plant that covers all four statuses and the skip rule, the all-or-nothing kit, tie-breaking and past-due orders, fractional quantities, ranking with and without a value column, part and order names that clash with built-in object keys (such as `constructor`), every one of the 12 sample orders, and the meeting note's text. Writing the tests caught two wrong hand answers of mine, not model bugs. A priority fixture I had called *late* is in fact *short* (14 units needed against 12 known). And MCU-7 holds up 220 finished units, not the 210 I first wrote. Both pins were corrected after checking by hand. Recorded runs, 2026-11-21: - Green: `node test.mjs` → `12 test groups passed`, exit 0. - Deliberate break 1, in a copy outside the project: allocation forgets what earlier orders claimed (`var before = 0`). Result: `FAIL allocate: hand-worked tiny plant ...`, with `'clear-now'` where `'late'` was expected, `3 test groups passed before the failure`, exit 1. - Deliberate break 2, in a copy outside the project: short orders claim their parts anyway. Result: the same group fails with `'short' !== 'on-time'` (the order that should jump the short one is now blocked), exit 1. A separate review pass found three real faults, all fixed before release: a part named `constructor` or `toString` crashed the run (the model now uses plain lookup tables, and the built-in-names group fails on the old code), the page had no guard if the run threw, and pull-in lines on the page could carry markup from a pasted order id. The page was then checked in a real browser: every step, the error path, Reset to sample, and an order id carrying markup, which shows as plain text. The console showed no errors. ## What it is not - Not MRP. It does not plan new purchase or production orders, net safety stock, use lead times or offset anything. It only allocates the supply already on file. - Single-level bills only. A component that has its own bill is refused rather than exploded. - No capacity, labor or routing check. "Build today" means every part is here, not that the line is free. - Priority is due date only. It has no customer priority or partial shipments, and an order is never split. - Simple CSV only: no quoted fields and no commas inside a value. - The sample is invented and has no prices. Nothing in it describes a real plant. ## What I'm unsure of - **The skip rule.** Letting an order that can never be covered claim nothing is one defensible policy. Many planners would rather reserve what exists for the higher-priority order and wait for a new buy. Which policy fits depends on the plant, and this demo has only one. - **Pull-in quantities don't add up across orders.** Each assumes the orders ahead keep their claims and nothing else changes. Expediting for one order changes the numbers for the orders behind it, so the list is a starting point for the meeting, not a buy plan. - **The ranking.** Orders held up, then units, is a simple stand-in. With real values, most planners would weigh margin or customer, which the optional value column only partly covers.
Page updated Build 961 · 29 Nov 2026 · fa5b278