# Indirect Goods Upgrade — Phase 0 Baseline and Decision Gate

Baseline captured: 11 July 2026 (Asia/Kolkata)

Related plan: `docs/indirect-goods-issue-parity-and-foc-return-upgrade-plan.md`

## 1. Scope

Phase 0 records the current production-like database position before any schema or workflow changes. No quantities, statuses or application behavior were changed while preparing this baseline.

## 2. Current row counts

| Table | Rows |
|---|---:|
| `indirect_goods` | 177 |
| `indirect_goods_inventory` | 204 |
| `indirect_goods_project_inventory` | 504 |
| `indirect_goods_incoming` | 37 |
| `indirect_goods_incoming_items` | 68 |
| `indirect_goods_requests` | 137 |
| `indirect_goods_request_items` | 657 |
| `indirect_goods_stock_movements` | 824 |
| `indirect_goods_consumption` | 1 |

## 3. Quantity and value baseline

| Metric | Baseline |
|---|---:|
| Warehouse available quantity | 178,264.48 |
| Warehouse inventory value | 68,779.69 |
| Project available quantity | 23,829.02 |
| Project consumed quantity | 2.00 |
| Project inventory value | 213,387.16 |
| Requested quantity | 24,613.02 |
| Released quantity | 23,831.02 |
| Remaining request balance | 782.00 |
| Consumption-record quantity | 2.00 |

## 4. Status baseline

### Requests

| Status | Rows |
|---|---:|
| `approved` | 4 |
| `partially_issued` | 15 |
| `issued` | 118 |

### Incoming receipts

| Status | Rows |
|---|---:|
| `completed` | 37 |

## 5. Movement baseline

| Movement type | Rows | Quantity |
|---|---:|---:|
| `in` | 200 | 201,993.50 |
| `out` | 622 | 23,831.02 |
| `adjustment` | 1 | 102.00 |
| `consumption` | 1 | 2.00 |

The sole consumption record has type `consumed` and quantity 2.00.

## 6. Consistency results

All checks below passed:

- Negative warehouse inventory rows: 0
- Negative project inventory rows: 0
- Warehouse inventory rows missing division: 0
- Project inventory rows missing division: 0
- Invalid request balances: 0
- Duplicate warehouse inventory business keys: 0
- Duplicate project inventory business keys: 0
- Completed incoming receipts assigned directly to a project: 0
- Released quantity minus project available and consumed quantity: 0.00
- Total `out` movement quantity equals total released quantity: 23,831.02
- Project available 23,829.02 plus consumed 2.00 equals released 23,831.02

This is a clean starting point for fulfillment backfill. The planned backfill must preserve these totals exactly.

## 7. Approved technical invariants

The implementation must continuously preserve:

```text
requested = released + request balance
23,831.02 released = 23,829.02 project available + 2.00 consumed
```

Future FOC-only returns will extend the second reconciliation to:

```text
released = project available + consumed + returned to indirect FOC + transferred out
```

## 8. Phase 1 decision gate

The following business decisions require confirmation before schema implementation:

1. **Issue methods:** implement warehouse inventory, supplier direct delivery and indirect FOC issue in this release.
2. **Project transfer:** defer indirect project-to-project transfer to a later release.
3. **Return destination:** every indirect return, including unopened/serviceable material, remains in indirect FOC and never returns to normal warehouse inventory.
4. **FOC valuation:** retain original source cost for audit/recoverable-value reporting, while treating FOC issue cost as zero in project issue valuation.
5. **Return authority:** creator submits; warehouse inspector verifies condition; authorized warehouse approver completes; reversals require elevated permission and reason.
6. **Consumption:** keep consumption/write-off for goods actually consumed or disposed at site. Physically returned goods must use the FOC-return workflow.
7. **Deployment:** additive migrations and feature flags first; no destructive schema cleanup during initial rollout.

These are the recommended defaults from the architecture review. Phase 1 begins only after they are accepted or amended.

## 9. Phase 0 exit checklist

- [x] Current indirect tables identified
- [x] Row counts captured
- [x] Quantity and value totals captured
- [x] Request and receipt statuses captured
- [x] Negative and missing-division checks completed
- [x] Duplicate business-key checks completed
- [x] Released/project/consumption reconciliation completed
- [x] Initial risk register documented in the upgrade plan
- [x] Business decisions accepted or amended (approved 11 July 2026)
- [ ] Deployment window and rollback owner identified before production cutover

Phase 0 business and technical gates are complete. Deployment ownership remains a Phase 13 cutover requirement.
