New assembly product enters the system. Cascade: BOM cost rollup, NS item record, NS BOM record, items index, spec_items entry, spec sheet generation, brand routing, bid eligibility flag, customer programs that should price it, pricing pipeline registration.
manual["spec_sheet_upload","intake_form"]| name | required | type / hint |
|---|---|---|
item_code | required | — |
brand | required | — |
item_name | required | — |
description | required | — |
category | required | — |
sub_category | required | — |
upc | required | — |
mpn | optional | — |
allergen_facts | optional | — |
usda_k12_info | optional | — |
weight | optional | — |
cases_per_pallet | optional | — |
ingredients | optional | — |
vendor_costs[] | required | — |
bom_components[] | optional | — |
is_assembly | optional | — |
existing_item_by_upcitemsSELECT id, itemid FROM items WHERE upccode=? LIMIT 1
existing_specspec_itemsSELECT id FROM spec_items WHERE item_code=?
brand_rulesbrand_routing_rulesSELECT * FROM brand_routing_rules WHERE brand=?
shared_brand_customerspricing_master · spec_itemsSELECT DISTINCT customer_id FROM pricing_master WHERE item_code IN (SELECT item_code FROM spec_items WHERE brand=?)
| check | rule | severity |
|---|---|---|
item_code_unique | existing_item_by_upc IS NULL AND existing_spec IS NULL | block |
allergens_present | allergen_facts IS NOT NULL | warn |
vendor_cost_provided | vendor_costs.length > 0 | warn |
bom_complete_if_assembly | NOT is_assembly OR bom_components.length > 0 | block |
Risk level 4 ≥ 3 — runner stages a proposed_actions row before fan-out runs. Mike must approve in proposed-actions.html before any side-effect step executes (real or stub).
workflow_new_assembly_item (proposal envelope)workflow:new_assembly_item:run_<run_id>write_spec_items d1_write STUB["INSERT INTO spec_items (...)","INSERT INTO spec_versions (spec_item_id, changed_field=created, new_value=full_json)"]src/lib/workflow_runner.ts (kind d1_write hits the placeholder branch at line ~340 and emits step status 'stub'). Documented intent only.write_items d1_write STUBwrite_spec_items["INSERT INTO items shell"]src/lib/workflow_runner.ts (kind d1_write hits the placeholder branch at line ~340 and emits step status 'stub'). Documented intent only.recompute_assembly chat_tool STUBrecompute_assembly_cost_rollupis_assemblysrc/lib/workflow_runner.ts (kind chat_tool hits the placeholder branch at line ~340 and emits step status 'stub'). Documented intent only.write_ns_item ns_push STUBitemNS_PUSH_QUEUEretry_3_then_alertsrc/lib/workflow_runner.ts (kind ns_push hits the placeholder branch at line ~340 and emits step status 'stub'). Documented intent only.write_ns_bom ns_push STUBbomNS_PUSH_QUEUEis_assemblysrc/lib/workflow_runner.ts (kind ns_push hits the placeholder branch at line ~340 and emits step status 'stub'). Documented intent only.generate_spec_sheet http_call STUB/api/spec/generate["R2 artifact at specs/{item_code}.pdf"]src/lib/workflow_runner.ts (kind http_call hits the placeholder branch at line ~340 and emits step status 'stub'). Documented intent only.pricing_eligibility d1_write STUB["INSERT pricing_master rows for matching customer_programs"]src/lib/workflow_runner.ts (kind d1_write hits the placeholder branch at line ~340 and emits step status 'stub'). Documented intent only.customer_notification hitl_email_draft STUBpropose_email_to_customershared_brand_customers.length > 0src/lib/workflow_runner.ts (kind hitl_email_draft hits the placeholder branch at line ~340 and emits step status 'stub'). Documented intent only.| id | action | source |
|---|---|---|
runner_log_run | INSERT into workflow_run_log (run_id, workflow_type, status, started_at, completed_at, summary_json) | runner automatic |
runner_reflexion | INSERT into reflexion_log (tags=new_assembly_item, run_id, narrative) | runner automatic (reflexion_enabled=1) |
log_run | INSERT workflow_runs | declared in contract |
reflexion | INSERT reflexion_log with tags=new_spec,brand:?,category:? | declared in contract |
corpus_reindex | queue: catalog/reindex | declared in contract |
workflow_verify_results (pending — verify cron not yet wired)spec_persistedSELECT id FROM spec_items WHERE item_code=?
items_shell_createdSELECT id FROM items WHERE itemid=?
ns_item_reflectsSELECT id FROM items WHERE itemid=? AND lastmodifieddate > ?
assembly_rollup_presentSELECT id FROM assembly_cost_rollup WHERE assembly_id=(SELECT id FROM spec_items WHERE item_code=?) AND status='active'
spec_pdf_present2linear2000true| system | table / resource | action | status | source |
|---|---|---|---|---|
| D1 | workflow_run_log | INSERT (run summary) | REAL | runner automatic |
| D1 | reflexion_log | INSERT (tags=new_assembly_item) | REAL | runner automatic |
| Event | workflow.completed (or workflow.failed) | fire | REAL | runner automatic |
| D1 | workflow_verify_results | INSERT pending × 5 | REAL | runner verify staging |
| D1 | proposed_actions | INSERT (HITL gate envelope) | REAL | runner HITL gate |
| D1 | unknown | write | STUB | fan-out #1 (write_spec_items) |
| D1 | unknown | write | STUB | fan-out #2 (write_items) |
| Chat tool | recompute_assembly_cost_rollup | invoke (side_effects=unknown) | STUB | fan-out #3 (recompute_assembly) |
| NetSuite (via NS_PUSH_QUEUE) | item | push | STUB | fan-out #4 (write_ns_item) |
| NetSuite (via NS_PUSH_QUEUE) | bom | push | STUB | fan-out #5 (write_ns_bom) |
| Worker HTTP | POST /api/spec/generate | invoke | STUB | fan-out #6 (generate_spec_sheet) |
| D1 | unknown | write | STUB | fan-out #7 (pricing_eligibility) |
| D1 | proposed_actions | INSERT (email draft via propose_email_to_customer) | STUB | fan-out #8 (customer_notification) |