3 · Context loaded D1 queries run before fan-out
name
zone
tables
inventory_zones
returns
row
SELECT
id, name, location_id
FROM inventory_zones
WHERE id = ?
name
current_balances
tables
inventory_balance · inventory_zones
returns
rows
SELECT
item_code, quantityavailable, last_counted_at
FROM inventory_balance
WHERE location_id = (SELECT location_id
FROM inventory_zones
WHERE id = ?)
name
recent_movements
tables
transactions · inventory_zones
returns
rows
SELECT
item_code, type, qty, trandate
FROM transactions
WHERE trandate >= datetime('now','-7 days')
AND location_id = (SELECT location_id
FROM inventory_zones
WHERE id = ?)name
variance_tolerance
tables
guardrails
returns
row
SELECT
pct_threshold, dollar_threshold
FROM guardrails
WHERE name = 'inventory_variance'
6 · Fan-out targets 10 total · 3 real · 7 stub
#1compute_variance d1_write STUB
table
inventory_count_log
operation
insert
stub — not yet implemented in src/lib/workflow_runner.ts (kind d1_write hits the placeholder branch). Documented intent only.
INSERT INTO inventory_count_log (zone_id, item_code, counted_qty, system_qty, variance, counted_at)
VALUES (?,?,?,?,?,?)
#2classify_variance flag STUB
table
inventory_count_log
field
classification
value
needs_review
condition (if)
abs(variance) > tolerance.pct_threshold OR abs(variance_dollar) > tolerance.dollar_threshold
stub — not yet implemented in src/lib/workflow_runner.ts (kind flag hits the placeholder branch). Documented intent only.
#3stage_adjustments stage_proposed_action REAL
action_type
inventory_adjustment
entity_type
inventory_zone
#4hitl_approve stage_proposed_action REAL
action_type
inventory_adjustment_approval
entity_type
workflow_run
#5ns_push_adjustments ns_push STUB
NS record_type
inventoryadjustment
queue
NS_PUSH_QUEUE
on_failure
retry_3_then_alert
stub — not yet implemented in src/lib/workflow_runner.ts (kind ns_push hits the placeholder branch). Documented intent only.
#6d1_update_balances d1_write STUB
table
inventory_balance
operation
update
stub — not yet implemented in src/lib/workflow_runner.ts (kind d1_write hits the placeholder branch). Documented intent only.
UPDATE inventory_balance
SET quantityavailable=?, last_counted_at=datetime('now')
WHERE item_code=?
AND location_id=?#7kv_invalidate_inventory kv_invalidate REAL
keys
inventory:zone:?zone_id
inventory:summary
#8variance_summary_notify hitl_email_draft STUB
tool
propose_email_to_customer
mailbox
warehouse@globalfoodsolutions.co
template
weekly_variance_summary
stub — not yet implemented in src/lib/workflow_runner.ts (kind hitl_email_draft hits the placeholder branch). Documented intent only.
#9recompute_cost_basis chat_tool STUB
tool
recompute_assembly_cost_rollup
condition (if)
any_adjusted_item IN assembly_bom
stub — not yet implemented in src/lib/workflow_runner.ts (kind chat_tool hits the placeholder branch). Documented intent only.
#10reflexion_write d1_write STUB
table
reflexion_log
operation
insert
stub — not yet implemented in src/lib/workflow_runner.ts (kind d1_write hits the placeholder branch). Documented intent only.
INSERT INTO reflexion_log (workflow_run_id, entity_type, entity_id, outcome, tags)
VALUES (?,'inventory_zone',?,?,'inventory,cycle_count,variance')