# Quickstart: Provider Connection Full Cutover (Spec 081)

**Branch**: `081-provider-connection-cutover`  
**Spec**: [specs/081-provider-connection-cutover/spec.md](spec.md)

This quickstart is for validating the cutover implementation once tasks are executed.

## Prerequisites

- Docker + Laravel Sail installed.
- App dependencies installed (`vendor/bin/sail composer install`).

## Run the backfill (Microsoft defaults)

Run the idempotent backfill command (introduced by this feature) to ensure each managed tenant has a Microsoft default provider connection:

- `vendor/bin/sail artisan tenantpilot:provider-connections:backfill-microsoft-defaults --no-interaction`

Expected behavior:

- Does not create duplicates when re-run.
- If exactly one Microsoft connection exists and none is default, sets it default.
- If multiple Microsoft connections exist and none default, does not auto-select (tenant remains blocked until admin remediation).

## Smoke test key flows

After backfill and cutover changes are in place:

- Start an inventory/policy sync for a tenant with a default Microsoft connection → should proceed and record `provider_connection_id` on the `OperationRun`.
- Start the same flow for a tenant missing default connection/credential → should create an `OperationRun` and end as blocked with a stable `reason_code` and link-only next steps.

## Run the focused tests

Run the minimal set of tests introduced/updated by this spec:

- `vendor/bin/sail artisan test --compact --filter=Spec081`
- `vendor/bin/sail artisan test --compact --filter=ProviderConnection`
- `vendor/bin/sail artisan test --compact --filter=OperationRun`

## Code style

- `vendor/bin/sail bin pint --dirty`

## Deployment note

If any Filament assets are registered/changed as part of the implementation, ensure deploy includes:

- `vendor/bin/sail artisan filament:assets`
