Transfer Order Automation — Daily Overflow → Sydney Replenishment
Sydney takes customer orders it cannot fill from its own stock, while the spare stock sits in the Overflow warehouse. Once a day at close of business this automation reads what Sydney is short, finds that stock in the Overflow bins, and raises the Transfer Orders that move it — so a planner no longer reconciles spreadsheets by hand.
System: Transfer Order Automation (Asana "[Bonded WH/Overflow] TO Automation", BE-3412)
Source repository (read-only):
lifeinteriors/transfer-order-automation-s10Source of truth for intent: the Asana task — Definitions, rules BR-01…BR-13, Examples 1–4
Per the access policy, the logic is recorded here, not changed in the
source repository, and no source code is stored here — only described and linked. See
CONVENTIONS.md for how entries are structured.
Readings (per CONVENTIONS.md §8): this entry is served as three tabs — Business logic (readable with zero system access), Developer (inputs, processing, edge cases, defects) and Diagram. Everything above the switcher shows in all three.
⚠️ Status:
active— the logic below is deployed and has run nightly since 2026-08-17. The allocation engine, the amend path and the shortfall alert were merged as0ca95c7and auto-deploy to the production Lambda alias. Re-verified 2026-10-08 by re-reading the merged code. Deployed is not the same as correct: the defects in the developer reading were found in this same code, two of them changing what actually happens, andlast_reviewedstays at 2026-08-17 because no production run has been observed — only the code that runs.
Rules & IDs
Six rules, each with a stable anchor in the business reading, so links survive heading edits (CONVENTIONS.md §5).
| Rule ID | Rule | Reading |
|---|---|---|
LI-BL-INV-001 |
What gets replenished, and how much | Business logic |
LI-BL-INV-002 |
Whole bins, closest fit | Business logic |
LI-BL-INV-003 |
Overflow before Bonded | Business logic |
LI-BL-INV-004 |
Move what there is, flag the rest | Business logic |
LI-BL-FUL-004 |
Add to an open order before raising a new one | Business logic |
LI-BL-FRT-002 |
One shipment, one truckload | Business logic |
Rule IDs are domain-coded, so
FUL(fulfilment) andFRT(freight) IDs appear here even though the file's primarydomainis inventory (CONVENTIONS.md §4).
| What | Name in the system | |
|---|---|---|
| Lambda repositoryGitHub repository | lifeinteriors/transfer-order-automation-s10 @ 0ca95c7 — transfer-order-automation-s10 | open at 0ca95c7 |
| Saved searchNetSuite saved search | customsearch7895 — SCRIPT | TO AUTOMATION | 1/3 | Sydney Backorder Demand | open search 7895 |
| Saved searchNetSuite saved search | customsearch7898 — SCRIPT | TO AUTOMATION | 2/3 | Overflow Bin Availability | open search 7898 |
| Saved searchNetSuite saved search | customsearch7900 — SCRIPT | TO AUTOMATION | 3/3 | Active Transfer Order | open search 7900 |
The NetSuite links use the account-neutral host, which redirects a signed-in user to this account. Ids and names are exact, so a search stays findable by name even if a link does not resolve.
Three readings of the same rules. Nothing is duplicated between them. Printing gives you the business reading followed by the diagrams.
Written for the business — no field IDs, no script names, no system jargon.
What it does. Every evening the system looks at what Sydney is short, finds that stock in the Overflow warehouse, and raises the paperwork to truck it over — flagging anything it can't cover.
Why it exists. Sydney can't fulfil orders it doesn't have stock for, and the stock is often already in the business, just in the wrong warehouse. Done by hand it means a planner reconciling reports daily; it gets skipped, and customers wait for stock the company already owns.
Why Overflow rather than waiting for the supplier. Overflow is where spare stock is parked, and the business treats it as in stock — it reaches Sydney and goes out to a customer within a few days. A purchase order arriving into Sydney is usually far slower, so an item already on order from a supplier is not a reason to skip the transfer; the stock in Overflow will almost always get there first. What should not be repeated is a movement already in flight from Overflow — that is the only kind of "it's already coming" that counts. (Business context from the project owner.)
When it runs. Once daily, at close of business, automatically. Nobody triggers it.
Who it affects. The inventory planner (who receives the shortfall alerts), the Overflow and Sydney warehouse teams (who pick and receive against the Transfer Orders), and — indirectly — every customer waiting on a backordered item.
How it decides.
- What Sydney is short of today, item by item — that number is the demand, and nothing else.
- Where that stock sits. Overflow is drained first; the bonded warehouse in Vietnam covers only what Overflow cannot, because it is six weeks away rather than one.
- Which bins to take it from — whole bins, closest fit. Sydney usually receives more than it was short, and that surplus is intended.
- What it cannot cover at all. That difference is emailed to the planner rather than quietly dropped.
- Where the movement goes: onto an open Transfer Order that is still amendable if one exists, otherwise onto a new one.
- How much fits. One Transfer Order is one truckload, so a load past the cap splits.
Outcomes. A Transfer Order is raised · an existing open order is added to · a shortfall is emailed to the planner · nothing happens, because the stock is already on its way.
What gets replenished, and how much LI-BL-INV-001
Every item Sydney is short of is a candidate, with no exclusions. The quantity to move is what is still outstanding after anything already on its way is taken into account.
| # | If… | Then… | Because |
|---|---|---|---|
| 1 | Sydney is short of an item | It is a candidate to move from Overflow | That is the whole purpose |
| 2 | The shortage is zero or less | Nothing happens for that item | There is nothing to send |
| 3 | The stock is already on an open Transfer Order | It is not moved again | Otherwise the same stock is ordered every night |
Whole bins, closest fit LI-BL-INV-002
The system works in quantities, never in bin locations. It picks the tightest-fitting bin and moves all of it.
| # | If… | Then… | Because |
|---|---|---|---|
| 1 | One bin holds enough to cover the shortage | The smallest bin that still covers it is chosen | Leaves the big bulk bins intact for larger jobs later |
| 2 | A bin is chosen | The whole bin moves, not just the shortfall | Emptying a bin is cleaner for the warehouse, and the extra stock in Sydney is accepted on purpose |
| 3 | No single bin covers the shortage | Whole bins are combined, biggest first, until covered | Fewest bins disturbed |
| 4 | Any bin is chosen | The bin is never named on the Transfer Order | The warehouse picks the physical bin when it picks the stock |
Overflow before Bonded LI-BL-INV-003
Two warehouses can supply Sydney, and they are days versus weeks apart. They are drained in a fixed order and never travel together.
| # | If… | Then… | Because |
|---|---|---|---|
| 1 | The item is in Overflow | Overflow is used first | It is a local truck movement, about a week |
| 2 | Overflow can't cover it all and Bonded can | Bonded covers only the remainder | Bonded is Vietnam — roughly six weeks |
| 3 | Both warehouses supply the same order | Each raises its own Transfer Order | One shipment cannot come from two warehouses |
Move what there is, flag the rest LI-BL-INV-004
The automation never waits for perfect coverage and never silently skips an item.
| # | If… | Then… | Because |
|---|---|---|---|
| 1 | The warehouses together can't cover the shortage | Everything available is moved anyway | Partial is better than nothing |
| 2 | Anything is left uncovered | The planner is emailed the gap | A human has to source it another way |
| 3 | The run is otherwise clean | The shortfall email is still sent | It is an operational alert, not an error report |
Add to an open order before raising a new one LI-BL-FUL-004
Fewer, fuller shipments. Existing orders are added to wherever they have room, and nothing already booked is ever taken back.
| # | If… | Then… | Because |
|---|---|---|---|
| 1 | An open order already carries this item and has room | The quantity is added to that line | Keeps an item on one shipment instead of scattering it |
| 2 | An open order has room | It is added to the tightest-fitting one | Fewer shipments, fewer trucks |
| 3 | It would take three or more open orders to fit | A new order is raised instead | Splitting a line across three shipments helps nobody |
| 4 | Demand later drops, because an order was cancelled | The Transfer Order is left alone | Stock is never clawed back mid-flight |
| 5 | The team has already handled an order | It is locked — nothing is added | A shipment being picked must not change underneath the warehouse |
One shipment, one truckload LI-BL-FRT-002
A Transfer Order is one shipment, and one shipment is one truck.
| # | If… | Then… | Because |
|---|---|---|---|
| 1 | Everything fits one truckload | One Transfer Order | A shipment is a truck |
| 2 | A single item's volume exceeds a truckload | It is split across the fewest new orders that will hold it | It physically will not fit |
| 3 | Adding to an open order would overfill it | The addition is refused | A truck that cannot be loaded is worse than a second truck |
What people get wrong
- "The system tells the warehouse which bin to pick from." It does not. The bin is never written onto the Transfer Order — only how many. The warehouse picks the physical bin at fulfilment.
- "Sydney gets exactly what it was short." It usually gets more. Whole bins move, so if Sydney is short 2 and the bin holds 4, all 4 travel. That surplus is intentional, not an error.
- "A shortfall email means the run failed." It didn't. The stock that was available has been moved; the email is only about the remainder.
- "If it's on a Transfer Order, it's on its way." An order sits awaiting approval until someone approves it. Until then it is a plan, not a movement.
- "There's a purchase order coming, so we don't need the transfer." Usually the opposite. A supplier order into Sydney is typically weeks or months out, while Overflow stock is days away. The transfer should still happen; the purchase order is not cover.
- "Bonded stock arrives with the rest." Bonded is Vietnam — six weeks, not one. An order split across both warehouses arrives as two very different shipments.
Manual steps
| Step | Who | When | What happens if skipped |
|---|---|---|---|
| Act on the shortfall email | Inventory Planner | Whenever a run can't fully cover an item | The gap persists silently; the customer keeps waiting and nothing escalates |
| Clear the approval marker once the order is handled | Fulfilment team | After dealing with a Transfer Order | The automation keeps treating it as open and may keep adding lines to it |
| Deploy the NetSuite-side scripts | Backend | Whenever the write script changes | The automation calls an old script; new fields and guards silently don't apply |
Field registry
Every field this automation reads or writes, by the name it carries in the system — what it means, and what changes when it changes. Field ids are in the developer reading.
Inputs — what it reads
Values the automation looks at to make its decision. Change one of these and the decision changes.
| Field | What it means | What it changes | Status |
|---|---|---|---|
| Qty demand from sales order | How many units Sydney is short across its open sales orders. | This is the quantity moved. Nothing else sets it. | needs confirming |
| Item internal ID | Which product the shortage is for. | Identifies which product is short. If it does not resolve, the item is reported as a total shortfall (defect D1). | needs confirming |
| Qty available from Bin | How much is sitting in one Overflow bin, counted in boxes — a bin of 24 chairs sold in boxes of two reads 12. Verified 2026-10-08. | Raw on-hand in one Overflow bin, and the whole of what the engine treats as available. Counted in boxes while demand is counted in pieces (TO-D10). | confirmed |
| Qty allocated from sales order | Sydney's own demand for the item — committed to customers plus backordered there, counted in boxes. Verified against the location records for 17 items on 2026-10-08. It is NOT stock on open Transfer Orders, which is what the automation uses it as (TO-D2). | Subtracted from Overflow bin stock to decide what is free to move, so a Sydney demand figure is taken off an Overflow supply figure. Today the subtraction never happens because the code reads a different field name and a missing value defaults to zero; correcting that name alone would strand 8 of 17 items (TO-D2). | confirmed |
| CBM from Item record | The volume of one unit of the item. | Volume of one unit. Multiplied by quantity to test the 15 CBM truck cap. | needs confirming |
| Bin location | Which warehouse and bin the stock is sitting in. | Decides which warehouse supplies the line, and therefore the lead time — 7 days from Overflow, 42 from Bonded. | needs confirming |
| Transfer Order Approval | Whether the team has dealt with this transfer order yet. | Only orders still awaiting approval can be added to. Anything else is locked. | needs confirming |
| Total CBMTransfer Order | Total volume of everything on the order. | Recalculated when lines are added, and the addition is refused if it would exceed one truckload. | confirmed |
Outputs — what it writes
Values the automation puts back. Everything downstream of this rule reads them, so a wrong value here travels.
| Field | What it means | What it changes | Status |
|---|---|---|---|
| LocationTransfer Order | The warehouse the stock is taken from. | Overflow or Bonded. Never mixed on one order, and it sets the lead time. | confirmed |
| To LocationTransfer Order | The warehouse the stock is sent to. | Always Sydney. Not checked when picking an order to add to, which is defect D3. | confirmed |
| Transfer Order ApprovalTransfer Order | Whether the team has dealt with this transfer order yet. | While it reads Pending Approval the automation may still add lines. Once the team changes it, the order is locked and further additions are refused. | confirmed |
| Override Lead Time (Days)Transfer Order | How long the stock is expected to take to arrive. | Sets the expected due date — 7 days from Overflow, 42 from Bonded. | confirmed |
| DateTransfer Order | The date the transfer order is raised. | Must be sent US-format or the order fails to save. | confirmed |
| Total CBMTransfer Order | Total volume of everything on the order. | Recalculated when lines are added, and the addition is refused if it would exceed one truckload. | confirmed |
| Commitment ConfirmedTransfer Order (line) | Locks the stock to this order so it is not reallocated elsewhere. | Set on every line so the allocation engine does not release the stock. | confirmed |
Deployment state — what is actually running
All three steps are merged and live. BE-3412-APPLY-BUSINESS-LOGIC was merged as 0ca95c7 on
2026-08-17, which is still main HEAD, and merging to main auto-deploys to the production
Lambda alias — so the automation has been running daily since that date. Re-verified 2026-10-08.
| Step | State on main @ 0ca95c7 |
Live? |
|---|---|---|
| 1 · Read the three saved searches | Implemented | ✅ |
| 2 · Decide what to move | The full allocation engine — closest-fit whole bins, source lanes, shortfalls, placement | ✅ |
| 3 · Write the Transfer Orders | Real write seam; the orchestrator calls it with nothing commented out | ✅ |
Two things this corrects, both re-checked in the source:
- The production config is complete.
config/production.mjscarries real RESTlet ids for the Create-TO, dropdown and search-extractor scripts, alongside the three production saved-search ids. The placeholders this entry previously recorded are gone. - The NetSuite-side scripts are still deployed by hand and their state is not tracked in the
repo, so a field the write script expects can be missing against an older deployment (see
TO-D5). That one stands.
Being deployed is not the same as being correct. The defects below were found by reading this same deployed code, and
last_reviewedstays at 2026-08-17 because no production run has been observed — only the code that runs.
Inputs
What it reads, and where from.
Three NetSuite saved searches, fetched sequentially — they are too large to route through the internal request queue, so parallel fetching risks request-limit errors.
| Field / source | System | Type | Notes |
|---|---|---|---|
QtyDemand |
Saved search #1 7895 — Sydney backorder demand |
string | Taken as the true remaining demand |
item_id |
Saved search #1 | select | Item internal id. The committed capture spells this item_ID — see TO-D1 |
itemName |
Saved search #1 | string | Used only in the shortfall alert |
binAvailableQty |
Saved search #2 7898 — Overflow bin availability |
string | Raw per-bin on-hand, not net |
itemallocated |
Saved search #2 | string | Item-level total already on open TOs. Same value on every row for the item — read once, never summed. See TO-D2 |
itemCBM |
Saved search #2 | string | Per-unit volume; drives the cap check |
binLocation |
Saved search #2 | select | Source lane — 23 Overflow or 25 Bonded |
to_id, fromLocation, totalCBM |
Saved search #3 7900 — active transfer orders |
select / string | Amend candidates and their remaining room |
approvalStatus |
Saved search #3 | select | Read as text to test for "Pending Approval" |
Search 7898 could not be fetched live — the integration role lacks Bin record access. Its
committed capture was generated from an admin CSV export as a best-effort stand-in.
Processing — demand & sourcing
What it does with that, step by step.
Traces LI-BL-INV-001 and LI-BL-INV-002.
on daily schedule:
read search 1 (demand), search 2 (bins), search 3 (open TOs)
for each item in search 1:
net demand = QtyDemand as returned (no subtraction applied)
if net demand <= 0 -> skip the item
available(source) = sum of that source's bins - allocation charged to it
allocation is consumed Overflow-first, spilling into Bonded if it exceeds the Overflow pool
to source N units at one source:
if any single bin holds >= N -> take the SMALLEST such bin, whole
else repeat until covered or dry:
if a remaining bin covers the rest -> take the smallest such bin, whole
else -> take the largest remaining bin, whole
cap the total taken at available(source)
The original rule (BR-02) computed net = gross − coverage, coverage being the quantity on open
Transfer Orders. The code no longer does this — as of commit d68b33f ("NSSS is authoritative:
remove code-side TO netting"), search #1's QtyDemand is used directly. Open TOs are read only to
find amendable ones. Protection against re-ordering the same stock now rests entirely on the
itemallocated supply guard — see TO-D2.
Selection is by quantity only. Bin identity, receipt date and FIFO play no part, because the bin is never recorded on the Transfer Order (BR-13 supersedes the FIFO reading of BR-10). Verified against a real Transfer Order record, whose inventory-detail flag was not set.
The availability cap is applied after the whole-bin pick, so when availability is tighter than the bin, a partial bin moves. A deliberate safety guard, but a deviation from BR-04's literal "move the entire bin".
Processing — source lanes & lead time
What it does with that, step by step.
Traces LI-BL-INV-003.
| Source | Location id | Order tried | Lead time applied | Meaning |
|---|---|---|---|---|
| Overflow | 23 |
first | 7 days | Local truck movement |
| Bonded WH Vietnam | 25 |
second, remainder only | 42 days | 7 (to departure) + 28 (transit) + 7 (buffer) |
| Destination — Sydney | 11 |
— | — | Every TO's destination |
for each source, Overflow before Bonded:
if nothing left to cover -> stop
source as much as that lane's availability allows
emit a line tagged with that source
carry any remainder to the next lane
The lead time is written as the TO's lead-time override, which drives its expected due date.
Open: the 15 CBM cap is a local truck limit. A Bonded movement is a sea container and its real cap is unconfirmed — 15 is assumed for now, which would wrongly chop a Bonded shipment into 15 CBM pieces. Only bites once a Bonded-sourced item is backordered.
Processing — placement & the CBM cap
What it does with that, step by step.
Traces LI-BL-FUL-004 and LI-BL-FRT-002. Cap = 15 CBM, the Metro Transfer truck capacity.
It is a planning threshold only — no ship method is written to the Transfer Order.
for each line (already tagged with its source):
if line volume > cap:
units per TO = floor(cap / item CBM)
open a fresh TO per chunk until the quantity is exhausted
force the next same-source line onto a new TO
else:
eligible = open TOs that are Pending Approval, share this source, and have room
1. eligible TO already carrying this item -> add the quantity there
2. else one eligible TO with room -> add to the tightest fit
3. else two eligible TOs with room -> split across those two
4. else -> start a new TO
Amendability keys off the custom Transfer Order Approval marker, not the main order status. The
automation sets it to Pending Approval on every TO it creates; the team clears it once the order
is handled, which locks it. The write script refuses to amend a locked TO, returning TO_LOCKED.
Not implemented: BR-09 re-solve — replacing a previous selection for an item and releasing it back to the pool. The write path only appends and increments. "Never reduce" (BR-07) therefore holds; "re-solve replaces" does not.
The sums — every quantity the engine computes
The rules say what is decided; these are the arithmetic behind each, in the order it runs. The figures are the same six items as the worked examples below, so the two read together.
1 · Room left on an open order — LI-BL-FUL-004, LI-BL-FRT-002
room = 15 CBM - volume already on that order
An order carrying 14.75 has 0.25 left and will take almost nothing; one carrying 0.01 has 14.99 and will take almost anything.
2 · What is free at a source — LI-BL-INV-002
free = sum of that source's bins - quantity already committed from that source
If free is zero or less, that source is skipped entirely and the next lane is tried.
Today the second term is always zero: the field carrying it is absent from the capture and a missing value defaults to nothing (
TO-D2). Free therefore equals the full bin total on every run.
3 · How much to source — LI-BL-INV-001
target = the smaller of (what is still outstanding, what is free)
4 · Which bins, and how many units move — LI-BL-INV-002
When one bin covers the target, the smallest such bin is taken whole:
Alaska Bar Stool - outstanding 2, one bin of 4
4 >= 2 -> take that bin whole -> moves 4, surplus 4 - 2 = 2
When no bin covers it, whole bins are combined until they do, or until the bins run out:
Palermo Dining Chair - outstanding 7, one bin of 4
no bin >= 7 -> take what there is -> moves 4
The total is then capped:
units moved = the smaller of (whole bins picked, free)
5 · What is left uncovered — LI-BL-INV-004
shortfall = outstanding - units moved
Palermo: 7 - 4 = 3 -> one shortfall alert
6 · Volume of a line — LI-BL-FRT-002
line volume = units moved x volume per unit
Across the six lines of the worked example that totals 8.83089 CBM — under the cap, so one order.
7 · Splitting a line too big for one truck — LI-BL-FRT-002
units per order = 15 CBM / volume per unit, rounded down
An item of 0.5 CBM moving 90 units is 45 CBM: 15 / 0.5 = 30 units per order, 90 / 30 = three orders.
Rounded down, then raised to a minimum of one — so a single unit larger than 15 CBM still produces one over-cap order (
TO-D4).
8 · Filling a new order — LI-BL-FRT-002
a line joins the order being filled while running total + line volume <= 15 CBM
9 · Splitting a line across two open orders — LI-BL-FUL-004
allowed when room(first) + room(second) >= line volume
units on first = room(first) / volume per unit, rounded down
units on second = the remainder
Never three or more.
10 · Expected date — LI-BL-INV-003
expected date = run date + lane lead time (Overflow 7 days, Bonded 42 days)
Decision tree — one backordered item, from a shortage to a Transfer Order
The same logic as a path through the decisions, in the order they run.
These branches run in production. The engine was merged as
0ca95c7and deploys to the production alias, re-verified 2026-10-08 (TO-D9, resolved). The tree follows the deployed code, so where a defect changes what actually happens the branch says so and names it —TO-D2in particular, whose guard reads as zero on every run.
Four stages, in the order they run: how much · from where · which bins · which Transfer Order.
Every branch names the rule it implements, and where an open defect changes what actually happens
the branch says so and names it — the tree follows the code, not the spec, and TO-D7 records that
the two have drifted apart.
Stage 1 — how much does Sydney need? LI-BL-INV-001
each item in the Sydney backorder search
├─ net demand = QtyDemand, EXACTLY AS RETURNED
│ ⚠ TO-D1: the engine reads the item id as `item_id`; the committed capture
│ spells it `item_ID`. Every item then resolves to undefined, finds no bins
│ and is reported as a total shortfall — with no error anywhere. A run that
│ hits this is indistinguishable from "Overflow is empty"
│
│ the spec said net = gross − what is already on open Transfer Orders.
│ The code stopped doing that at `d68b33f` — the saved search is treated as
│ authoritative. Open TOs are now read ONLY to find amendable ones TO-D7
│
├─ net demand ≤ 0 ? ──► skip the item entirely
└─ net demand > 0 ──► go to stage 2
Nothing else prevents the same stock being transferred every night. With the netting gone, the only guard left is the
itemallocatedsupply figure — and it is absent from the committed capture of the bin search, so it has never been seen working.TO-D2
Stage 2 — which warehouse supplies it? LI-BL-INV-003
Two lanes, always in this order, and never on the same Transfer Order: one order carries one source and one lead time, and 7 days against 42 is not a detail.
├─ 1. OVERFLOW (location 23) ──► drain first · lead time 7 days
│ available = its bins − the allocation charged to it
│ allocation is consumed Overflow-first, spilling into Bonded
│ only once the Overflow pool is exhausted
│
├─ 2. BONDED WH VIETNAM (location 25) ──► the remainder only · lead time 42 days
│ 7 to departure + 28 in transit + 7 buffer
│
├─ nothing left to cover ? ──► stop; later lanes are not tried
└─ still short after both ? ──► move everything available anyway,
and email the planner the gap LI-BL-INV-004
Destination is always Sydney (location 11). The lead time is written as the Transfer Order's lead-time override, which is what drives its expected due date.
Stage 3 — which bins, and how many units? LI-BL-INV-002
Quantities only. The bin is never written onto the Transfer Order — the warehouse picks the
physical bin at fulfilment — so bin identity, receipt date and FIFO play no part in the choice.
This was verified against a real Transfer Order record, whose inventory-detail flag was not set;
TO-D8 records that main's README still says the opposite, so the README is the thing that is
wrong here.
to source N units at one lane
├─ any single bin holds ≥ N ?
│ └─ take the SMALLEST such bin, WHOLE LI-BL-INV-002
│ leaves the bulk bins intact for larger jobs later
└─ no single bin covers it — repeat until covered or dry:
├─ a remaining bin covers the rest ? ──► take the smallest such bin, whole
└─ otherwise ──► take the largest remaining bin, whole
then cap the total taken at that lane's availability
⚠ the cap is applied AFTER the whole-bin pick, so when availability is tighter
than the bin a PARTIAL bin moves. A deliberate safety guard, and a deviation
from the rule's literal "move the entire bin"
Sydney receives more than it was short, on purpose. Short 2 against a bin of 4 moves all 4. That surplus is intended and is not an error.
Stage 4 — which Transfer Order does the line go on? LI-BL-FUL-004, LI-BL-FRT-002
Cap = 15 CBM, one Metro Transfer truckload. It is a planning threshold only — no ship method is written. The over-cap split is tested first, because a line that cannot fit a truck can never be added to one.
each line, already tagged with its source
├─ line volume > 15 CBM ?
│ └─ units per TO = floor(15 / item CBM)
│ open a fresh TO per chunk until the quantity is exhausted, and
│ force the next same-source line onto a new TO
│ ⚠ TO-D4: a SINGLE unit bigger than 15 CBM makes that floor 0, and the
│ line is emitted on a Transfer Order over the cap, silently
│
└─ otherwise, look for an open Transfer Order to amend
eligible = Pending Approval · same source · has room
⚠ TO-D3: eligibility never checks the DESTINATION, so a TO heading
somewhere other than Sydney can be selected
⚠ TO-D5: "amendable" is decided in two places that do not agree
⚠ TO-D6: the engine auto-approves what it creates, which conflicts with
the amendability model it then relies on
├─ 1. an eligible TO already carries this item ──► add to THAT line
├─ 2. else one eligible TO with room ──► add to the tightest fit
├─ 3. else two eligible TOs with room ──► split across those two
└─ 4. else (or it would take three or more) ──► raise a NEW Transfer Order
Nothing is ever taken back. Demand dropping after a Transfer Order exists leaves its lines untouched, and re-solve — replacing an earlier selection and releasing it to the pool — is not implemented: the write path only appends and increments.
TO-D7A handled order is locked. Amendability keys off the custom Transfer Order Approval marker, not the order status. The automation sets it to Pending Approval on everything it creates; the team clears it once the order is handled, and the write script then refuses to amend it, returning
TO_LOCKED. An amend that would breach the cap returnsCBM_CAP_EXCEEDEDand writes nothing — that line falls to a new Transfer Order on the next run.
What a run leaves behind
| Outcome | Where it lands |
|---|---|
| A new Transfer Order | Source 23 or 25 — never mixed · destination 11 · lines of item and quantity only · lead-time override · approval marker · run date in US MM/DD/YYYY, because ISO dates fail the save |
| Lines added to an open Transfer Order | Same RESTlet, routed by TO id |
| A shortfall | SES email to the inventory planner — sent on a clean run too, because it is an operational alert, not an error report |
| Nothing | The stock is already on an open Transfer Order, or demand was zero |
A Transfer Order is a plan, not a movement. It sits awaiting approval until a person approves it. And CBM is deliberately not written on create — NetSuite derives both line and header CBM from the item record. The engine computes it only to size shipments against the cap.
Outputs & side effects
What it writes, and who reads it afterwards.
| Output | Written to | Downstream consumer |
|---|---|---|
| New Transfer Order (source, destination, lines, lead time) | NetSuite, via the create/amend RESTlet | Overflow pickers, Sydney receiving |
| Added / incremented lines on an existing TO | NetSuite, same RESTlet, routed by TO id | As above |
| Approval marker set to Pending Approval | NetSuite TO header | Fulfilment team's queue |
| Shortfall list (item, needed, moved, short) | SES email | Inventory Planner |
| Technical error summary | SES email | Devs |
Created TO headers carry: source location 23 or 25 (never mixed on one TO), destination 11,
order status A — NetSuite forces this on create regardless — the approval marker, the lead-time
override, and the run date in US MM/DD/YYYY format, since ISO dates fail the save. Lines carry
item and quantity only — no bin, no cartons, no units. CBM is deliberately not written on
create: NetSuite derives both line and header CBM from the item record. The engine still computes
CBM internally, purely to size shipments against the cap.
Worked examples
Real records carried end to end, so the logic can be checked against something that happened.
Traced against the reference captures committed in the repo, with the allocation engine from
47c0845 run over them read-only. Six backordered items, all sourced from Overflow, no open Sydney
TO to amend.
| Item | Short | Bin holds | Moved | Why |
|---|---|---|---|---|
Alaska Bar Stool 148542 |
2 | 4 | 4 | One bin covers → whole bin; surplus 2 accepted |
Ava Dining Chair 103065 |
3 | 4 | 4 | Whole bin; surplus 1 |
Blake Low Bench 207402 |
1 | 8 | 8 | Whole bin; surplus 7 — the clearest illustration of BR-04 |
Palermo Dining Chair 381793 |
7 | 4 | 4 | No bin covers 7, only one bin exists → move all, short 3 |
Rose 2.5 Seater 400289 |
1 | 1 | 1 | Exact fit |
Sorrento Dining Chair 372081 |
1 | 6 | 6 | Whole bin; surplus 5 |
Result: one Transfer Order — Overflow 23 → Sydney 11, six lines, 8.83089 CBM (well under
the cap, so no split), Pending Approval, 7-day lead time. Plus one shortfall alert: Palermo
needed 7, moved 4, short 3.
Note the shape of it: Sydney was short 15 units in total and receives 27, because five of the six lines move a whole bin. That is the rule working as designed, and it is the single behaviour most likely to surprise the warehouse.
Test cases
What to run to know the behaviour is intact. Expected values, never “should work”.
| Case ID | Layer | Preconditions | Input | Expected output | Rule ref |
|---|---|---|---|---|---|
TO-TC-A1 |
Run mechanics | The Lambda is invoked on its daily schedule. | An EventBridge scheduled event. | All three saved searches are fetched sequentially, and each row count is logged. | needs confirming |
TO-TC-A2 |
Run mechanics | The Lambda is invoked by something other than the schedule. | An HTTP-shaped event. | It is not treated as a scheduled run. | needs confirming |
TO-TC-A4 |
Run mechanics | One of the three searches fails.An empty set is indistinguishable from no stock, so the email is the only signal that the run was working from incomplete data. | A search returning an error rather than rows. | The run continues with an empty set for that search and the error is emailed. | needs confirming |
TO-TC-A3 |
Demand | An item appears in the backorder feed with nothing outstanding. | Demand of zero or less. | The item is skipped — no line and no Transfer Order. | LI-BL-INV-001 |
TO-TC-A5 |
Demand | The backorder feed is read live rather than from a captured sample. | The three live saved searches. | Every row's item id resolves, and no item reports an undefined id. | LI-BL-INV-001TO-D1 |
TO-TC-T5 |
Demand | A kit is ordered for Sydney and one of its components has Overflow stock.A SalesOrder-type search cannot see kit component lines at all; an Item-type search can. Proven 2026-10-08 by running both variants side by side: the Item variant returned every row the SalesOrder variant found, at identical quantities, plus five kit members. | Sales order S310299 — Cloud Double Bed (Oak, Rose Textured Weave). |
The Headboard (2) and the Footboard (1) each appear as their own demand row. The Slats do not, because Sydney holds stock of them. | LI-BL-INV-001 |
TO-TC-T6 |
Demand | Sydney demand is allocated to a purchase order already inbound to Sydney.Subtracting the allocated quantity is what made this demand vanish. Removing that term is what created the coverage gap in TO-D11, so the two cases must be run together. |
Sales order S310293 — Luca Boucle, allocated to an incoming purchase order. |
The demand is still reported. Overflow reaches Sydney in days and beats an inbound purchase order, so an allocation must not suppress it. | LI-BL-INV-001 |
TO-TC-T1 |
Demand | Sydney is short of an item and an open Overflow→Sydney transfer order already carries at least that quantity of it. Live case 2026-10-09: sales order S309870, 4 Santino Leather Dining Arm Chair (Oak, Tan) ordered, 1 committed, 3 short; transfer order 3495 carries 4. |
— | Net demand resolves to 0 and no line is written for the item, on this run and on every later run while that order stays open. Observed before the fix: demand 3, coverage 0, a whole bin of 4 selected. | LI-BL-INV-001 |
TO-TC-T2 |
Demand | The covering transfer order carries the Transfer Order Approval field empty, as 2,975 of 3,022 orders do — including every order at Pending Approval and every one at Pending Receipt. | — | The order still counts toward coverage. The approval field must not decide whether an order is visible to coverage; it decides only whether a line may still be added to it. | LI-BL-INV-001 |
TO-TC-T3 |
Demand | The only order covering an item is older than the lane's lead time — e.g. Santino against order 3495, raised 151 days ago on a 7-day lane, fulfilled out of Overflow and never received. |
— | The order counts in full, and the item stays suppressed for as long as that order is open. Age is deliberately not a factor: the engine cannot tell a slow shipment from a forgotten one, so keeping the open-order list clean is a person's job. Settled 2026-10-09 — see the known limitation and TO-D12. |
LI-BL-INV-001 |
TO-TC-T4 |
Demand | A "Set of 2" item is short — e.g. Luca Boucle Bar Stool, 12 pieces outstanding against 5 cartons available at Overflow. | — | Demand reads 6 cartons, not 12, so it is comparable with bin stock and source availability, which are both in cartons. Shortfall 1 carton, not 7. | LI-BL-INV-001 |
TO-TC-T7 |
Demand | An item is covered by one order at Pending Approval and another at Pending Fulfilment. | Both orders open, Overflow to Sydney, for the same item. | Both count toward coverage. Only Pending Approval makes an order amendable; that is a separate question from whether its stock is already coming. | LI-BL-INV-001 |
TO-TC-T8 |
Demand | The open-order feed is netted against demand for the first time. | Orders 3569 and 3570, Spindle King Bed (Box 1), reported as -2 each. |
Coverage is 4 — the absolute values are used. Taken as reported, coverage is -4 and net demand computes 4 - (-4) = 8, doubling the order rather than suppressing it. |
LI-BL-INV-001TO-D11 |
TO-TC-T12 |
Demand | One item has been ordered in two different units of measure across different sales orders. | Asta Fabric Dining Chair — S301985 in Set (2pcs / Box), S243442 in Single (1pcs / Box). |
Each line is converted by its own line's unit, not by the item's stock unit, and the total reads in cartons. Dividing the item's total by its stock-unit rate gets this item wrong. | LI-BL-INV-001TO-D10 |
TO-TC-T11 |
Demand | Net demand for a multi-piece item does not divide into whole cartons — e.g. 8 pieces ordered with 3 committed on a Set of 2, giving 2.5 cartons. | A part-carton commitment on a Set of 2 or Set of 4 line. | Not yet defined — see TO-Q2. No such line appears in the sandbox, but that sandbox has not been refreshed, so its absence is not evidence the case is rare. Re-check against production before treating it as an edge case. |
LI-BL-INV-001TO-D10 |
TO-TC-T13 |
Placement | An open transfer order out of Overflow has already been fulfilled and is at Pending Receipt, and a new line is added to it. | Order 3463, Overflow to Sydney Showroom, at Pending Receipt; one line added for Santino Fabric Dining Arm Chair, quantity 1. |
The line is accepted. The order moves to Pending Receipt/Partially Fulfilled, which 3/3's filter still returns; the new line commits its stock and is pending fulfilment, so the warehouse picks it; and the header volume and carton count recalculate to include it. Verified in sandbox 2026-10-12 and then reverted by closing the line. | LI-BL-FUL-004 |
TO-TC-B1 |
Bin sourcing | A single bin can cover the shortage and more than one bin could. | Short 2; bins of 4 and 8 available. | The smallest covering bin is chosen — 4 moves, not 8. | LI-BL-INV-002 |
TO-TC-B2 |
Bin sourcing | One bin covers the shortage many times over. | Short 1; a single bin of 8. | The whole bin moves — 8, with the surplus of 7 accepted. | LI-BL-INV-002 |
TO-TC-B3 |
Bin sourcing | No single bin covers the shortage but the bins together do. | Short 7; bins of 4 and 4. | Both bins are combined — 8 moved. | LI-BL-INV-002 |
TO-TC-B4 |
Bin sourcing | The source cannot cover the shortage at all. | Short 7; one bin of 4. | 4 moves and a shortfall of 3 is raised. Partial beats nothing. | LI-BL-INV-002 LI-BL-INV-004 |
TO-TC-B5 |
Bin sourcing | Every unit in the bins is already committed to an open Transfer Order. | The allocation figure equals the full bin quantity. | Nothing moves. | LI-BL-INV-001 |
TO-TC-B6 |
Bin sourcing | The allocation column is missing from the bin search response. | A response with the column absent rather than zero. | The run must fail loudly, not read the missing value as zero — reading it as zero makes the full bin available again on every run. | LI-BL-INV-001TO-D2 |
TO-TC-T9 |
Bin sourcing | The bins hold more than the source location reports as available, because stock has been committed to leave. | Xoriguer Dining Chair — bins summing to 15, source availability 5. | No more than 5 moves. Bin quantities are not net of commitments; the location's availability is, and it is the binding cap. | LI-BL-INV-002 |
TO-TC-T10 |
Bin sourcing | Bin stock exceeds source availability by more than the open-order feed accounts for, meaning stock is committed that the feed cannot see. | Before the feed was widened: Xoriguer, bins minus availability of 10 against coverage of 0. | Not yet defined. Across 19 of 20 items the two figures agreed exactly, and the twentieth was a transfer order the feed's approval filter was hiding — so widening that filter (TO-D11) removed the only observed instance. Whether the cross-check is still worth running, or was only ever a symptom of TO-D11, is open. |
LI-BL-INV-002TO-D12 |
TO-TC-C1 |
Source lanes | The item has stock at Overflow only. | Overflow bins holding the item; nothing at Bonded. | One Transfer Order from location 23, with a 7-day lead time. |
LI-BL-INV-003 |
TO-TC-C2 |
Source lanes | The item has stock at both sources and Overflow covers the shortage. | Overflow and Bonded both holding the item. | Bonded is untouched. | LI-BL-INV-003 |
TO-TC-C3 |
Source lanes | The item has stock at both sources and Overflow covers only part of the shortage. | Overflow short of the demand, Bonded holding the remainder. | Overflow is drained first and the remainder comes from Bonded on a separate order, with a 42-day lead time. | LI-BL-INV-003 |
TO-TC-C4 |
Source lanes | A Bonded-sourced line exceeds the 15 CBM cap. | A Bonded line above 15 CBM. | Currently split at 15. The container cap must be confirmed before Bonded sourcing goes live — 15 is the Metro truck limit, and a Bonded shipment is a sea container. | LI-BL-FRT-002 |
TO-TC-G4 |
Source lanes | A Transfer Order is created and read back. | A created order from each source. | The expected due date equals the transaction date plus that source's lead time — 7 days for Overflow, 42 for Bonded. | LI-BL-INV-003 |
TO-TC-D1 |
Shortfall alerting | The source can cover part of the shortage. | Available stock below the demand. | The available stock is still transferred and the planner is emailed. | LI-BL-INV-004 |
TO-TC-D2 |
Shortfall alerting | A run has shortfalls but no errors. | A clean run with an uncovered item. | The shortfall alert is still sent, independently of the error email. | LI-BL-INV-004 |
TO-TC-D3 |
Shortfall alerting | No shortfall recipients are configured. | An empty recipient list. | No email is sent and the run still logs the shortfalls. | LI-BL-INV-004 |
TO-TC-E1 |
Placement | No eligible open Transfer Order exists. | A line to place with no amendable order available. | A new order is created at Pending Approval, with the approval marker set. | LI-BL-FUL-004 |
TO-TC-E2 |
Placement | An eligible order already carries the item. | A line for an item already on that order. | The existing line is incremented — no duplicate line is added. | LI-BL-FUL-004 |
TO-TC-E3 |
Placement | Two eligible orders exist and the line fits across both. | A line larger than either order's remaining room but smaller than the two together. | It is split across exactly those two orders. | LI-BL-FUL-004 |
TO-TC-E4 |
Placement | The line would need three or more orders. | A line too large for any two eligible orders. | A new order is created instead — a line is never fragmented across three. | LI-BL-FUL-004 |
TO-TC-E5 |
Placement | One run produces both an Overflow line and a Bonded line. | Lines from both sources in the same run. | They go to separate orders — sources are never mixed on one order. | LI-BL-FUL-004 |
TO-TC-E6 |
Placement | An amend is attempted against an order whose approval marker has been cleared. | An order no longer at Pending Approval. | The amend is rejected as TO_LOCKED and nothing is written. |
LI-BL-FUL-004 |
TO-TC-E7 |
Placement | A Pending Approval order exists that is sourced from Overflow but destined somewhere other than Sydney. | An Overflow order to a third location. | It must not be selected as an amend target. Amend eligibility checks the source and the approval marker but never the destination. | LI-BL-FUL-004TO-D3 |
TO-TC-E8 |
Placement | Demand falls after an order already exists for it. | A reduced shortage on a later run. | Existing lines are untouched — a quantity is never reduced. | LI-BL-FUL-004 |
TO-TC-E9 |
Placement | An order has been auto-approved to Pending Fulfilment while its approval marker still reads Pending Approval. | An order this automation created and approved in the same run. | Behaviour to be defined. The two fields disagree about whether the order is amendable, and they are read in two different places. | LI-BL-FUL-004TO-D5 TO-D6 |
TO-TC-F1 |
CBM cap | A run's total volume is below the cap. | Lines totalling under 15 CBM. | A single order, no split. | LI-BL-FRT-002 |
TO-TC-F2 |
CBM cap | One line's own volume is three times the cap. | A line of roughly 45 CBM. | Three new orders, each under 15 CBM. | LI-BL-FRT-002 |
TO-TC-F3 |
CBM cap | An amend would push an order past the cap. | A line that does not fit the order's remaining room. | Rejected as CBM_CAP_EXCEEDED; nothing is written. |
LI-BL-FRT-002 |
TO-TC-F4 |
CBM cap | A single unit of an item is larger than the cap. | One unit above 15 CBM — a sofa or a modular piece. | An exception must be raised. An over-cap order must not be emitted silently, which is what the floored split raised to a minimum of one currently does. | LI-BL-FRT-002TO-D4 |
TO-TC-G1 |
Write mechanics | A create payload is built. | Any line ready to write. | Lines carry item and quantity only — no bin, no cartons, no units. The warehouse assigns bins at fulfilment. | needs confirming |
TO-TC-G2 |
Write mechanics | A created order is read back from NetSuite. | A Transfer Order created in sandbox. | Line and header CBM are derived by NetSuite, and no bin or inventory detail is set. | needs confirming |
TO-TC-G3 |
Write mechanics | A transaction date is supplied in ISO format. | A date as YYYY-MM-DD. |
The save fails — dates must be US MM/DD/YYYY. |
needs confirming |
TO-TC-G5 |
Write mechanics | The RESTlet reports a logical failure inside an HTTP 200 response. | An error object returned with status 200. | It is surfaced as an error, not counted as a success. | needs confirming |
TO-TC-G6 |
Write mechanics | The write script is redeployed after the approval field changed. | A redeploy following a field change. | The approval-marker guard is actually in effect. Amendability is decided in two places that read different fields. | needs confirmingTO-D5 |
Acceptance tests for each rule. The register below carries 49 cases in three groups, and the difference between them matters when reading it: cases whose expected output is a stated value are settled behaviour; cases marked not yet defined are recorded deliberately, so an undecided question is not mistaken for a passing test; and the eight cases naming no rule are run and write mechanics, which no rule in this entry covers.
Each case names the defects it would catch, so a fix can be checked against the case that found it. The scenarios also appear in the UAT table below as a sign-off sheet — the register is the test pack, UAT is the tick list, and neither carries a pass or fail, because that belongs to a run.
⚠️ These cases were written against a NetSuite sandbox that had not been refreshed for some time. That matters in two directions: open transfer orders accumulate there because nothing is ever received, so order ages measured in it describe sandbox decay rather than a production backlog; and its commitments were all made in whole cartons, so it produces no example of a part-carton demand (TO-Q2) and that absence is not evidence the case is rare. Quantities, field names, units and the search definitions are unaffected. Re-run the data-dependent cases against a refreshed sandbox before sign-off.
Environment. The config auto-selects from the Lambda alias — $LATEST or a local
run resolves to staging, which points at the NetSuite sandbox, with no code change between
environments. Start read-only: the GET-NSSS harness fetches the three searches and prints row counts
and a sample row, and is safe against production. Then the full-engine dry run computes payloads
without writing. Only then the create/amend harnesses, which ⚠️ create and amend real Transfer
Orders in the sandbox. Verify in NetSuite: source and destination locations, order status,
approval marker, lead-time override and expected due date, one line per item with the right
quantity, header CBM derived by NetSuite, and no bin/inventory detail set.
UAT
What a person checks, by hand, before it is trusted.
How the business signs this off. The Result column below doubles as the sign-off sheet — tick each row against a sandbox run and record who ticked it, following the environment steps above.
| ID | Scenario / input | Expected outcome | Result |
|---|---|---|---|
| A1 | Scheduled event received | All three searches fetched sequentially; row counts logged | ☐ |
| A2 | Non-scheduled / HTTP-shaped event | Not treated as scheduled | ☐ |
| A3 | Item with demand of zero or less | Skipped — no line, no TO | ☐ |
| A4 | One search returns an error | Run continues with an empty set; error emailed — note it is indistinguishable from "no stock" | ☐ |
| A5 | Live search #1 column name | Item id resolves; no item reports an undefined id (D1) | ☐ |
| B1 | Short 2, bins of 4 and 8 available | Smallest covering bin chosen → move 4, not 8 | ☐ |
| B2 | Short 1, single bin of 8 | Whole bin moves → 8; surplus 7 accepted | ☐ |
| B3 | Short 7, bins of 4 and 4 | Both bins combined → 8 moved | ☐ |
| B4 | Short 7, only one bin of 4 | Move 4, shortfall 3 raised | ☐ |
| B5 | itemallocated equals the full bin quantity |
Nothing moves — stock already on an open TO | ☐ |
| B6 | itemallocated column absent from the response |
Must fail loudly, not default to zero (D2) | ☐ |
| C1 | Item in Overflow only | One TO from 23, 7-day lead time |
☐ |
| C2 | Item in both lanes, Overflow covers it | Bonded untouched | ☐ |
| C3 | Item in both, Overflow partially covers | Overflow drained first; remainder from Bonded on a separate TO, 42-day lead time | ☐ |
| C4 | Bonded-sourced line over 15 CBM | Currently split at 15 — confirm the container cap first | ☐ |
| D1 | Partial coverage | Available stock still transferred and planner emailed | ☐ |
| D2 | Shortfalls on an otherwise clean run | Alert still sent, independent of the error email | ☐ |
| D3 | Recipient list empty | No email; run still logs the shortfalls | ☐ |
| E1 | No eligible open TO | New TO created, Pending Approval, approval marker set | ☐ |
| E2 | Eligible TO already carries the item | Existing line incremented, no duplicate line | ☐ |
| E3 | Two eligible TOs, line fits across both | Split across exactly those two | ☐ |
| E4 | Line would need three or more TOs | New TO instead — never fragmented | ☐ |
| E5 | Overflow line and Bonded line in one run | Separate TOs — sources never mixed | ☐ |
| E6 | TO whose approval marker has been cleared | Amend rejected as TO_LOCKED; nothing written |
☐ |
| E7 | Pending-Approval TO destined somewhere other than Sydney | Must NOT be selected as an amend target (D3) | ☐ |
| E8 | Demand drops after a TO exists | Existing lines untouched — never reduced | ☐ |
| E9 | Auto-approved TO, marker still Pending Approval | Define and assert the expected behaviour (D6) | ☐ |
| F1 | Total under 15 CBM | Single TO, no split | ☐ |
| F2 | Line of ~45 CBM | Three new TOs, each under 15 | ☐ |
| F3 | Amend would push a TO over the cap | Rejected as CBM_CAP_EXCEEDED; nothing written |
☐ |
| F4 | Single unit larger than 15 CBM | Must raise an exception, not emit an over-cap TO (D4) | ☐ |
| G1 | Create payload | Lines carry item + quantity only — no bin, cartons or units | ☐ |
| G2 | Created TO read back | Line and header CBM auto-derived by NetSuite | ☐ |
| G3 | ISO-format transaction date | Save fails — dates must be US MM/DD/YYYY |
☐ |
| G4 | Expected due date | Equals transaction date + lead time for the source | ☐ |
| G5 | RESTlet reports a logical failure at HTTP 200 | Surfaced as an error, not counted as success | ☐ |
| G6 | Write script redeployed after a field change | Approval-marker guard actually in effect (D5) | ☐ |
| H1 | Item whose only cover is an order with the Transfer Order Approval field empty | Counted as coverage — the field must not gate visibility (D11) | ☐ |
| H2 | Item fully covered by open orders — S309870 / order 3495, Santino |
Net demand 0, no line, on this run and every later run while that order stays open (D11) | ☐ |
| H3 | Open-order feed read raw | Quantities arrive negative; absolute values used before netting, or the order doubles (D11) | ☐ |
| H4 | Only covering order is older than the lane's lead time | Counted in full — age is deliberately not a factor; a person keeps the list clean (D12) | ☐ |
| H5 | Covering order is Pending Approval and was raised by a person | Counted in full — an active order is supply, whoever raised it (D12) | ☐ |
| H6 | Covering order is dated in the future — order 3519, 1 Jan 2027 |
Counted in full. A wrong date is a data-entry matter for the order's owner, not something the engine screens (D12) | ☐ |
| H7 | Kit parent ordered, a component has Overflow stock — S310299 |
The component appears as its own demand row | ☐ |
| H8 | Demand allocated to a purchase order inbound to Sydney — S310293 |
Demand still reported — Overflow is not suppressed by a PO | ☐ |
| H9 | "Set of 2" item short | Demand reads in cartons, matching bin stock and availability (D10) | ☐ |
| H10 | One item ordered in two different units across orders — Asta | Each line converted by its own unit, not the item's stock unit (D10) | ☐ |
| H11 | Net demand not a whole number of cartons | Undefined — settle TO-Q2. No sandbox example exists, but the sandbox is stale, so check production (D10) |
☐ |
| H12 | Bins exceed source availability — Xoriguer, 15 against 5 | Never move more than availability | ☐ |
| H13 | Bins exceed availability by more than the open-order feed accounts for | Undefined — proposal is to flag and move nothing (D12) | ☐ |
UAT sign-off
- ☐ Ran the read-only dry run over live search data before any write
- ☐ Column names (A5) and
itemallocated(B6) verified against live responses - ☐ Bin sourcing (B) — closest-fit, whole-bin and multi-bin all behave as specified
- ☐ Source lanes (C) — Overflow drained first; lanes never share a TO
- ☐ Placement (E) — E7 destination check passes
- ☐ CBM cap (F) — including the oversized-unit case
- ☐ Write mechanics (G) — sandbox TO inspected field by field
- ☐ Coverage (H) — netting against the open-order feed verified on a live feed, signs handled
- ☐ Units (H9, H10) — one unit across all four feeds, confirmed per line rather than per item
- ☐
TO-Q2answered, or H11 and H13 explicitly accepted as out of scope for this sign-off - ☐ Run against a refreshed sandbox, or against production read-only — the cases below were written against a sandbox that had not been refreshed for some time, which inflates order ages and hides part-carton commitments
- ☐ Sign-off: name & date ____________________
Edge cases
The inputs that sit at the boundary, and whether each is handled.
| Case | Behaviour | Handled? |
|---|---|---|
| Demand of zero or less | Item skipped entirely | ✅ |
| Item in both source lanes | Overflow drained first, Bonded takes the remainder, separate TOs | ✅ |
| Stock already fully allocated to open TOs | Nothing moves for that item | ✅ (only if itemallocated is populated — TO-D2) |
| Whole bin larger than remaining availability | Partial bin moves | ✅ (deviates from BR-04's wording) |
| Single unit larger than the 15 CBM cap | Emits a Transfer Order over the cap, silently | ❌ — TO-D4 |
| Amend target destined somewhere other than Sydney | Selected anyway | ❌ — TO-D3 |
| Demand drops after a TO exists | Lines untouched | ✅ |
| Re-solve — replacing an earlier selection | Not implemented; appends only | ❌ |
| A saved search errors | Returns an empty row set; run continues | ⚠️ indistinguishable from "no stock" |
Failure modes
What breaks it, how that shows, and how to recover.
| Failure | Symptom | Detection | Recovery |
|---|---|---|---|
| Bin search unreachable (role lacks Bin access) | Every item reports a total shortfall | Full-list shortfall email | Grant Bin record access to the integration role; re-run |
| Item-id column renamed | Zero TOs created; every item reported short | Same shortfall email — looks identical to "Overflow is empty" | Reconcile the column name; re-run (TO-D1) |
itemallocated missing from the response |
Same stock re-transferred nightly | Duplicate TOs across consecutive days | Treat a missing value as a hard failure, not zero (TO-D2) |
| Write script rejects an amend | TO_LOCKED in the run log |
Error email | Expected when the team has handled the TO; no action |
| Amend would exceed the cap | CBM_CAP_EXCEEDED; nothing written |
Error email | Line falls to a new TO on the next run |
| RESTlet returns a logical failure at HTTP 200 | Surfaced as an error, not counted as success | Error email | Read the stage field — it names the failing field or step |
Known limitations
Scope that was deliberately chosen. A limitation is a decision.
Deliberate scope, not mistakes — the misreadings in What people get wrong above are the business- facing version of the same list. Keeping them here stops them being re-raised as bugs.
| Limitation | Why it is this way | What to do instead |
|---|---|---|
| Sydney receives more than it was short | Whole bins move, so a shortfall of 2 against a bin of 4 moves all 4 | Nothing. The surplus is intended |
| The bin to pick from is never written onto the Transfer Order | Only the quantity is transferred; the warehouse assigns bins at fulfilment | Warehouse picks the physical bin |
| A Transfer Order is a plan, not a movement | It sits awaiting approval until a person approves it | The fulfilment team approves and then clears the approval marker |
| A shortfall email is not a failed run | Everything available was moved; the email covers only the remainder | The planner acts on the remainder |
| Bonded and Overflow never share a Transfer Order | One order carries one source and one lead time — 7 days versus 42 | Expect two shipments for a split item |
| Nothing is escalated automatically | The shortfall email is the only channel | The planner is the escalation |
| An open Transfer Order suppresses demand for as long as it stays open | Coverage trusts any active order, with no age limit — an order is either live supply or it is not, and the engine cannot tell a slow shipment from a forgotten one | A team member keeps the open-order list clean. Close or cancel orders that are no longer real (TO-D12) |
Known defects
Where it does something other than what was decided. A defect is a mistake.
| Ref | Status | Defect | Rule |
|---|---|---|---|
TO-D1High |
Open | Saved-search column name mismatch — silently produces zero TOs. The engine reads the backorder item id as item_id; the committed reference capture returns it as item_ID. Running the branch engine over the committed captures unchanged, every one of the six items resolves to an undefined item, finds no bins, and is reported as a total shortfall — zero Transfer Orders created, and a shortfall email listing every backordered item. Correcting the key alone produces the correct result in the worked example above. |
needs confirming |
TO-D2High |
Open | Anti-double-order protection rests on one un-captured field. With demand netting removed, the only thing preventing the same stock being transferred every night is the supply guard's itemallocated field. That field is absent from the committed capture of the bin search, and the code defaults a missing value to zero — meaning "nothing is allocated", so the full bin becomes available again on the next run.
Answered 2026-10-08 from a live sandbox run of the bin search — and it is worse than "the wrong number". totalAllocatedQty is not an allocation of Overflow stock at all. It is Sydney's own demand: Sydney committed plus Sydney backordered, divided by the units per box. Checked against the location records for 17 items, 16 match exactly across values from 3 to 261 — Morning Read 0 + 17 = 17, The Standard 0 + 261 = 261, Capri 18 + 1 = 19, Asta (36 + 32) / 2 = 34, Luca Boucle 12 / 2 = 6. Item 387943 predicts 1 and reads 0, and is unexplained. The recorded label was right: it is allocated from sales orders.
There is no transfer-order component to recover from it. Morning Read has 14 units on open Transfer Orders out of Overflow and the field reads 17 — its backorder, not 31. The Standard has 262 on open orders and reads 261. No arithmetic on this column can yield "stock already on a Transfer Order", because nothing of the kind is inside it.
The automation therefore works because of this defect, not despite it. The guard reads zero only because the code looks for itemallocated while the search emits totalAllocatedQty. Correct the name alone and available = bins - allocation falls to zero or below for 8 of the 17 items holding Overflow stock, each then skipped with nothing moved: Asta -26, Valentina -22, Santino Leather -17, Amara -14, Capa -12, Luca Velvet -2, Luca Boucle -1, Ravello 0. Do not rename the field. The column must be rebuilt to carry the source location's own committed quantity — the stock promised to leave Overflow — which reconciles exactly to the open Transfer Orders (Morning Read 14, The Standard 262). |
needs confirming |
TO-D3High |
Open | Amend eligibility never checks the destination. The spec defines an eligible TO as "open TO, Overflow → Sydney, Pending Approval, with room". The code checks the source and the approval marker — never the destination. Any Pending-Approval TO sourced from Overflow qualifies, wherever it is going. | needs confirming |
TO-D4Medium |
Open | Oversized single unit escapes the CBM cap. In the over-cap split, units-per-TO is floored and then raised to a minimum of one. If one unit of an item exceeds 15 CBM, a Transfer Order is created over the cap, silently. Rare, but sofas and modular pieces are the plausible candidates. Flag it as an exception rather than emitting an over-cap TO. | needs confirming |
TO-D5Medium |
Open | Two competing definitions of "amendable". Amendability is decided in two places that read different fields: the engine picks amend targets by matching the text "Pending Approval" in the open-TO search's approval-status column, while the write script's guard checks the custbody_to_approval field equals 1.
Measured 2026-10-12, and the two fields disagree systematically. Of the 31 open Overflow orders in the coverage feed, only 3519 and 3523 are at NetSuite order status Pending Approval, and both have the approval marker blank. All 14 orders carrying the marker Pending Approval are at Pending Fulfilment. So the text test and the field test do not merely differ in spelling — they select disjoint sets. See TO-Q4. |
needs confirming |
TO-D6Medium |
Open | Auto-approve conflicts with the amendability model. Created TOs are immediately auto-approved to Pending Fulfilment, because that state commits the source stock and makes the searches self-correct. But BR-11 says a TO is amendable only while Pending Approval. The approval marker is still set to Pending Approval on those same TOs, so the guard would permit an amend to a TO that NetSuite has already locked. The repo carries a test harness written specifically to probe whether a Pending-Fulfilment TO can be amended — i.e. this was known to be unresolved. Confirm the intended end state: auto-approve for commitment, or stay amendable. It cannot be both.
Withdrawn 2026-10-12 — the premise was wrong, and this may not be a defect at all. The project owner states the operative rule: an order is amendable when custbody_to_approval is neither Approved nor Rejected, and Pending Fulfilment is the expected order status, since that is where auto-approve leaves it. The field is the team's manual brake — they set it to Approved to stop the automation adding to an order they have their own plan for. On that reading there is no conflict: the automation's 14 orders sitting at Pending Fulfilment with the marker still Pending Approval are in exactly the intended amendable state.
This entry's own business rule already said so — LI-BL-FUL-004 row 5 locks an order when "the team has already handled" it, and the decision tree reads "amending keys off the approval marker, not the order status". The "only Pending Approval is amendable" wording comes from BR-11's summary in the source repository, not from the rule here. Proposed reclassification to not-a-defect, awaiting the project owner's confirmation. What does survive is narrower and sits in TO-Q4: Pending Receipt must still be excluded. |
needs confirming |
TO-D7Low |
Open | The spec and the code have drifted apart. The spec is the artefact a reviewer would reach for first, which makes the drift costlier than it looks. | needs confirming |
TO-D8Low |
Open | Merged docs contradict a verified finding. main's README and netsuite/README.md still state that bins/inventory-detail are required and that the save will fail without them, and the write-step comment gives bin management as the reason for choosing a RESTlet. The branch (and PR #2) record the opposite, verified against a real record: inventory detail is not set, and the warehouse assigns bins at fulfilment. Documentation-only, but it is the currently-merged version that a new reader sees. |
needs confirming |
TO-D9High |
Resolved | The unmerged branch appears to have been merged — this entry's deployment state is stale. Reading main for the script_updated date on 2026-08-21 returned HEAD 0ca95c7, dated 2026-08-17, whose message is "BE-3412: Transfer Order automation — allocation engine (create/amend, auto-approve, commit, shortfalls) (#3)". The Deployment state section above records BE-3412-APPLY-BUSINESS-LOGIC @ 47c0845 as unmerged and not deployed, and main @ 807826a as read-only step 1.
Resolved 2026-10-08 — it is merged and live. The code was re-read at 0ca95c7, which is still main HEAD. All three features are implemented and wired: the orchestrator calls the decision step and then the write step, with nothing commented out; the allocation engine is a full implementation, not a stub; and the write seam is a real implementation. The two consequences this defect raised are also answered — config/production.mjs carries real RESTlet ids, not placeholders, alongside the three production saved-search ids, and the deploy workflow pushes main to the production Lambda alias on merge. The automation has therefore been running daily since 2026-08-17. Deployment state is corrected above. Behaviour itself was not re-verified against a production run, so last_reviewed stands. |
needs confirming |
TO-D10High |
Open | Demand is counted in pieces, bin stock in boxes — and the engine compares them directly. A live run of the bin search shows it reports stock units: Luca Leatherette's bin reads 12 where it physically holds 24 pieces, and its item volume of .138288 is the volume of a box of two. The backorder search reports pieces — the same item returns a demand of 6 for an order of 3 boxes.
For every "Set of N" item the engine reads demand as N times what it is and compares it against a bin count in boxes. No visible error has appeared yet because whole-bin selection usually moves more than the shortage anyway, which masks the factor — but the sourcing target, the availability cap and the shortfall all come from the mismatched pair, and the volume used against the 15 CBM cap comes from the box figure while the quantity comes from the piece figure. Settle one unit across both searches before either is changed. Found alongside TO-D2, in the same run. |
needs confirming |
TO-D11High |
Open | Coverage was blind to every transfer order but the automation's own unapproved ones, so demand already ordered was ordered again. The open-order feed filtered on the Transfer Order Approval field being Pending Approval. That field is set on 51 of 3,022 transfer orders in the sandbox and empty on the other 2,975 — including all four whose order status is Pending Approval and all twenty-four at Pending Receipt. The 51 that carry it are, in practice, the orders this automation itself raised. Coverage therefore saw only the automation's own output, and nothing a person had raised.
Compounding it, the engine never nets against that feed at all. It reads the open-order search only for amend capacity — remaining CBM and which items already sit on which order — and takes the backorder search's demand as already net of transfers in flight. That was true while the backorder formula subtracted the allocated quantity; it stopped being true when that term was removed to stop purchase-order allocation hiding demand. See TO-D2.
The feed also reports source-side quantities as negatives — orders 3569 and 3570 each report -2 for Spindle King Bed (Box 1). Netted as reported, coverage is -4 and net demand computes 4 - (-4) = 8: the step would double the order rather than suppress it. Absolute values are required.
Worked case, 2026-10-09. Sales order S309870 orders 4 Santino Leather Dining Arm Chair (Oak, Tan) for Sydney, 1 committed, so 3 short. Transfer order 3495 of 11 May already carries 4 of the same item out of Overflow, every line fulfilled and nothing received. The item nonetheless showed a demand of 3 against coverage of 0 — a whole bin of 4 would be transferred again, and again every night, because the covering order can never enter the feed.
Widened 2026-10-09 to exclude only Approved and Rejected. The feed went from 23 rows to 53, order 3495 appeared, and the item's net demand fell to 0. Items resolving to zero net demand across the Overflow lane rose from 6 of 20 to 13 of 20 — the measure of how much duplicate ordering the filter was concealing. The field is still needed, as a column rather than a filter: it answers "may a line still be added to this order", which is the amend test, while coverage must count every active order including approved ones. One feed serves both decisions, so the discriminator belongs in a column, not in the criteria. |
LI-BL-INV-001 |
TO-D12High |
Not a defect | With coverage widened, demand is now suppressed by transfer orders that have stopped moving. The Overflow lane has a 7-day lead time. Coverage now counts orders 66 to 281 days old, and seven of the thirteen suppressed items are suppressed entirely by them: Amara Boucle Bar Stool (demand 4, covered 12, oldest 151 days), Asta Fabric Dining Chair (4 / 6, 151), Santino Leather Dining Arm Chair (3 / 4, 151), Xoriguer Dining Chair (10 / 10, 149), Camille Boucle 3 Seater Sofa (3 / 5, 73), Light No 1 (3 / 5, 73), Adele Dining Chair (1 / 1, 66). Fixing TO-D11 alone therefore inverts the fault rather than curing it: from ordering stock twice to never ordering it at all.
The three order statuses are not equivalent, and the rule should not treat them alike.
Pending Fulfilment — the stock is still at Overflow and committed to leave, so source availability already reflects it. Counting it as coverage is consistent and safe.
Pending Receipt — the stock has left Overflow and not arrived. Availability no longer shows it, so coverage is the only guard there is. Counting it is necessary; but where the order is abandoned the demand is never served by anything. Orders 3495 (151 days) and 3517 (73 days) are in this state.
Pending Approval — nothing is committed and nothing is in motion; the stock still sits free in the Overflow bins. Orders 3518 (281 days), 3520 (269 days), 3523 (66 days) and 3519 — dated 1 January 2027, 84 days in the future — all suppress demand today. This is the weakest of the three: an unapproved order is not supply.
LI-BL-FUL-004 and BR-11 count Pending Approval and Pending Fulfilment alike as coverage. That was written for orders this automation raises and auto-approves inside the same run; a person's Pending Approval order left since January is a different thing, and the rule may need splitting. See TO-Q1.
Reclassified 2026-10-09 by the project owner: this is not a defect. Keeping the open transfer orders clean is a person's job, not the engine's — a team member owns the list, and coverage is right to trust any order that is still active. The substance moves to Known limitations, where known scope belongs, so it stops being re-raised as a bug. The ref is kept rather than removed, because it has been cited.
The ages above also measure the wrong thing. They come from a NetSuite sandbox that has not been refreshed for some time, where nothing gets received and orders simply accumulate — 24 at Pending Receipt averaging 307 days, the oldest dated 19 October 2022, and one dated 1 January 2027. That is sandbox decay, not a production backlog. Nothing here has been measured against production, so no claim about how often demand is really suppressed by a stalled order should be read out of it. |
needs confirming |
Findings from reading the repository at 807826a (main) and 47c0845 (branch). Each was
reproduced against the committed reference data unless noted.
TO-D1 · Saved-search column name mismatch — silently produces zero TOs 🔴
The engine reads the backorder item id as item_id; the committed reference capture returns it
as item_ID. Running the branch engine over the committed captures unchanged, every one of
the six items resolves to an undefined item, finds no bins, and is reported as a total shortfall —
zero Transfer Orders created, and a shortfall email listing every backordered item. Correcting the
key alone produces the correct result in the worked example above.
There is no error and no exception: the failure looks exactly like "Overflow is empty". Whether it bites in production depends on which spelling the live search returns — unverifiable from the repository, and the captures are the only committed evidence. Confirm the live column name, and make an unresolved item id a hard error rather than a shortfall.
TO-D2 · Anti-double-order protection rests on one un-captured field 🔴
With demand netting removed, the only thing preventing the same stock being transferred every night
is the supply guard's itemallocated field. That field is absent from the committed capture of
the bin search, and the code defaults a missing value to zero — meaning "nothing is
allocated", so the full bin becomes available again on the next run.
The confirmed label makes this worse, not better. The field's recorded label is "Qty allocated from sales order" — allocated to sales orders. The code uses the value as stock already on open transfer orders. Those are different quantities, and the supply guard is only correct under the second reading. If the label is right, the guard is subtracting the wrong number and the whole anti-double-order argument fails. Resolve which it is before this merges — this now blocks the branch, not just flags it.
Compounding it: the bin search could not be fetched live at all, and its capture was generated from a CSV. The field now carrying the entire idempotency guarantee has never been observed in a live response. Verify it exists and is populated before this is merged; treat its absence as a hard failure, not a zero.
Answered 2026-10-08 from a live sandbox run — and it is worse than "the wrong number".
totalAllocatedQty is not an allocation of Overflow stock at all. It is Sydney's own demand:
Sydney committed plus Sydney backordered, divided by the units per box. Checked against the
location records for 17 items, 16 match exactly across values from 3 to 261 — Morning Read
0 + 17 = 17, The Standard 0 + 261 = 261, Capri 18 + 1 = 19, Asta (36 + 32) / 2 = 34, Luca Boucle
12 / 2 = 6. Item 387943 predicts 1 and reads 0, unexplained. The recorded label was right:
allocated from sales orders.
There is no transfer-order component to recover from it. Morning Read has 14 units on open Transfer Orders out of Overflow and the field reads 17 — its backorder, not 31. The Standard has 262 on open orders and reads 261. No arithmetic on this column can yield "stock already on a Transfer Order", because nothing of the kind is in it. That also rules out deriving the transfer quantity by subtracting the demand search from this column.
So the automation works because of this defect, not despite it. The guard reads zero only
because the code looks for itemallocated while the search emits totalAllocatedQty. Correct the
name alone and available = bins - allocation falls to zero or below for 8 of the 17 items
holding Overflow stock, each then skipped with nothing moved:
| Item | Bins | Allocated | Available |
|---|---|---|---|
| Asta Fabric Dining Chair | 8 | 34 | -26 |
| Valentina Dining Chair | 8 | 30 | -22 |
| Santino Leather Dining Arm Chair | 12 | 29 | -17 |
| Amara Boucle Bar Stool | 4 | 18 | -14 |
| Capa Fabric Bar Stool | 4 | 16 | -12 |
| Luca Velvet Bar Stool | 16 | 18 | -2 |
| Luca Boucle Bar Stool | 5 | 6 | -1 |
| Ravello Linen Flat Sheet | 10 | 10 | 0 |
Do not rename the field. The column has to be rebuilt to carry the source location's own committed quantity — the stock promised to leave Overflow — which reconciles exactly to the open Transfer Orders (Morning Read 14, The Standard 262).
TO-D3 · Amend eligibility never checks the destination 🔴
The spec defines an eligible TO as "open TO, Overflow → Sydney, Pending Approval, with room". The code checks the source and the approval marker — never the destination. Any Pending-Approval TO sourced from Overflow qualifies, wherever it is going.
Not hypothetical: the committed capture of the open-TO search contains a live Overflow TO whose destination is Gold Coast Showroom - Miami. Re-running the engine with that TO marked Pending Approval — the state the search was widened to surface — placed all six of Sydney's replenishment lines onto the Gold Coast shipment and created no Sydney TO at all.
Today it is masked, because the captured TO is Pending Fulfilment and so filtered out. Once the search reliably surfaces Pending-Approval rows, the mask is gone. Add an explicit destination check in the code; don't rely on the saved search to enforce it.
TO-D4 · Oversized single unit escapes the CBM cap 🟠
In the over-cap split, units-per-TO is floored and then raised to a minimum of one. If one unit of an item exceeds 15 CBM, a Transfer Order is created over the cap, silently. Rare, but sofas and modular pieces are the plausible candidates. Flag it as an exception rather than emitting an over-cap TO.
TO-D5 · Two competing definitions of "amendable" 🟠
Amendability is decided in two places that read different fields: the engine picks amend targets
by matching the text "Pending Approval" in the open-TO search's approval-status column, while the
write script's guard checks the custbody_to_approval field equals 1.
Confirming the labels narrows this: the search column and the custom field carry the same label,
Transfer Order Approval, so they are almost certainly two reads of one field rather than two
different fields. That removes the risk of them describing different things — but not the mismatch
in how they are read, since one matches display text and the other compares a stored value. They
can still disagree, and a disagreement is only discovered at write time as a TO_LOCKED failure. The guard also depends on a
manual redeploy — the spec flags "redeploy required" twice. Against an older deployed script the
guard simply doesn't exist, and any TO can be amended.
TO-D6 · Auto-approve conflicts with the amendability model 🟠
Created TOs are immediately auto-approved to Pending Fulfilment, because that state commits the source stock and makes the searches self-correct. But BR-11 says a TO is amendable only while Pending Approval. The approval marker is still set to Pending Approval on those same TOs, so the guard would permit an amend to a TO that NetSuite has already locked. The repo carries a test harness written specifically to probe whether a Pending-Fulfilment TO can be amended — i.e. this was known to be unresolved. Confirm the intended end state: auto-approve for commitment, or stay amendable. It cannot be both.
TO-D7 · The spec and the code have drifted apart 🟡
| Spec says | Code does |
|---|---|
| Net demand = gross − coverage (Definitions, BR-02, C3/C4) | Takes demand as-is; no netting |
binAvailableQty net-ness is an open question |
Decided: treated as raw, offset by itemallocated |
| Re-solve replaces the previous selection (BR-09, C14) | Append/increment only — never replaces |
| Engine must recognise its own TOs (C16) | Superseded — amends any Pending-Approval TO |
The spec is the artefact a reviewer would reach for first, which makes the drift costlier than it looks.
TO-D8 · Merged docs contradict a verified finding 🟡
main's README and netsuite/README.md still state that bins/inventory-detail are required and
that the save will fail without them, and the write-step comment gives bin management as the reason
for choosing a RESTlet. The branch (and PR #2) record the opposite, verified against a real record:
inventory detail is not set, and the warehouse assigns bins at fulfilment. Documentation-only,
but it is the currently-merged version that a new reader sees.
Other things to watch
- No test gate before production.
npm testexits non-zero by design, and the deploy workflow pushes to the production alias on merge tomainwith no test step. - Remaining room on an existing TO is trusted from the search's header CBM total. If that value is stale or absent, room is computed as the full cap and the TO can be over-filled.
- A failed search returns an empty row set rather than aborting, so an outage looks identical to "no stock in Overflow" — and produces a full-list shortfall email rather than an error.
- Bonded container cap unconfirmed — 15 CBM assumed.
TO-D9 · The unmerged branch appears to have been merged — this entry's deployment state is stale 🔴
Reading main for the script_updated date on 2026-08-21 returned HEAD 0ca95c7, dated
2026-08-17, whose message is "BE-3412: Transfer Order automation — allocation engine
(create/amend, auto-approve, commit, shortfalls) (#3)". The Deployment state section above
records BE-3412-APPLY-BUSINESS-LOGIC @ 47c0845 as unmerged and not deployed, and main @
807826a as read-only step 1.
Only the dates and the commit subject were read — no code was re-verified — so this entry has
not been changed to describe the merged state. Production wins over the entry: if the engine is
now live, everything from Deployment state down needs re-verifying at 0ca95c7, and the
production config's placeholder RESTlet ids (see above) become urgent rather than theoretical.
Re-verify before relying on the deployment state recorded here.
Resolved 2026-10-08 — it is merged and live. Re-read at 0ca95c7, still main HEAD: all three
features are implemented and wired, config/production.mjs carries real RESTlet ids rather than
placeholders, and the deploy workflow pushes main to the production alias. Deployment state is
corrected above. Behaviour itself was not re-verified against a production run, so last_reviewed
stands.
TO-D10 · Demand is counted in pieces, bin stock in boxes — and the engine compares them 🔴
A live run of the bin search shows it reports stock units: Luca Leatherette's bin reads 12 where it physically holds 24 pieces, and its item volume of .138288 is the volume of a box of two, not of one chair. The backorder search reports pieces — the same item returns a demand of 6 for an order of 3 boxes.
For every "Set of N" item the engine therefore reads demand as N times what it is, and compares it against a bin count in boxes. No visible error has appeared yet because whole-bin selection usually moves more than the shortage anyway, which masks the factor — but the sourcing target, the availability cap and the shortfall are all computed from the mismatched pair, and the volume used against the 15 CBM cap comes from the box figure while the quantity comes from the piece figure.
Settle one unit across both searches before either is changed. Found alongside TO-D2, in the
same run.
TO-D11 · Coverage saw only the automation's own unapproved orders, so demand already ordered was ordered again 🔴
The open-order feed filtered on the Transfer Order Approval field being Pending Approval. That field is set on 51 of 3,022 transfer orders and empty on the other 2,975 — including all four whose order status is Pending Approval and all twenty-four at Pending Receipt. The 51 that carry it are, in practice, the orders this automation raised itself. Coverage therefore saw its own output and nothing a person had raised.
Compounding it, the engine never nets against that feed at all. It reads the open-order search
only for amend capacity — remaining CBM, and which items already sit on which order — and treats the
backorder search's demand as already net of transfers in flight. That held while the backorder
formula subtracted the allocated quantity; it stopped holding when that term was removed so that
purchase-order allocation would stop hiding demand (TO-D2).
Sales order S309870 orders 4 Santino Leather Dining Arm Chair (Oak, Tan) for Sydney with 1
committed, so 3 short. Transfer order 3495 of 11 May already carries 4 of the same item out of
Overflow, every line fulfilled and nothing received. The item still showed demand 3 against coverage
0 — a whole bin of 4 would move again, and again every night, because the covering order could never
enter the feed.
Widened 2026-10-09 to exclude only Approved and Rejected: the feed went from 23 rows to 53,
order 3495 appeared, and net demand for the item fell to 0. Items resolving to zero net demand rose
from 6 of 20 to 13 of 20, which measures how much duplicate ordering the filter was concealing.
The field is still wanted — as a column, not a filter. It answers "may a line still be added to
this order", which is the amend test, while coverage must count every active order, approved ones
included. One feed serves both decisions, so the discriminator belongs in a column.
TO-D12 · With coverage widened, demand is suppressed by orders that have stopped moving 🔴
The Overflow lane has a 7-day lead time. Coverage now counts orders 66 to 281 days old, and
seven of the thirteen suppressed items are suppressed entirely by them — Amara Boucle Bar Stool
(demand 4, covered 12, oldest 151 days), Asta Fabric Dining Chair (4 / 6, 151), Santino Leather
Dining Arm Chair (3 / 4, 151), Xoriguer Dining Chair (10 / 10, 149), Camille Boucle 3 Seater Sofa
(3 / 5, 73), Light No 1 (3 / 5, 73) and Adele Dining Chair (1 / 1, 66). Fixing TO-D11 on its own
therefore inverts the fault instead of curing it: from moving stock twice to never moving it at all.
The three order statuses are not equivalent, and the rule should not treat them alike:
| Order status | Where the stock is | Does availability show it? | Safe to count as coverage? |
|---|---|---|---|
| Pending Fulfilment | at Overflow, committed to leave | yes | ✅ consistent — availability and coverage agree |
| Pending Receipt | left Overflow, not arrived | no | ⚠️ necessary, but a stalled order serves nobody |
| Pending Approval | still free in the Overflow bins | no | ❌ nothing committed, nothing moving |
Orders 3518 (281 days), 3520 (269 days), 3523 (66 days) and 3519 — dated 1 January 2027,
84 days in the future — are all Pending Approval and all suppress demand today.
LI-BL-FUL-004 and BR-11 count Pending Approval and Pending Fulfilment alike as coverage.
Reclassified 2026-10-09 by the project owner — this is not a defect, and the rule does not need
splitting. Keeping the open transfer orders clean is a person's job; coverage is right to trust
any order that is still active, whoever raised it and whenever it was raised. The engine has no way
to tell a slow shipment from a forgotten one, and guessing at an age bound would trade a visible
duplicate for an invisible starved order. It is recorded instead as a known limitation above, so
it stops being re-raised as a bug, and TO-Q1 is answered on the same basis.
The ages quoted above also measure the wrong thing. They come from a NetSuite sandbox that had
not been refreshed for some time, where nothing is received and open orders simply accumulate. The
24 orders at Pending Receipt averaging 307 days, the one dated October 2022 and the one dated
1 January 2027 are sandbox decay, not a production backlog — and the "seven of thirteen items
suppressed by stale orders" figure describes that sandbox, not production, which has not been
measured. The TO-D11 mechanism is unaffected: that an approval filter excluded 2,975 of 3,022
orders, and that the engine never nets against the feed, are facts about the filter and the code
rather than about the age of any data.
Open questions
What could not be established. Recorded rather than guessed.
| Ref | Status | Question | Who can answer |
|---|---|---|---|
TO-Q1 |
Answered | At what age does an open transfer order stop counting as coverage, and should an unapproved one count at all? Needed before TO-D11's widening is safe — see TO-D12. Three parts, none of them answerable from the code: the age bound (proposed: the lane's lead time plus a buffer, so roughly 14–21 days for Overflow at 7 days and 56 for Bonded at 42 — needs confirming); whether a Pending Approval order raised by a person should count as supply at all, given nothing is committed and nothing is moving; and what the engine should do with an order past the bound — ignore it and re-order, or flag it for a person and order nothing.
Answered 2026-10-09 by the project owner: there is no age bound. Coverage counts every active order regardless of age, and keeping that list honest is a person's job — a team member closes orders that are no longer real. Recorded as a known limitation rather than built into the engine, which has no way to tell a slow shipment from a forgotten one.
There is a process half that no search change reaches: 24 orders sit at Pending Receipt averaging 307 days and 58 at Pending Fulfilment averaging 142, with the oldest dated 19 October 2022. those counts come from a sandbox that has not been refreshed, where nothing is received and orders accumulate, so they describe sandbox decay rather than a production backlog. One order, 3519, is dated in the future. |
needs confirming |
TO-Q2 |
Open | How is a part-carton demand rounded? Demand is measured in cartons so that it is comparable with bin stock and source availability, which are both in cartons. A multi-piece item whose net demand is not a whole number of cartons — 8 pieces ordered with 3 committed on a Set of 2 gives 2.5 — therefore has no defined answer. Rounding up sends a spare piece; rounding down leaves the order short; and the warehouse moves whole cartons either way, so one of the two has to be chosen deliberately. Why no example of it exists yet — corrected 2026-10-09. Checked across every open Sydney line, no line's net quantity fails to divide into whole cartons. That was first read as evidence the case is rare. It is not: the check ran against a NetSuite sandbox that has not been refreshed for some time, so its orders are old and were all committed in carton multiples. It says nothing about how often production part-commits a carton. Re-run the check against production, or a refreshed sandbox, before treating this as an edge case. Recorded rather than rounded either way, because picking a direction quietly changes what is ordered. | needs confirming |
TO-Q3 |
Open | Should a whole bin move when the net demand left is a fraction of it? Raised by the project owner's case sheet, 2026-10-12, case 7. Luca Boucle Bar Stool (Set of 2) has a Sydney demand of 6 cartons, of which 5 are already on transfer order 3517, leaving a net of 1. Overflow holds one bin of 5, so closest-fit moves the whole bin and Sydney ends up with 10 cartons inbound against a demand of 6.
Each rule in play is behaving as written — LI-BL-INV-001 nets the coverage, LI-BL-INV-002 moves whole bins, and the Overflow lane deliberately ignores the purchase order covering the last carton because Overflow arrives in days. It is the combination that is in question, and the options are to accept it as ordinary surplus, to skip an item when the bin would overshoot the net by more than some multiple, or to cap the move. Held open at the project owner's request on 2026-10-12 — "keep the record and I will answer later". |
needs confirming |
TO-Q4 |
Open | Which open transfer orders may be amended? Mostly settled by the project owner on 2026-10-12, recorded here because two pieces are not. The rule is the combination of two fields: custbody_to_approval is neither Approved nor Rejected, and the order status is Pending Fulfilment. The custom field is the team's manual brake — setting it to Approved stops the automation adding to an order the team has its own plan for, a plan NetSuite does not hold. Measured against the live feed the same day, that selects 26 of the 31 open Overflow orders.
Open piece 1 — one feed cannot serve both jobs, so a second one is proposed. The project owner's direction on 2026-10-12 is that the search decides what is amendable and the engine does not filter again: the approval marker is carried as a column for business context, not as something to re-test in code. The difficulty is that 3/3 answers two Answered 2026-10-12 by a sandbox test — no second feed is needed. It had been asserted here that a line added to an order already fulfilled out of Overflow would never be picked. That is false. Tested against transfer order 3463 (Overflow to Sydney Showroom, so outside the coverage feed): a new line was accepted on an order at Pending Receipt, the order moved to Pending Receipt/Partially Fulfilled — still inside 3/3's filter — and the new line committed its stock (quantityAllocated 1, quantityCommitted 1, quantityFulfilled 0), so the warehouse will pick it. The header volume recalculated from 0.3669 to 0.717 m³ and the carton count from 2 to 3, so the cap arithmetic survives an amend. The test line was then closed, which released the commitment and returned the order to Pending Receipt.
3/3's filters are therefore correct as they stand — status excluding Closed, Rejected and Received keeps all three live states, and every order it returns can take a line. The approval marker is carried as a column for the team; it appears in no filter row.
Narrowing 3/3 to the amendable set costs five items their cover and re-orders 19 cartons: Luca Boucle 6, Asta 4, Light No 1 3, Camille 3 and Santino 3. Santino's only cover is order 3495, at Pending Receipt — the very order whose invisibility raised TO-D11.
Withdrawn — the fifth search proposed here is unnecessary. It rested entirely on the claim the test disproved.
What remains for the engine to do. Because 3/3 does not filter on the approval marker, the team's manual brake only works if the engine reads that column: an order is an amend target when its marker is neither Approved nor Rejected. That is one column test for one decision, not a re-filtering of the feed, and coverage ignores the column entirely. TO-D3 stays open on its own merits — the destination is still never checked — and TO-D5 is now simply a wrong test to correct, since the engine compares the text "Pending Approval" against a field holding 1.
Open piece 2a — an amended order ships twice. The test showed an amend after fulfilment creates a second pickable line on an order whose first shipment has already gone. The header volume then sums two separate truckloads, so LI-BL-FRT-002's "one order is one shipment, capped at 15 CBM" no longer describes it. Not a blocker, and not decided here.
Open piece 2 — does Pending Approval count as well? Two orders, 3519 and 3523, sit at that status with a blank marker. They are plainly not "already handled", so they look amendable, but the stated rule names Pending Fulfilment only. Including them takes the pool from 26 to 28.
Worth proving before building: whether NetSuite will accept a new line on an order at Pending Fulfilment at all. The amend path has never run — TO-D5 — so this has never been exercised, and the whole rule rests on it. |
needs confirming |
TO-Q5 |
Open | Should a late purchase order still stop the Bonded lane? The Bonded demand feed subtracts demand NetSuite has allocated to an incoming purchase order, on the reasoning that a six-week container is no faster than a PO already on the water. The engine never reads the PO's Receive By date, so the same exclusion applies when the PO lands after a Bonded transfer would (Receive By later than today + 42 days) and when the PO is already overdue. In both cases Bonded stock that would reach Sydney first is left where it is. Options: keep the rule as is; exclude allocated demand only when the PO's Receive By is within the Bonded lead time; or flag the item for a person.Why it matters: Customers wait on a slow or stalled PO while stock the business already owns sits in Vietnam. The buying SOP currently tells buyers to raise a manual Bonded TO in these cases, which is a workaround, not a rule. | Project owner (Kim Hoang Nguyen) with the Buying team; the Bonded demand search changes if the answer is anything but "keep it". |
TO-Q6 |
Open | How does a Bonded Transfer Order relate to a container, and what is the Bonded volume cap? The CJ Logistics process (flowcharts, 2026-10-12) ships one TO per container, and Buying tops the container up with Grade A/B zero-stock SKUs from a sales-volume report. The engine caps every TO at 15 CBM — the Metro truck limit, assumed for Bonded until confirmed — and only moves backorder demand. Unanswered: whether the engine's Bonded TO is the container TO (so Buying adds top-up lines to it), sits alongside a manual container TO, or should not exist for Bonded at all; and what cap, if any, replaces 15 CBM.Why it matters: At 15 CBM a container's worth of Bonded demand splits into several TOs, which contradicts one TO per container, and the amend path may add robot lines to a container TO Buying has already planned. | Project owner with the Buying team and CJ Logistics (container sizes and loading rules). |
TO-Q7 |
Open | Should Bonded transit be 35 days or 42? The lead-time chain (LI-BL-INV-005) dates Bonded stock with no TO at today + 35, and a Bonded PO at its Vietnam date + 35. This engine writes a Bonded TO lead time of 42 (7 to departure + 28 in transit + 7 buffer). The moment a TO is raised, the customer-facing date for that stock moves roughly a week later.Why it matters: A customer can see a lead time lengthen the day after the business acts to bring the stock over. The 35 is also hard-coded in two scripts in the lead-time chain, so changing it is not a one-place edit. |
Project owner — it is a business definition of the Bonded journey, shared with the lead-time entries. |
TO-Q8 |
Open | Should the engine keep writing the TO header Expected Due Date? The create script sets a custom header date to TO date + lead time. Checked read-only in sandbox on 2026-10-13: nothing downstream reads it. The Sales Order's Expected Ship Date and the website arrival both follow the line Expected Receipt Date, which is the line Expected Ship Date + lead time. The header value is static and drifts from the lines as soon as the ship date moves — order 3519 carries a header of 08/01/2027 against a line Expected Receipt of 06/08/2026. Options: stop writing it, or derive it from the latest line Expected Receipt Date.Why it matters: It looks authoritative on the order and is the first date a person reads, but it is not the date the business runs on. |
Project owner decides; developer (Julian) makes the change in the create script. |
TO-Q9 |
Open | Does NetSuite keep a hand-edited TO line Expected Receipt Date? The buying SOP asks buyers to update the line Expected Receipt Date to the freight forwarder's ETA once a Bonded TO has shipped. Untested: whether NetSuite keeps that value, or recalculates it from the line Expected Ship Date + lead time on the next save or supply-allocation run.Why it matters: If it is recalculated, the SOP step does nothing and customers keep a stale date, which the lead-time chain drops once it is 14 days overdue. | Developer or NetSuite assistant — one test on a sandbox TO at Pending Receipt. |
TO-Q10 |
Open | Does the date chain hold on a real Bonded TO? Verified read-only in sandbox on 2026-10-13 for Overflow only: robot TOs 3568–3570 show line Expected Ship 06/10 → Expected Receipt 13/10 (+7), and the waiting Sales Order lines (S310233, S310234, S307816) took 13/10 once the TOs were approved. A Sales Order on an unapproved TO stayed on its PO date (S310080, PO 30/11, TO 3523 at Pending Approval). Unverified for Bonded: that the line Expected Ship Date takes the Receive By date of a PO into Bonded while the stock is not yet received, and the Item Receipt date once it is, and that Expected Receipt is then + 42. The mechanism setting the line Expected Ship Date was not found as a script on the TO record; NetSuite's supply allocation is the likely source, which is an inference.Why it matters: The buying SOP's date guidance for Bonded rests on it, and no robot-created Bonded TO exists in sandbox to check against. |
Developer or NetSuite assistant — create one Bonded TO in sandbox against stock still on a PO into Bonded, then against received stock. |
TO-Q11 |
Open | Which inbox receives the shortfall email? Recipients come from the Lambda configuration and are not recorded here. The buying SOP names the Buying team as the owner of every shortfall line, so the email has to reach the inbox they actually work from.Why it matters: If it goes to a person or a developer list instead, uncovered demand is never actioned and nothing escalates. | Developer (configuration) and the Buying team lead (which inbox). |
TO-Q1 is a precondition for TO-D11's widening being safe, not a tidy-up: until an age bound
exists, every stalled order in the account silently cancels a night's replenishment. Its three parts
— the bound itself, whether an unapproved order counts as supply, and what to do with an order past
the bound — are all business decisions, and none of them can be read out of the code.
Alongside them sits a process half that no search change reaches: 24 orders sit at Pending Receipt averaging 307 days and 58 at Pending Fulfilment averaging 142, the oldest dated 19 October 2022. Until those are closed, any age bound is only choosing which stale orders to believe.
Source references (read-only)
The code and searches this reading was written from.
Do not edit these files — read-only per the access policy.
All of the below is deployed — main @ 0ca95c7. The split this section used to draw between
merged and unmerged files is gone: the branch was merged on 2026-08-17.
Read first — the run itself:
transfer-order-automation-s10/index.mjs— handler, error/shortfall globals, run-end reportingtransfer-order-automation-s10/controllers/app.mjs— orchestration (read → decide → write)transfer-order-automation-s10/controllers/netsuite.mjs— saved-search reads and RESTlet callstransfer-order-automation-s10/helpers/netsuite.mjs— token-based-auth client; account chosen entirely by the secrettransfer-order-automation-s10/config/{production,staging}.mjs— search ids, script ids, recipientstransfer-order-automation-s10/json/— captured saved-search reference data and payload contracts
The engine and the write path:
transfer-order-automation-s10/controllers/businessLogic.mjs— the allocation enginetransfer-order-automation-s10/controllers/createTO.mjs— write seam, create vs amend routingtransfer-order-automation-s10/netsuite/createTransferOrder.js— create/amend script, approval guard, cap checktransfer-order-automation-s10/controllers/aws.mjs— shortfall alert alongside the error emailtransfer-order-automation-s10/docs/allocation-engine-spec.md— the rules as written (seeTO-D7)
The Asana task remains the source of truth for intent; where this entry and the task disagree, the task wins for intent and production wins for behaviour (CONVENTIONS.md §1).
Change history
What moved on this page, and when.
| Date | Change | Change request |
|---|---|---|
| 2026-10-13 | Open questions TO-Q5–TO-Q11 added from the buying-team SOP work. Late PO blocking the Bonded lane, container vs 15 CBM, 35 vs 42 days of Bonded transit, the unread header Expected Due Date, hand-edited line receipt dates, the Bonded date chain, and the shortfall inbox. The date chain was checked read-only in sandbox; Overflow holds, Bonded is unverified. Ageing of open TOs was not re-raised — TO-Q1 already answers it. |
— |
| 2026-10-12 | Sandbox test settles TO-Q4's first open piece, and the fifth search proposed earlier today is withdrawn. It had been asserted here that a line added to an order already fulfilled out of Overflow would never be picked. That is false. Tested against order 3463 (Overflow to Sydney Showroom, so outside the coverage feed): the line was accepted on an order at Pending Receipt, the order moved to Pending Receipt/Partially Fulfilled — still inside 3/3's filter — and the new line committed its stock, so the warehouse will pick it. The header volume recalculated from 0.3669 to 0.717 m³ and cartons from 2 to 3, so the cap arithmetic survives an amend. The line was then closed, releasing the commitment and returning the order to Pending Receipt. 3/3 therefore serves coverage and amendment as it stands, which is what the project owner said. What the engine still owes is one column test, not a re-filter: the team's manual brake works only if the approval marker is read, since 3/3 does not filter on it. New TO-TC-T13 records the verified behaviour, and a new open piece notes that an amended order ships twice, so LI-BL-FRT-002's "one order is one shipment under 15 CBM" no longer describes it. TO-D3 and TO-D5 stay open on their own merits. |
— |
| 2026-10-12 | TO-Q4 corrected again: the claim that a Pending Receipt order cannot be amended was asserted, not verified, and the whole fifth-search proposal rests on it. The project owner confirmed 3/3's filters are correct as they stand — status excluding Closed, Rejected and Received, which keeps Pending Approval, Pending Fulfilment and Pending Receipt in — and that the approval marker is carried as a column for the team, not as a filter; it appears in no filter row. Coverage needs all three states, which the Santino case proves. What is not established is whether NetSuite accepts a new line on an order already fulfilled out of Overflow, and whether the warehouse would honour it. If it does, 3/3 serves both coverage and amendment as it stands and no second feed is needed. Marked unverified rather than left reading as fact. |
— |
| 2026-10-12 | TO-Q4's first open piece re-cast: the filtering belongs in a saved search, not in the engine — but it takes a fifth search, not a narrower third. The project owner's direction is that the search decides what is amendable and the code does not re-test it; the approval marker is carried as a column for business context. Measured the same day, 3/3 cannot simply be narrowed, because it answers two questions with opposite status needs: coverage wants Pending Receipt in, since stock in transit is real supply, while amendment wants it out, since a line added to an order already fulfilled out of Overflow would never be picked. Narrowing it costs five items their cover and re-orders 19 cartons — Luca Boucle 6, Asta 4, Light No 1 3, Camille 3, Santino 3 — and Santino's only cover is order 3495 at Pending Receipt, the order whose invisibility raised TO-D11 in the first place. Proposed instead, for approval: 3/3 stays as the coverage feed and a fifth search carries amend targets only (status Pending Fulfilment, approval neither Approved nor Rejected, source 23/25, destination 11), so the engine applies no status test at all. TO-D5 and TO-D3 would then close by construction rather than by code — the feed becomes the only definition of amendable, and the destination filter lives in the search. Nothing built, nothing changed in the source repository; recorded for the project owner's decision. |
— |
| 2026-10-12 | Correcting the same day's entry: the amend rule was recorded against the wrong premise, so TO-Q4 is rewritten and TO-D6's new evidence is withdrawn. The earlier row read BR-11's summary in the source repository — only Pending Approval is amendable — as binding, and concluded that 26 of the 31 open Overflow orders were locked and that the automation's own output could never be amended. The project owner states the operative rule: an order is amendable when custbody_to_approval is neither Approved nor Rejected, and the order status is Pending Fulfilment, which is where auto-approve leaves it. The custom field is the team's manual brake — set to Approved it stops the automation adding to an order the team has its own plan for, a plan NetSuite does not hold. This entry's own business rule already said so: LI-BL-FUL-004 row 5 locks an order once "the team has already handled" it, and the decision tree reads "amending keys off the approval marker, not the order status". On that reading TO-D6's conflict dissolves and it is proposed for not-a-defect, awaiting confirmation. What survives is narrower and now sits in TO-Q4: the feed cannot express the rule, because 3/3 carries the approval marker but not the order status, and three orders in it (3463, 3495, 3517) are at Pending Receipt with their stock already gone from Overflow; whether Pending Approval also counts (2 more orders); and that NetSuite accepting a line on a Pending Fulfilment order has never been proven, since the amend path has never run (TO-D5). TO-D5 is unaffected — the engine's test matches the text "Pending Approval" against a field holding 1, so it never fires. No rule text changed. |
— |
| 2026-10-12 | Two open questions from running the project owner's eight-case sheet against the live feeds — TO-Q3 and TO-Q4 — plus the live evidence for TO-D5 and TO-D6. Seven of the eight cases produce the quantity the sheet expects. TO-Q3 holds the one that does not: Luca Boucle has a demand of 6 with 5 already on order 3517, so a net of 1 moves a whole bin of 5 and Sydney ends up with 10 inbound against a demand of 6 — every rule behaving as written, the combination in question. Held open at the project owner's request. TO-Q4 records that the instruction to amend any order the coverage feed returns is wider than intended: of the 31 open Overflow orders in that feed, only 2 are at order status Pending Approval, 26 are at Pending Fulfilment which BR-11 treats as locked, and 3 are at Pending Receipt with their stock already gone from Overflow. The same measurement is the live proof of TO-D5 and TO-D6, and both now carry it: the approval marker and the order status select disjoint sets — all 14 orders marked Pending Approval are at Pending Fulfilment, while the only two genuinely amendable orders carry no marker at all — and because the engine auto-approves its own output within the run, none of its own orders is ever amendable on the next run. No rule text changed, no fix applied, and last_reviewed is unchanged: the case results are a sandbox run awaiting the project owner's decisions. |
— |
| 2026-10-09 | TO-D12 reclassified not-a-defect and TO-Q1 answered, both on the project owner's direction, and a standing caveat added about the age of the sandbox the evidence came from. Stale open transfer orders are a process matter owned by a team member, not a logic error: coverage is right to trust any order that is still active, whoever raised it and whenever, and the engine has no way to tell a slow shipment from a forgotten one. So there is no age bound — TO-Q1 is answered on that basis, and the substance becomes a row in Known limitations, which is where known scope belongs. LI-BL-FUL-004/BR-11 therefore do not need splitting, as TO-D12 had suggested. The refs are kept rather than removed, since both have been cited. The ages behind the original finding also measure the wrong thing: they came from a NetSuite sandbox that had not been refreshed for some time, where nothing is received and orders simply accumulate, so the 24 orders at Pending Receipt averaging 307 days, the 2022 one and the future-dated one are sandbox decay rather than a production backlog — and the “seven of thirteen items suppressed by stale orders” figure describes that sandbox, not production, which has not been measured. The same correction explains TO-Q2: the absence of any part-carton demand was read as the case being rare, when it only reflects a sandbox whose commitments were all made in whole cartons, so that check must be re-run against production. TO-TC-T3 now carries a settled expectation instead of an open one, TO-TC-T10 and TO-TC-T11 lose the false reassurance, UAT rows H4, H5 and H6 become tickable, and the Test cases preamble carries the sandbox caveat so the data-dependent cases are re-run before sign-off. TO-D11 is unaffected — that the approval filter excluded 2,975 of 3,022 orders, and that the engine never nets against the feed, are facts about the filter and the code, not about the age of the data. No rule text changed and last_reviewed is unchanged. |
— |
| 2026-10-09 | The test pack and the UAT sheet both brought up to date: the test_cases: register goes from 4 cases to 49, and UAT gains a block of 13. The entry already carried a 40-row UAT table, but none of it was in the register, so nothing reached the generated TEST-CASES page and no case named a rule or a defect. Every UAT scenario is now a case in the register under its original id — A1…G6 become TO-TC-A1…TO-TC-G6, so the ids on the sign-off sheet still match — each given a layer, an input, a rule ref where one applies, and the defect it would catch. Added from this session's sandbox work: the kit-component blind spot (S310299), purchase-order-allocated demand that must still be reported (S310293), coverage counting both approval states, the open-order feed's negative quantities, per-line unit conversion where one item is sold in two units (Asta), the availability cap against bin totals (Xoriguer), and the Santino coverage case. Three cases record an expectation that is not yet defined rather than a guess — stale cover, the bins-versus-availability cross-check, and part-carton rounding — and the UAT sheet marks the same five rows as blocking only if TO-Q1 and TO-Q2 go unanswered. New TO-Q2: how a part-carton demand is rounded, which has no answer today and is reachable as soon as a commitment is made in pieces rather than carton multiples. TO-D11 also gains the negative quantity trap, which would double an order rather than suppress it. Eight cases name no rule because none covers run or write mechanics; left blank rather than stretched. No rule text changed and last_reviewed is unchanged. |
— |
| 2026-10-09 | Two new defects from a live sandbox case, both about coverage — TO-D11 and TO-D12 — plus TO-Q1, the first entry in a new open_questions: register and a new Open questions section. Sales order S309870 is 3 short of Santino Leather Dining Arm Chair (Oak, Tan) while transfer order 3495 of 11 May already carries 4 of it out of Overflow, fulfilled and never received — yet the item showed coverage of 0 and would have moved a whole bin again every night. The cause is TO-D11: the open-order feed filtered on the Transfer Order Approval field being Pending Approval, which is set on only 51 of 3,022 transfer orders — empty on all four at Pending Approval and all twenty-four at Pending Receipt — so coverage saw essentially only the automation's own output. The engine compounds it by never netting against that feed at all, reading it solely for amend capacity. The filter was widened on this date to exclude only Approved and Rejected: the feed went 23 rows to 53 and items at zero net demand went 6 of 20 to 13 of 20. TO-D12 records what that exposes — coverage now counts orders 66 to 281 days old on a 7-day lane, and seven of the thirteen suppressed items are suppressed entirely by them, so the fix inverts the fault rather than curing it. It also separates the three order statuses, which are not equivalent: Pending Fulfilment agrees with availability, Pending Receipt is the only guard there is but serves nobody when stalled, and Pending Approval commits nothing — one such order is dated 1 January 2027. TO-Q1 carries the age bound, whether an unapproved order counts as supply, and the process half (24 orders at Pending Receipt averaging 307 days, oldest 19 October 2022). No rule text was changed and last_reviewed is unchanged — this is deployed behaviour observed in sandbox, not a re-verification of production. |
— |
| 2026-10-08 | TO-D2 answered from a live run of the bin search, and it inverts the finding. totalAllocatedQty is not an allocation of Overflow stock at all — it is Sydney's own demand, committed plus backordered, divided by the units per box. Checked against the location records for 17 items: 16 match exactly across values from 3 to 261. The recorded label, "Qty allocated from sales order", was right, and the code's reading of it as stock on open Transfer Orders was wrong. It carries no transfer-order component — Morning Read has 14 units on open orders and the field reads its backorder of 17, not 31 — so no arithmetic on this column can recover one, which also rules out deriving it by subtracting the demand search. The consequence is the uncomfortable one: the automation works because of this defect. The guard reads zero only through the field-name mismatch, and correcting that name alone drops available to zero or below for 8 of the 17 items holding Overflow stock, stranding each of them — the eight are listed with their numbers. The fix is to rebuild the column to carry the source location's committed quantity, which reconciles exactly to the open Transfer Orders. Both field meanings move to confirmed: true on this evidence. New defect TO-D10: the same run shows the bin search reports boxes while the backorder search reports pieces, so for every "Set of N" item the engine compares demand in one unit against stock in another — masked so far by whole-bin selection. Also carries TO-D9's resolution into its body text, which the previous change left only in the register. No logic change, and last_reviewed is unchanged. |
— |
| 2026-10-08 | Status draft → active, and the deployment state corrected, because the entry described a branch that was merged seven weeks earlier. TO-D9 raised exactly this in August but only the commit date and subject had been read, so the entry was flagged rather than changed. The code has now been re-read at 0ca95c7, still main HEAD: all three features are implemented and wired — the orchestrator calls the decision step then the write step with nothing commented out, the allocation engine is a full implementation rather than a stub, and the write seam is real. The two consequences TO-D9 raised are answered too: config/production.mjs carries real RESTlet ids rather than placeholders, and the deploy workflow pushes main to the production Lambda alias on merge — so this has run nightly since 2026-08-17. TO-D9 is resolved; the Deployment state table, the status banner, the decision tree preamble and Source references no longer split the files into merged and unmerged; code_refs move to main @ 0ca95c7 with deployed: true. Also records the project owner's business context in the business reading: Overflow is treated as in stock because it reaches Sydney in days, so an item already on a supplier purchase order is not a reason to skip the transfer — only a movement already in flight from Overflow is. Added as a Why paragraph and a misconception, because it is the one most likely to cause a transfer to be cancelled by hand. last_reviewed is unchanged at 2026-08-17 — the deployed code was re-read, but no production run was observed, and the defects below were found in this same code. Deployed is not the same as correct. |
— |
| 2026-10-08 | Added The sums between Processing and the Decision tree (CONVENTIONS §15), giving the arithmetic behind each rule in the order it runs: room on an open order, free stock at a source, the sourcing target, the whole-bin pick and its availability cap, the shortfall, line volume, the over-cap split, filling a new order, the two-order split, and the expected date. The entry already carried the rules and the pseudocode but never a number, so a reader could follow what is decided without being able to reproduce how much. Worked against the same six items as the worked examples below — Alaska 2 short of a bin of 4 moving 4, Palermo 7 short of a bin of 4 moving 4 and flagging 3 — so the two sections reconcile. Nothing new is asserted: every formula is the deployed behaviour already described in the three Processing sections, and the two places where it diverges cite the defects that record them (TO-D2 for the committed-quantity term always reading zero, TO-D4 for the floored split raised to a minimum of one). No logic change, and last_reviewed is unchanged. |
— |
| 2026-09-28 | Added a decision tree in the skeleton's slot (CONVENTIONS §15, §16): four stages — how much, from where, which bins, which Transfer Order — in the order they run, each branch naming the rule it implements. All six rules and all nine defects are cited, and every ref was checked to resolve. It restates what this entry already documents, drawn from the three Processing sections, the source-lane table and the rules' own tables; nothing new is asserted. It opens on the deployment state, because that is the first thing that decides whether any of it is running: main carries step 1 only, the decision and write steps are stubs, and TO-D9 records a commit claiming to be the engine without the code having been re-verified. The tree follows the code rather than the spec, which TO-D7 records as having drifted from it. No logic change and last_reviewed is unchanged. |
— |
| 2026-09-28 | Corrected the defect register. The migration earlier today read the first table under ### Known defects and registered its four rows as TO-D1 to TO-D4 — but that table is the spec-versus-code evidence belonging to D7, and this entry's nine real defects are written as prose beneath it with their own anchors and about twelve references pointing at them. The register now carries those nine, TO-D1 to TO-D9, with the severity each already showed; the anchors and every reference moved into the namespace with them, and the spec-versus-code table is back in the body under TO-D7 where it belongs. No defect was reinterpreted and none was lost — the finding text is unchanged. |
— |
| 2026-09-28 | Developer sections reordered to the registry's skeleton (CONVENTIONS §15): Inputs · Processing · Decision tree · Outputs · Worked examples · Test cases · UAT · Edge cases · Failure modes · Known limitations · Known defects · Open questions · Source references · Change history. The entries had drifted into two house styles — four put the proof after the outputs, four put the problems there — so every shared heading sat at a different position depending on which entry you opened; Test cases alone appeared at five different ones. Every section moved whole and byte-identical: nothing inside any of them was touched, and no wording changed. ### Worked example was renamed to the plural the skeleton uses; its Deployment state section stays above Inputs, where scene-setting belongs. The one-line description the site now prints under each heading is generated from build.mjs, not written here, so it reads the same on every entry. npm run check warns on a wrong order and on a missing section. No logic change, and last_reviewed is unchanged. |
— |
| 2026-09-28 | The test_cases: register was added and left empty. This entry records its harness and its sandbox warning but no cases, and writing them would mean inventing the expected column against logic the entry itself records as diverging from its spec. npm run check now warns on the gap rather than leaving it invisible. No behaviour was re-documented and last_reviewed is unchanged. |
— |
| 2026-09-28 | Defects and open questions moved from body tables into the defects: and open_questions: front-matter registers, namespaced TO-: 4 defects (4 open). The build renders them back under the same headings, so the page reads as it did; the prose around those tables is unchanged. They now also appear on the generated DEFECTS and Open questions pages, which is the point — the same list was unreadable spread across nine entries in five different column shapes. Every existing ref is preserved. No behaviour was re-documented, no defect status was reinterpreted, and last_reviewed is unchanged. |
— |
| 2026-09-28 | System slugs eventbridge, ses and secrets-manager renamed aws-eventbridge, aws-ses and aws-secrets-manager. eventbridge here and aws-eventbridge in the courier tracking entry were the same AWS service counted twice across the registry — the systems view of the Integration Map drew two platforms where there is one. npm run check now warns on a slug outside the known list. Front-matter only — no logic change, and last_reviewed is unchanged. |
— |
| 2026-08-31 | Placed on the order journey: journey_stage: supply (Supply), the stage confirmed with the business. The Organisation Map now groups and orders entries by journey stage rather than by folder. Front-matter only — no logic change, and last_reviewed is unchanged. |
— |
| 2026-08-21 | Restructured to the current registry shape: the business reading now answers what / why / who / when / how it decides / outcomes in that order; the developer reading gains worked examples, test cases, UAT, known limitations as named sections. Front-matter: version removed (nobody kept it accurate), replaced by documented_on / documented_updated for this page and script_created / script_updated for the source; links: added so the saved searches and flows are one click away. Test cases & UAT split into two sections. New defect D9: reading main for the script date returned HEAD 0ca95c7 dated 2026-08-17, whose subject says the BE-3412 allocation-engine branch was merged — this entry still records it as unmerged and undeployed. Only the commit date and subject were read; no code was re-verified, so the deployment state above is left as it was and flagged instead. No logic change, and last_reviewed is unchanged. |
— |
| 2026-08-21 | Linked the entry to the glossary: 10 terms recorded in terms:, covering the warehouses, the Transfer Order and the shortfall alert. Vocabulary only — no logic change, and last_reviewed is unchanged. |
— |
| 2026-08-17 | Recorded the NetSuite field labels supplied by the project owner across all 14 fields, and drafted the business meanings from those labels plus the documented behaviour. 7 fields are fully confirmed; 7 keep confirmed: false because their meaning is a draft awaiting sign-off, not because the label is missing. Two findings came out of the labels: itemallocated is labelled as allocated to sales orders while the code treats it as stock on open transfer orders, now recorded against TO-D2 as blocking; and approvalStatus shares the Transfer Order Approval label with custbody_to_approval, which narrows TO-D5 to a read-style mismatch rather than two different fields. No logic change. |
— |
| 2026-08-17 | Added the field registry: a fields: block naming every field the automation reads or writes, rendered as a business-facing table (name, meaning, what it changes) and an id-keyed developer table. 14 fields recorded; 2 confirmed, 12 flagged needs confirming — the field ids and impacts are derived from the code, while the NetSuite labels and business meanings do not exist in the code and await confirmation (WORKING_AGREEMENT §4). No logic change. |
— |
| 2026-08-17 | Removed the owner / tech_owner role fields entirely — front-matter, metadata bar, validator and conventions. Named people are now the only ownership record. Attribution only, so last_reviewed is unchanged. |
— |
| 2026-08-17 | Recorded ownership: project_owner Kim Hoang Nguyen, developers Julian Ayoub — corroborated by GitHub, where Julian-Ayoub authored both merged PRs and the unmerged business-logic branch — and for_department Fulfilment Team. The role fields owner / tech_owner are unchanged. Attribution only, so last_reviewed is unchanged. |
— |
| 2026-08-17 | Restructured into the three readings — ## Business logic / ## Developer logic / ## Diagram — per the reader-theme handoff and the rewritten CONVENTIONS §8. The standalone Workflow Map page was folded in as this entry's Diagram reading, and its seven Mermaid diagrams became six hand-written HTML trees. Rule IDs, anchors and all findings are unchanged. No logic change. |
BE-3412 |
| 2026-08-17 | Initial documentation, from main (807826a) and the unmerged BE-3412-APPLY-BUSINESS-LOGIC branch (47c0845). Allocated LI-BL-INV-001..004, LI-BL-FUL-004, LI-BL-FRT-002. Recorded eight divergences/defects — three of them (D1, D2, D3) reproduced against the committed reference captures. Status draft: the logic described is not deployed. |
BE-3412 |
Field registry — ids
Inputs
| Field id | Field name | Record | Source | Type | Read / written | Used by |
|---|---|---|---|---|---|---|
QtyDemand |
Qty demand from sales order | — | Saved search 7895 | integer | read | What gets replenished, and how muchLI-BL-INV-001 |
item_id |
Item internal ID | — | Saved search 7895 | select | read | What gets replenished, and how muchLI-BL-INV-001 |
binAvailableQty |
Qty available from Bin | — | Saved search 7898 | integer | read | Whole bins, closest fitLI-BL-INV-002 |
itemallocated |
Qty allocated from sales order | — | Saved search 7898 | integer | read | What gets replenished, and how muchLI-BL-INV-001 Whole bins, closest fitLI-BL-INV-002 |
itemCBM |
CBM from Item record | — | Saved search 7898 | decimal | read | One shipment, one truckloadLI-BL-FRT-002 |
binLocation |
Bin location | — | Saved search 7898 | select | read | Overflow before BondedLI-BL-INV-003 |
approvalStatus |
Transfer Order Approval | — | Saved search 7900 | select | read | Add to an open order before raising a new oneLI-BL-FUL-004 |
custbody_total_cbm |
Total CBM | Transfer Order | NetSuite | decimal | read-written | One shipment, one truckloadLI-BL-FRT-002 |
Outputs
| Field id | Field name | Record | Source | Type | Read / written | Used by |
|---|---|---|---|---|---|---|
location |
Location | Transfer Order | NetSuite | select | written | Overflow before BondedLI-BL-INV-003 |
transferlocation |
To Location | Transfer Order | NetSuite | select | written | Add to an open order before raising a new oneLI-BL-FUL-004 |
custbody_to_approval |
Transfer Order Approval | Transfer Order | NetSuite | select | written | Add to an open order before raising a new oneLI-BL-FUL-004 |
overrideleadtimedays |
Override Lead Time (Days) | Transfer Order | NetSuite | integer | written | Overflow before BondedLI-BL-INV-003 |
trandate |
Date | Transfer Order | NetSuite | date | written | — |
custbody_total_cbm |
Total CBM | Transfer Order | NetSuite | decimal | read-written | One shipment, one truckloadLI-BL-FRT-002 |
commitmentfirm |
Commitment Confirmed | Transfer Order (line) | NetSuite | checkbox | written | — |
Hover any box to see what it means. Click to pin it. Each tree carries the rule ID it belongs to; the defects named D1–D3 are written up in the Developer reading.
The daily run
Two side channels run off this: uncovered demand emails the planner, and any failure emails the developers. Those four endpoints are everything a run produces.
One item, end to end LI-BL-INV-001
Choosing bins LI-BL-INV-002
Whole bins move. Short 1, bin holds 8 → all 8 travel. The bin is never written on the Transfer Order — only quantities. The warehouse picks the physical bin at fulfilment.
Two source lanes LI-BL-INV-003
LI-BL-FUL-004 & LI-BL-FRT-002 · From a line to a Transfer Order
Lines are only ever added — never removed, never reduced.
Writing to NetSuite
Lines carry item and quantity only — no bin, no cartons, no units. NetSuite derives the volume.
Where it breaks today
Three defects reproduced against the repository's own captured data, shown at the step each one sits on. All three are written up in the Developer reading.
Five more — including an oversized unit escaping the CBM cap, and two competing definitions of "amendable" — are in the Developer reading.