3 · Context loaded D1 queries run before fan-out
name
assembly
tables
assemblies
returns
row
SELECT
id, itemid, displayname, quantityavailable, reorder_point
FROM assemblies
WHERE id = ?
name
assembly_bom
tables
assembly_bom
returns
rows
SELECT
line_key, item_code, qty, uom, estimated_cost
FROM assembly_bom
WHERE assembly_id = ?
name
inventory_balance
tables
inventory_balance · assembly_bom
returns
rows
SELECT
item_code, location_id, quantityavailable, reserved_qty
FROM inventory_balance
WHERE item_code IN (SELECT item_code
FROM assembly_bom
WHERE assembly_id = ?)
name
recent_builds
tables
transactions
returns
rows
SELECT
id, trandate, total_cost, actual_qty, planned_qty
FROM transactions
WHERE type='Build'
AND assembly_id=?
ORDER BY trandate DESC
LIMIT 10
name
labor_capacity
tables
labor_schedule
returns
rows
SELECT
date(start_at) AS day, SUM(duration_min)/60.0 AS hours
FROM labor_schedule
WHERE start_at >= date('now')
GROUP BY day6 · Fan-out targets 9 total · 3 real · 6 stub
#1wo_create stage_proposed_action REAL
action_type
workorder_create
entity_type
workorder
#2bom_reserve kv_invalidate REAL
keys
inventory:assembly:?assembly_id
inventory:bom:?assembly_id
#3component_issue 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 = quantityavailable - ?, reserved_qty = reserved_qty - ?
WHERE item_code = ?
AND location_id = ?
#4build_complete d1_write STUB
table
transactions
operation
insert
stub — not yet implemented in src/lib/workflow_runner.ts (kind d1_write hits the placeholder branch). Documented intent only.
INSERT INTO transactions (type, assembly_id, trandate, qty, status)
VALUES ('Build', ?, datetime('now'), ?, 'completed')#5wo_close stage_proposed_action REAL
action_type
workorder_close
entity_type
workorder
#6variance_audit flag STUB
table
proposed_actions
field
action_type
value
wo_variance_review
condition (if)
abs((actual_cost - estimated_cost)/estimated_cost) > 0.05
stub — not yet implemented in src/lib/workflow_runner.ts (kind flag hits the placeholder branch). Documented intent only.
#7finished_goods_increment 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 = quantityavailable + ?
WHERE item_code = (SELECT itemid
FROM assemblies
WHERE id = ?)
AND location_id = ?
#8notify_warehouse hitl_email_draft STUB
tool
propose_email_to_customer
mailbox
warehouse@globalfoodsolutions.co
template
wo_completion_notice
stub — not yet implemented in src/lib/workflow_runner.ts (kind hitl_email_draft hits the placeholder branch). Documented intent only.
#9reflexion_log_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 (?, 'workorder', ?, ?, 'work_order,build,variance')