====================================================================== CONSTITUTION — IMMUTABLE INVARIANTS (read TWICE — first and last) ====================================================================== Before generating ANYTHING, output this counting line exactly: > I count **N=8** business entities to preserve, **M=13** business fields, **R=7** business rules. > The N entities are: AdvancedShipmentNotice, Order, Item, DoorMaster, ReceivingConfirmationReport, Vendor, Container, AsnLineItem ENTITY PRESERVATION CONTRACT (HARD — violations cause rejection): 1. The output schema MUST contain at least N=8 business tables — one for each named entity above. DO NOT merge, rename, alias, omit, or invent-replacement-for any of these 8 entities. 2. For each entity, EVERY field listed in `DETECTED ENTITIES` MUST become a column in that entity's table. If a field's name is awkward in SQL, RENAME-WITH-COMMENT (e.g., `asn_id VARCHAR(255) -- was: asnId`) — never silently drop it. 3. For each business rule in `DETECTED BUSINESS RULES`, you MUST emit EITHER (a) a CHECK constraint on the relevant column, OR (b) a `COMMENT ON COLUMN x.y IS 'RULE-XXX: ...'` annotation. NEVER bury rules in `COMMENT ON TABLE` only — the column comment carries the contract. 4. The Mantara auto-added menus (User Management, Notifications, Configuration) MUST each have ≥2 submenus. NO 1-submenu menus. 5. NO PostgreSQL `CREATE TYPE AS ENUM`. Use `cfg_*` lookup tables per Mantara v8 rules — every status/type/category column references a cfg_* table via VARCHAR(30) FK. ====================================================================== # ASN Workflow Build a Postgres schema for **ASN Workflow**, a web application in the logistics domain. ASN Workflow (logistics) **Primary roles:** warehouse_user, WarehouseOperator. ## Structured UI Hierarchy (Type S) Each Menu groups related screens; each Submenu maps to one entity (one table); Fields list business columns. Apply standard Mantara v8 rules: one unique submenu_id per table, `cfg_*` lookup tables instead of PostgreSQL ENUMs, and a final Configuration menu for all lookup tables. **HARD MENU DENSITY CONSTRAINT** (caught the Step-4 → Step-5 round-trip in 4 of 13 errors last run): every menu MUST have ≥2 submenus. If you add new menus (User Management, Notifications, Configuration, etc.), each must have ≥2 distinct submenus — DO NOT create a menu with only 1 submenu. If a menu would have only 1 submenu, either merge it with a sibling menu or split its single table into 2 related tables (e.g., User Directory + Roles & Permissions; Notifications + Notification Settings). Menu: Core Operations Submenu: Advanced Shipment Notice Master Table: advanced_shipment_notice Fields: asnId (VARCHAR(255), NOT NULL, UNIQUE), status (VARCHAR(30) FK to aw.cfg_advanced_shipment_notice_status.code, NOT NULL), supplierId (UUID, NOT NULL) Description: An ASN sent by a supplier announcing inbound goods. Relationships: many-to-one → Supplier (FK: supplierId) Submenu: Door Master Master Table: door_master Fields: doorNumber (VARCHAR(255), NOT NULL) Description: Master table for door assignments. Submenu: Container Master Table: container Fields: containerNumber (VARCHAR(255), NOT NULL, UNIQUE) Description: Represents a container used in ASN creation. Menu: Master Data & Catalog Submenu: Order Master Table: order Fields: poNumber (VARCHAR(255), NOT NULL) Description: A purchase order related to the ASN. Submenu: Receiving Confirmation Report Master Table: receiving_confirmation_report Fields: rcrId (VARCHAR(255), NOT NULL), skuDetails (VARCHAR(255), NOT NULL) Description: Document generated after ASN closure. Relationships: one-to-one → AdvancedShipmentNotice (FK: asnId) Submenu: Asn Line Item Master Table: asn_line_item Fields: poNumber (VARCHAR(255), NOT NULL), upcNumber (VARCHAR(255), NOT NULL) Description: Line items within an ASN. Relationships: many-to-one → AdvancedShipmentNotice (FK: asnId) Menu: Reports & History Submenu: Item Master Table: item Fields: skuNumber (VARCHAR(255), NOT NULL), upcNumber (VARCHAR(255), NOT NULL) Description: Stock Keeping Unit details. Submenu: Vendor Master Table: vendor Fields: vendorNumber (VARCHAR(255), NOT NULL) Description: Details of the vendor supplying the goods. === FSD ANALYSIS (Pre-Parsed Context) === DETECTED MODULES (map these to menus): 1. Core Operations 2. Master Data & Catalog 3. Reports & History 4. User Management — submenus: User Directory, Roles & Permissions 5. Notifications & Audit — submenus: Notifications, Audit Log 6. Configuration — multiple cfg_* lookup tables (always last; ≥2 submenus required) DETECTED FEATURES (map these to submenus, one per table): 1. Advanced Shipment Notice Master (under 'Core Operations') 2. Door Master Master (under 'Core Operations') 3. Container Master (under 'Core Operations') 4. Order Master (under 'Master Data & Catalog') 5. Receiving Confirmation Report Master (under 'Master Data & Catalog') 6. Asn Line Item Master (under 'Master Data & Catalog') 7. Item Master (under 'Reports & History') 8. Vendor Master (under 'Reports & History') DETECTED ENTITIES (each MUST have its own table + unique submenu_id): - AdvancedShipmentNotice: id, asnId, status, supplierId - Order: id, poNumber - Item: id, skuNumber, upcNumber - DoorMaster: id, doorNumber - ReceivingConfirmationReport: id, rcrId, skuDetails - Vendor: id, vendorNumber - Container: id, containerNumber - AsnLineItem: id, poNumber, upcNumber DETECTED RELATIONSHIPS (implement as foreign keys): - AdvancedShipmentNotice -> Supplier (many-to-one, FK: supplierId) - ReceivingConfirmationReport -> AdvancedShipmentNotice (one-to-one, FK: asnId) - AsnLineItem -> AdvancedShipmentNotice (many-to-one, FK: asnId) DETECTED ENUM CANDIDATES (create as cfg_* lookup tables under Configuration menu, NOT PostgreSQL ENUM types): - cfg_advanced_shipment_notice_status: unreserved | reserved | at_door | closed DETECTED BUSINESS RULES (implement as CHECK constraints or trigger logic): - AsnLineItem: An ASN must contain at least one line item before it can be submitted. - AdvancedShipmentNotice: All SKUs must be reserved to move to Reserved state. - AdvancedShipmentNotice: All SKUs must be processed to mark ASN as completed. - AdvancedShipmentNotice: A door must be assigned before ASN can move to 'At Door' state. - ReceivingConfirmationReport: RCR can only be printed after ASN is closed. - AdvancedShipmentNotice: ASN can be created in two ways: Standard ASN via Purchase Orders and Local ASN Vendor based. - AdvancedShipmentNotice: No slot is assigned yet, waiting for reservation. PRIORITY INDICATORS (P1 actions — entry-point operations, must be supported in MVP): - create_asn, create_local_asn === END FSD ANALYSIS === ## NFR Hints (ISO/IEC 25010:2023) App type: web **Security:** - TLS 1.2+ enforced; HSTS preload-eligible - OWASP Top 10 mitigations: input validation, parameterized queries, CSRF tokens - Session cookies: HttpOnly + Secure + SameSite=Lax - Sensitive PII fields encrypted at rest (AES-256) and in transit **Reliability:** - Target availability ≥ 99.5% (43h downtime/year) - Graceful degradation for read-only mode if write path fails **Maintainability:** - Test coverage ≥ 70% on business logic modules - Module boundaries follow CIR entity grouping **Performance:** - p95 page load < 2.5s on 4G - p95 API response < 500ms for read endpoints - Core Web Vitals: LCP < 2.5s, FID < 100ms, CLS < 0.1 ## PRD Narrative Context The full PRD is included below for additional context. The Type S hierarchy and FSD ANALYSIS above are authoritative. --- # ASN Workflow — Product Requirements **Domain:** logistics · **Type:** web · **Generated:** 2026-05-06T08:08:19+00:00 · **Run:** `1778054697133-pdf` · **Spec version:** `0.2.0` ## Goal This application supports core operations in logistics. It exposes the entities, workflows, and user roles documented below. ## Glossary _33 domain terms (auto-extracted from CIR; review for accuracy)._ | Term | Kind | Definition | Source | |------|------|------------|--------| | `AdvancedShipmentNotice` | entity | An ASN sent by a supplier announcing inbound goods. | ENT-001 | | `Advanced Shipment Notice` | entity | An ASN sent by a supplier announcing inbound goods. | ENT-001 | | `Order` | entity | A purchase order related to the ASN. | ENT-002 | | `PurchaseOrder` | entity | Alias for `Order`. A purchase order related to the ASN. | ENT-002 | | `Item` | entity | Stock Keeping Unit details. | ENT-003 | | `Sku` | entity | Alias for `Item`. Stock Keeping Unit details. | ENT-003 | | `DoorMaster` | entity | Master table for door assignments. | ENT-004 | | `Door Master` | entity | Master table for door assignments. | ENT-004 | | `ReceivingConfirmationReport` | entity | Document generated after ASN closure. | ENT-005 | | `Receiving Confirmation Report` | entity | Document generated after ASN closure. | ENT-005 | | `Vendor` | entity | Details of the vendor supplying the goods. | ENT-006 | | `Container` | entity | Represents a container used in ASN creation. | ENT-007 | | `AsnLineItem` | entity | Line items within an ASN. | ENT-008 | | `Asn Line Item` | entity | Line items within an ASN. | ENT-008 | | `warehouse_user` | role | User responsible for managing ASNs and processing shipments. | | | `WarehouseOperator` | role | Handles the creation and processing of ASNs. | | | `create_asn` | action | User action on `Create ASN (Standard)`: Opens ASN creation modal | | | `reserve_slots` | action | User action on `Unreserved ASN List`: Reserves storage slots for SKUs | | | `print_rcr` | action | User action on `Closed ASN View`: Prints Receiving Confirmation Report | | | `create_local_asn` | action | User action on `Create Local ASN`: Opens local ASN creation modal | | | `assign_door` | action | User action on `Reserved ASN View`: ASN moved to 'At Door' state | | | `mark_asn_completed` | action | User action on `At Door View`: ASN marked as completed and moved to Closed state | | | `ASN Expanded (Multiple SKUs)` | screen | UI screen: ASN Expanded (Multiple SK Us). | | | `At Door View` | screen | UI screen: At Door View. | | | `Closed ASN View` | screen | UI screen: Closed ASN View. | | | `Create ASN (Standard)` | screen | UI screen: Create ASN (Standard). | | | `Create Local ASN` | screen | UI screen: Create Local ASN. | | | `RCR Generation` | screen | UI screen: RCR Generation. | | | `RCR Print Preview` | screen | UI screen: RCR Print Preview. | | | `Reserved ASN View` | screen | UI screen: Reserved ASN View. | | | `Unreserved ASN List` | screen | UI screen: Unreserved ASN List. | | | `ASN` | acronym | Acronym `ASN` referenced in domain content. (Definition unresolved — see source CIR.) | | | `RCR` | acronym | Acronym `RCR` referenced in domain content. (Definition unresolved — see source CIR.) | | ## Entities _8 entities defined._ ### `ENT-001` — AdvancedShipmentNotice _table:_ `advanced_shipment_notice` · conf 0.98 An ASN sent by a supplier announcing inbound goods. | Field | Type | Required | Unique | PK | Source | |-------|------|----------|--------|-----|--------| | `id` | uuid | ✓ | ✓ | ✓ | synthesized | | `asnId` | string | ✓ | ✓ | | vision | | `status` | enum | ✓ | | | vision | | `supplierId` | uuid | ✓ | | | vision | | `createdAt` | timestamptz | ✓ | | | vision | | `updatedAt` | timestamptz | ✓ | | | synthesized | **Relationships:** - many-to-one → `Supplier` (FK: `supplierId`, cascade: restrict) ### `ENT-002` — Order _table:_ `order` · conf 0.90 · aliases: PurchaseOrder A purchase order related to the ASN. | Field | Type | Required | Unique | PK | Source | |-------|------|----------|--------|-----|--------| | `id` | uuid | ✓ | ✓ | ✓ | synthesized | | `poNumber` | string | ✓ | | | vision | ### `ENT-003` — Item _table:_ `item` · conf 0.90 · aliases: Sku Stock Keeping Unit details. | Field | Type | Required | Unique | PK | Source | |-------|------|----------|--------|-----|--------| | `id` | uuid | ✓ | ✓ | ✓ | synthesized | | `skuNumber` | string | ✓ | | | vision | | `upcNumber` | string | ✓ | | | vision | | `createdAt` | timestamptz | ✓ | | | synthesized | | `updatedAt` | timestamptz | ✓ | | | synthesized | ### `ENT-004` — DoorMaster _table:_ `door_master` · conf 0.95 Master table for door assignments. | Field | Type | Required | Unique | PK | Source | |-------|------|----------|--------|-----|--------| | `id` | uuid | ✓ | ✓ | ✓ | synthesized | | `doorNumber` | string | ✓ | | | vision | ### `ENT-005` — ReceivingConfirmationReport _table:_ `receiving_confirmation_report` · conf 0.95 Document generated after ASN closure. | Field | Type | Required | Unique | PK | Source | |-------|------|----------|--------|-----|--------| | `id` | uuid | ✓ | ✓ | ✓ | synthesized | | `rcrId` | string | ✓ | | | vision | | `skuDetails` | jsonb | ✓ | | | vision | | `createdAt` | timestamptz | ✓ | | | synthesized | | `updatedAt` | timestamptz | ✓ | | | synthesized | **Relationships:** - one-to-one → `AdvancedShipmentNotice` (ENT-001) (FK: `asnId`, cascade: restrict) ### `ENT-006` — Vendor _table:_ `vendor` · conf 0.80 Details of the vendor supplying the goods. | Field | Type | Required | Unique | PK | Source | |-------|------|----------|--------|-----|--------| | `id` | uuid | ✓ | ✓ | ✓ | synthesized | | `vendorNumber` | string | ✓ | | | vision | ### `ENT-007` — Container _table:_ `container` · conf 0.70 Represents a container used in ASN creation. | Field | Type | Required | Unique | PK | Source | |-------|------|----------|--------|-----|--------| | `id` | uuid | ✓ | ✓ | ✓ | synthesized | | `containerNumber` | string | ✓ | ✓ | | vision | ### `ENT-008` — AsnLineItem _table:_ `asn_line_item` · conf 0.90 Line items within an ASN. | Field | Type | Required | Unique | PK | Source | |-------|------|----------|--------|-----|--------| | `id` | uuid | ✓ | ✓ | ✓ | synthesized | | `poNumber` | string | ✓ | | | vision | | `upcNumber` | string | ✓ | | | vision | | `createdAt` | timestamptz | ✓ | | | synthesized | | `updatedAt` | timestamptz | ✓ | | | synthesized | **Relationships:** - many-to-one → `AdvancedShipmentNotice` (ENT-001) (FK: `asnId`, cascade: restrict) ## Entity-Relationship Diagram ```mermaid erDiagram AdvancedShipmentNotice { uuid id PK,UK string asnId UK enum status uuid supplierId timestamptz createdAt timestamptz updatedAt } Order { uuid id PK,UK string poNumber } Item { uuid id PK,UK string skuNumber string upcNumber timestamptz createdAt timestamptz updatedAt } DoorMaster { uuid id PK,UK string doorNumber } ReceivingConfirmationReport { uuid id PK,UK string rcrId jsonb skuDetails timestamptz createdAt timestamptz updatedAt } Vendor { uuid id PK,UK string vendorNumber } Container { uuid id PK,UK string containerNumber UK } AsnLineItem { uuid id PK,UK string poNumber string upcNumber timestamptz createdAt timestamptz updatedAt } AdvancedShipmentNotice }o--|| Supplier : "supplierId" ReceivingConfirmationReport ||--|| AdvancedShipmentNotice : "asnId" AsnLineItem }o--|| AdvancedShipmentNotice : "asnId" ``` ## Workflows ### `WF-001` — asn_lifecycle **States:** Create → Unreserved → Reserved → At Door → Closed → RCR **Initial state:** `Create` **Transitions:** - `Create` → `Unreserved` — trigger: ASN creation submitted - `Unreserved` → `Reserved` — trigger: all SKUs reserved (when: all_skus_reserved) - `Reserved` → `At Door` — trigger: Door assignment from Door Master - `At Door` → `Closed` — trigger: Mark Completed button (warehouse user) (when: all_skus_processed) - `Closed` → `RCR` — trigger: Print RCR button ```mermaid stateDiagram-v2 %% asn_lifecycle [*] --> Create Create --> Unreserved: ASN creation submitted Unreserved --> Reserved: all SKUs reserved [all_skus_reserved] Reserved --> At_Door: Door assignment from Door Master At_Door --> Closed: Mark Completed button (warehouse user) [all_skus_processed] Closed --> RCR: Print RCR button ``` ### `WF-002` — advancedshipmentnotice_lifecycle — bound to `AdvancedShipmentNotice` (ENT-001) **States:** unreserved → reserved → at_door → closed **Initial state:** `unreserved` > [NEEDS CLARIFICATION] Workflow has no transitions defined. ```mermaid stateDiagram-v2 %% advancedshipmentnotice_lifecycle [*] --> unreserved ``` ## Roles + Permissions ### warehouse_user User responsible for managing ASNs and processing shipments. **Visible permissions:** - create_asn - reserve_slots - assign_door - mark_asn_completed - print_rcr ### WarehouseOperator Handles the creation and processing of ASNs. **Visible permissions:** - create_asn - reserve_slots - assign_door - mark_asn_completed - print_rcr ## User Actions | Action | Trigger | Screen | Expected outcome | |--------|---------|--------|------------------| | `create_asn` | Create ASN button | Create ASN (Standard) | Opens ASN creation modal | | `reserve_slots` | Reserve Slots button | Unreserved ASN List | Reserves storage slots for SKUs | | `print_rcr` | Print RCR button | Closed ASN View | Prints Receiving Confirmation Report | | `create_local_asn` | Create Local ASN button | Create Local ASN | Opens local ASN creation modal | | `assign_door` | Assign Door button | Reserved ASN View | ASN moved to 'At Door' state | | `mark_asn_completed` | Mark Completed button | At Door View | ASN marked as completed and moved to Closed state | ## Business Rules + Validations _Each rule rendered in EARS notation (Easy Approach to Requirements Syntax)._ | ID | Rule | EARS pattern | Applies to | EARS sentence | |----|------|--------------|------------|---------------| | `RULE-001` | `min_one_line_item` | ubiquitous | AsnLineItem | The system shall ensure: An ASN must contain at least one line item before it can be submitted. | | `RULE-002` | `all_skus_reserved` | ubiquitous | AdvancedShipmentNotice | The system shall ensure: All SKUs must be reserved to move to Reserved state. | | `RULE-003` | `all_skus_processed` | ubiquitous | AdvancedShipmentNotice | The system shall ensure: All SKUs must be processed to mark ASN as completed. | | `RULE-004` | `door_assignment_required` | ubiquitous | AdvancedShipmentNotice | The system shall ensure: A door must be assigned before ASN can move to 'At Door' state. | | `RULE-005` | `rcr_print_after_closure` | event_driven | ReceivingConfirmationReport | When the relevant event occurs, the system shall RCR can only be printed after ASN is closed. | | `RULE-006` | `asn_creation_methods` | ubiquitous | AdvancedShipmentNotice | The system shall ensure: ASN can be created in two ways: Standard ASN via Purchase Orders and Local ASN Vendor based. | | `RULE-007` | `slot_assignment_required` | ubiquitous | AdvancedShipmentNotice | The system shall ensure: No slot is assigned yet, waiting for reservation. | ## Non-Functional Requirements _Keyed by **ISO/IEC 25010:2023** quality model. Defaults provided for app-type `web`. Refine in Step 5/6 as needed._ ### Functional Suitability - Functional completeness: every CIR entity has CRUD operations available to its bound role(s) (or read-only if that role lacks write permissions). - Functional correctness: outputs match acceptance criteria specified in PRD. ### Performance Efficiency - p95 page load < 2.5s on 4G - p95 API response < 500ms for read endpoints - Core Web Vitals: LCP < 2.5s, FID < 100ms, CLS < 0.1 ### Compatibility - Last 2 major versions of Chrome, Safari, Firefox, Edge ### Interaction Capability - WCAG 2.2 Level AA conformance - Keyboard-only navigation supported on all interactive elements - Screen-reader landmarks and ARIA labels on all forms - Mobile-responsive at ≥360px viewport width ### Reliability - Target availability ≥ 99.5% (43h downtime/year) - Graceful degradation for read-only mode if write path fails ### Security - TLS 1.2+ enforced; HSTS preload-eligible - OWASP Top 10 mitigations: input validation, parameterized queries, CSRF tokens - Session cookies: HttpOnly + Secure + SameSite=Lax - Sensitive PII fields encrypted at rest (AES-256) and in transit ### Maintainability - Test coverage ≥ 70% on business logic modules - Module boundaries follow CIR entity grouping ### Flexibility - Schema additions (new fields, new entities) do not break existing routes. - i18n-ready: user-facing strings extracted into resource files. ### Safety - Destructive operations require confirmation and produce audit-log entries. ## User Stories _6 actions × 2 role(s) → 6 stories (after multi-role expansion: +5 candidates, −5 collapsed). Auto-derived; refine in Step 5+ as needed._ - **`US-001`** (Priority: P1) — As a **warehouse_user** (also: WarehouseOperator), I can `create_asn` so that Opens ASN creation modal. - screen: `Create ASN (Standard)` · trigger: `Create ASN button` - **Why P1:** Entry-point action — without it, downstream workflows cannot proceed. - **Independent test:** As `warehouse_user`, perform `create_asn` on `Create ASN (Standard)` → verify: Opens ASN creation modal. - **Linked:** workflow: `WF-002` · rules: `RULE-006` - **`US-002`** (Priority: P2) — As a **warehouse_user** (also: WarehouseOperator), I can `reserve_slots` so that Reserves storage slots for SKUs. - screen: `Unreserved ASN List` · trigger: `Reserve Slots button` - **Why P2:** Mid-flow action — required for full workflow but not the entry point. - **Independent test:** As `warehouse_user`, perform `reserve_slots` on `Unreserved ASN List` → verify: Reserves storage slots for SKUs. - **Linked:** workflow: `WF-002` · rules: `RULE-007` - **`US-003`** (Priority: P3) — As a **warehouse_user** (also: WarehouseOperator), I can `print_rcr` so that Prints Receiving Confirmation Report. - screen: `Closed ASN View` · trigger: `Print RCR button` - **Why P3:** Auxiliary action — useful but not required for MVP slice. - **Independent test:** As `warehouse_user`, perform `print_rcr` on `Closed ASN View` → verify: Prints Receiving Confirmation Report. - **Linked:** workflow: `WF-002` · rules: `RULE-005` - **`US-004`** (Priority: P1) — As a **warehouse_user**, I can `create_local_asn` so that Opens local ASN creation modal. - screen: `Create Local ASN` · trigger: `Create Local ASN button` - **Why P1:** Entry-point action — without it, downstream workflows cannot proceed. - **Independent test:** As `warehouse_user`, perform `create_local_asn` on `Create Local ASN` → verify: Opens local ASN creation modal. - **Linked:** workflow: `WF-002` · rules: `RULE-006` - **`US-005`** (Priority: P2) — As a **warehouse_user** (also: WarehouseOperator), I can `assign_door` so that ASN moved to 'At Door' state. - screen: `Reserved ASN View` · trigger: `Assign Door button` - **Why P2:** Mid-flow action — required for full workflow but not the entry point. - **Independent test:** As `warehouse_user`, perform `assign_door` on `Reserved ASN View` → verify: ASN moved to 'At Door' state. - **Linked:** workflow: `WF-002` · rules: `RULE-004` - **`US-006`** (Priority: P2) — As a **warehouse_user** (also: WarehouseOperator), I can `mark_asn_completed` so that ASN marked as completed and moved to Closed state. - screen: `At Door View` · trigger: `Mark Completed button` - **Why P2:** Mid-flow action — required for full workflow but not the entry point. - **Independent test:** As `warehouse_user`, perform `mark_asn_completed` on `At Door View` → verify: ASN marked as completed and moved to Closed state. - **Linked:** workflow: `WF-002` · rules: `RULE-006` ## Out of Scope / Flagged for Review ### Open Questions [NEEDS CLARIFICATION] | ID | Severity | Category | Affected | Description | |----|----------|----------|----------|-------------| | `OQ-001` | info | action_no_role | `create_asn` | Action `create_asn` has no `_implied_role` despite 2 roles available. Assigning to first role. | | `OQ-002` | info | action_no_role | `reserve_slots` | Action `reserve_slots` has no `_implied_role` despite 2 roles available. Assigning to first role. | | `OQ-003` | info | action_no_role | `print_rcr` | Action `print_rcr` has no `_implied_role` despite 2 roles available. Assigning to first role. | | `OQ-004` | info | action_no_role | `create_local_asn` | Action `create_local_asn` has no `_implied_role` despite 2 roles available. Assigning to first role. | | `OQ-005` | info | action_no_role | `assign_door` | Action `assign_door` has no `_implied_role` despite 2 roles available. Assigning to first role. | | `OQ-006` | info | action_no_role | `mark_asn_completed` | Action `mark_asn_completed` has no `_implied_role` despite 2 roles available. Assigning to first role. | | `OQ-007` | info | workflow_unbound | `WF-001` | Workflow `asn_lifecycle` has no `bound_entity`. Step 5 cannot generate state column. | | `OQ-008` | warn | workflow_empty | `WF-002` | Workflow `advancedshipmentnotice_lifecycle` has no transitions. State machine codegen impossible. | ## Acceptance Criteria _Executable Gherkin scenarios are emitted to `acceptance.feature` alongside this PRD. The list below is the human-readable index._ **From business rules (EARS notation):** - `AC-RULE-001-1` (ubiquitous): The system shall ensure: An ASN must contain at least one line item before it can be submitted. - `AC-RULE-002-1` (ubiquitous): The system shall ensure: All SKUs must be reserved to move to Reserved state. - `AC-RULE-003-1` (ubiquitous): The system shall ensure: All SKUs must be processed to mark ASN as completed. - `AC-RULE-004-1` (ubiquitous): The system shall ensure: A door must be assigned before ASN can move to 'At Door' state. - `AC-RULE-005-1` (event_driven): When the relevant event occurs, the system shall RCR can only be printed after ASN is closed. - `AC-RULE-006-1` (ubiquitous): The system shall ensure: ASN can be created in two ways: Standard ASN via Purchase Orders and Local ASN Vendor based. - `AC-RULE-007-1` (ubiquitous): The system shall ensure: No slot is assigned yet, waiting for reservation. **From workflow transitions (EARS event-driven):** - `AC-WF-001-1`: When `ASN creation submitted` occurs while `asn_lifecycle` is in state `Create`, the system shall transition `asn_lifecycle` to state `Unreserved`. - `AC-WF-001-2`: When `all SKUs reserved` occurs while `asn_lifecycle` is in state `Unreserved` and all_skus_reserved, the system shall transition `asn_lifecycle` to state `Reserved`. - `AC-WF-001-3`: When `Door assignment from Door Master` occurs while `asn_lifecycle` is in state `Reserved`, the system shall transition `asn_lifecycle` to state `At Door`. - `AC-WF-001-4`: When `Mark Completed button (warehouse user)` occurs while `asn_lifecycle` is in state `At Door` and all_skus_processed, the system shall transition `asn_lifecycle` to state `Closed`. - `AC-WF-001-5`: When `Print RCR button` occurs while `asn_lifecycle` is in state `Closed`, the system shall transition `asn_lifecycle` to state `RCR`. --- _Generated by Step 4 (CIR → PRD) from `enriched_cir.json`. Source: /home/ubuntu/dpg/pipeline/step-02-prd-generation/mantara/runs/1778054697133-pdf/cir/vision_extract.json_ --- ====================================================================== CONSTITUTION (REPEATED — these invariants override any conflicting guidance above): ====================================================================== Final reminder before you emit JSON: • Count line MUST be: "I count N=8 entities, M=13 fields, R=7 rules." • Tables array MUST contain ≥8 business tables • Tables for these 8 entities are NON-NEGOTIABLE: AdvancedShipmentNotice, Order, Item, DoorMaster, ReceivingConfirmationReport, Vendor, Container, AsnLineItem • Every field from DETECTED ENTITIES → column (rename-with-comment OK; silent drop FORBIDDEN) • Every rule from DETECTED BUSINESS RULES → `CHECK (...)` OR `COMMENT ON COLUMN x.y IS 'RULE-NNN: ...'` • No 1-submenu menus; no `CREATE TYPE AS ENUM` ======================================================================