# TANRAIL ONE — Phase 3.2 Architecture Review

## 1. Objective
To critically evaluate the proposed Inventory Architecture against the strict TANRAIL ONE Core principles before implementation.

## 2. Findings

### 1. [MEDIUM] Missing Concept: Cost Tracking
- **Observation:** The architecture perfectly tracks *quantities*, but intentionally omits *unit cost* (FIFO/LIFO/Average Costing) at the time of movement.
- **Impact:** Inventory valuations rely purely on the Catalog `base_price`. If the procurement price fluctuates, historical valuation is impossible.
- **Verdict:** Acceptable for now. Advanced inventory accounting (FIFO layers) is highly complex and typically belongs to an Advanced Finance/Procurement extension, not the baseline Core Inventory quantity tracker.

### 2. [CRITICAL] Unresolved Human Decision: Negative Stock
- **Observation:** Operations stall completely if a physical item exists but hasn't been entered into the system (Option A), vs. Data integrity is corrupted if we allow negative balances (Option B).
- **Verdict:** Human executive decision is strictly required before writing the `InventoryService` engine.

### 3. [LOW] Scalability Risk: Polymorphic References
- **Observation:** `StockMovement` uses polymorphic references (`reference_type`, `reference_id`). As the ledger grows to millions of rows, reverse-querying from an `Order` to its `StockMovement` can be slow without compound indexes.
- **Action Required:** Ensure compound indexing `['reference_type', 'reference_id']` is explicitly defined in the migration.

### 4. [PASS] Multi-Business Extensibility
- **Observation:** The architecture was tested against Restaurant, Catering, Water Distribution, and Transport scenarios. 
- **Verdict:** 100% Core stability. No business-specific logic leaked into the design.

## 3. Summary
The architecture is mathematically sound, highly secure (re-using Phase 3.1 scopes), and strictly business-agnostic.
