# Indirect Goods Upgrade — Phase 3 Backfill Completion

Completed: 11 July 2026

## Outcome

Historic indirect-goods issues now have fulfillment and source-allocation provenance. Existing stock, request and consumption quantities were not changed.

## Backfill command

`indirect-goods:backfill-fulfillments`

The command requires exactly one explicit mode:

- `--dry-run`: executes the complete backfill and rolls it back.
- `--commit`: persists the verified backfill.
- `--request=<id>`: optional request-scoped diagnostic/backfill.

The command is idempotent through deterministic fulfillment keys and cumulative consumption allocation.

## Dry-run result

| Metric | Result |
|---|---:|
| Released request items mapped | 615 |
| Fulfillments simulated | 615 |
| Source allocations simulated | 622 |
| Existing movements linked | 622 |
| Consumption records allocated | 1 |
| Division summaries simulated | 187 |
| Exceptions | 0 |
| Reconciliation variance | 0.0000 |

After dry-run rollback, fulfillment, allocation and division-summary tables were verified to contain zero rows.

## Committed result

| Metric | Result |
|---|---:|
| Fulfillments created | 615 |
| Fulfillment quantity | 23,831.0200 |
| Allocations created | 622 |
| Allocation quantity | 23,831.0200 |
| Consumption allocated | 2.0000 |
| Historic OUT movements linked | 622 of 622 |
| Unlinked historic OUT movements | 0 |
| Division summary rows | 187 |
| Exceptions | 0 |

## Idempotency verification

The committed command was run a second time:

- Existing fulfillments detected: 615
- New fulfillments created: 0
- New allocations created: 0
- New consumption allocations: 0
- Exceptions: 0
- Reconciliation variance: 0.0000

## Reconciliation after commit

| Metric | Result |
|---|---:|
| Warehouse available | 178,264.48 |
| Project available | 23,829.02 |
| Project consumed | 2.00 |
| Released | 23,831.02 |
| Request balance | 782.00 |
| Returned to FOC | 0.00 |
| Transferred out | 0.00 |
| Negative warehouse rows | 0 |
| Negative project rows | 0 |
| Negative FOC rows | 0 |
| Over-accounted fulfillments | 0 |
| Over-accounted allocations | 0 |
| Project reconciliation variance | 0.0000 |

## Backfilled provenance

Each historic released request line now has:

- one fulfillment record;
- one or more allocations reflecting its historic OUT movements;
- request, item, project, division and invoice linkage;
- source warehouse inventory where identifiable;
- destination project inventory;
- weighted source cost;
- original movement IDs in audit metadata;
- linked movement foreign keys and source/destination ledger information.

The historic consumption quantity is attached to the relevant allocation and fulfillment, preventing that quantity from later being returned as unused stock.

## Phase gate

Phase 3 is complete. Phase 4 may connect warehouse indirect issues to `IndirectGoodsIssueService::issueWarehouse()`. Supplier direct delivery, FOC issue and return routes remain disabled until their dedicated phases.
