# Quickstart: Feature 056 — Remove Legacy BulkOperationRun

## Prerequisites

- Local dev via Laravel Sail
- Database migrations up to date

## Common commands (Sail-first)

- Boot: `./vendor/bin/sail up -d`
- Run migrations: `./vendor/bin/sail artisan migrate`
- Run targeted tests (Ops UX): `./vendor/bin/sail artisan test tests/Feature/OpsUx`
- Run a single test file: `./vendor/bin/sail artisan test tests/Feature/OpsUx/BulkEnqueueIdempotencyTest.php`
- Run legacy guard test: `./vendor/bin/sail artisan test tests/Feature/Guards/NoLegacyBulkOperationsTest.php`
- Run queue worker (local): `./vendor/bin/sail artisan queue:work --verbose --tries=3 --timeout=300`
- Format (required): `./vendor/bin/pint --dirty`

## Validation (targeted)

- Ops UX suite: `./vendor/bin/sail artisan test tests/Feature/OpsUx`
- Legacy reference guard: `./vendor/bin/sail artisan test tests/Feature/Guards/NoLegacyBulkOperationsTest.php`

## Ops commands

- Preview adapter reconciliation (dry run): `./vendor/bin/sail artisan ops:reconcile-adapter-runs --dry-run=true`
- Apply adapter reconciliation: `./vendor/bin/sail artisan ops:reconcile-adapter-runs --dry-run=false`

## What to build (high level)

- Replace all legacy bulk-run usage with the canonical OperationRun run model.
- Ensure all bulk actions are enqueue-only and visible in Monitoring → Operations.
- Enforce per-target scope concurrency limit (config-driven, default=1).
- Enforce bulk idempotency via deterministic fingerprinting.
- Remove legacy BulkOperationRun stack (model/service/table/UI).
- Add guardrails/tests to prevent reintroduction.

## Where to look first

- Legacy stack:
  - `app/Models/BulkOperationRun.php`
  - `app/Services/BulkOperationService.php`
  - `database/migrations/*bulk_operation_runs*`

- Canonical run stack:
  - `app/Models/OperationRun.php`
  - `app/Services/OperationRunService.php`
  - `app/Support/OperationCatalog.php`
  - `app/Support/OpsUx/OperationSummaryKeys.php`

- Locking patterns to reuse:
  - `app/Services/Inventory/InventoryConcurrencyLimiter.php`
  - `app/Services/Inventory/InventorySyncService.php`
