A receiving workflow often has two facts that should not be collapsed: what the supplier expected and what the warehouse counted. If those values differ, changing available immediately can turn an unresolved observation into an order allocation. A small explicit state transition makes the review rule visible and testable.
The example below does not connect to a WMS or Shopify. It validates an application-level handoff record: a discrepancy can move to released only after a reviewer and a release condition are present. A production system would still need persistence, authorization checks, and transaction handling around the transition.
const transitions = { received: new Set(['counted', 'discrepancy']), counted: new Set(['released', 'discrepancy']), discrepancy: new Set(['recounted', 'released']), recounted: new Set(['released', 'discrepancy']), released: new Set(), }; function move(record, next, review = {}) { if (!transitions[record.state]?.has(next)) { throw new Error(`invalid transition: ${record.state} -> ${next}`); } if (next === 'released') { if (!review.owner || !review.condition || !review.evidenceRef) { throw new Error('release requires owner, condition, and evidenceRef'); } } return { ...record, state: next, review: next === 'released' ? { owner: review.owner, condition: review.condition, evidenceRef: review.evidenceRef } : record.review ?? null, }; } const item = { receipt: 'R-104', sku: 'SKU-A', state: 'discrepancy' }; try { move(item, 'released', { owner: 'shift lead' }); throw new Error('expected incomplete review to fail'); } catch (error) { if (error.message !== 'release requires owner, condition, and evidenceRef') throw error; } const released = move(item, 'released', { owner: 'shift lead', condition: 'second count matches physical units', evidenceRef: 'count-sheet-104b', }); if (released.state !== 'released' || released.review.evidenceRef !== 'count-sheet-104b') { throw new Error('release record was not preserved'); } console.log('ok: incomplete release blocked; reviewed release recorded'); Save this as hold.js and run node hold.js. The first attempt must fail for the missing review fields; the second records the owner, condition, and evidence reference. The key property is not that the state machine is sophisticated. It is that the code refuses to convert a counted discrepancy into a release without the information a later shift needs.
This boundary is useful whether a seller operates Shopify 3PL flows, drop shipping, or a broader shopify fulfillment process. International Fulfillment for Folligen is only a search phrase in this discussion; it does not imply a YX customer or deployment. A buyer comparing china fulfillment or china 3PL providers can ask whether receiving holds, reviewer identity, and release evidence remain distinguishable in the inventory record.
For documented inventory record scope, see the warehouse inventory service page.
Photo: Cartons stored on blue warehouse shelving beside a clear aisle.
