# Exercise 1: Pick a Strategy for Five Changes

For each change, choose a deployment strategy (or a combination) from `cicd_deployment_strategies_theory.md`, describe the rollout steps, the **rollback plan**, and the metrics/gates that decide promotion. Call out any database or compatibility work required.

1. **Checkout redesign** for an e-commerce site (40,000 orders/day). Marketing wants to launch it to "VIP customers first", then everyone over two weeks.
2. **A rewrite of the pricing service** in a new language. It must produce the same prices as the old one for all inputs; any difference costs money.
3. **Upgrading the internal admin tool** used by 30 employees during office hours. It needs a database migration that takes ~2 minutes and is not backward compatible.
4. **A new version of the recommendation API** (2,000 req/s) with a new ML model. Latency must stay p99 < 120 ms; click-through rate should not drop.
5. **Renaming `users.fullname` to `users.display_name`** in a service with 12 pods behind a load balancer, deployed several times a day.

## Deliverables

For each change:

```
strategy:
steps:
gates / metrics (with thresholds):
rollback:
compatibility / DB work:
```

Then answer:

6. Which of the five changes could be released via **feature flags** without any special deployment strategy at all? What do the flags cost you?
7. For change 4, explain how you'd make the canary comparison statistically meaningful (traffic share, duration, baseline).

## Requirements Checklist

- [ ] 1: feature flag targeting a VIP cohort (sticky per user), progressive percentages, kill switch; KPI = conversion and error rate.
- [ ] 2: shadow traffic (mirror requests to the new service, compare responses offline/online) before any canary; diff rate as the gate.
- [ ] 3: recreate (or a maintenance window) is acceptable — 30 internal users, incompatible migration; communicate downtime; backup before migration as the rollback plan.
- [ ] 4: canary with automated analysis vs baseline (p99 latency, error rate, CTR), small initial weight, sticky users; rollback by weight to 0.
- [ ] 5: expand/contract over multiple releases: add `display_name`, dual-write + backfill, switch reads, drop `fullname` later — compatible with rolling updates.
- [ ] Flags cost: flag debt, testing combinations, dependency on the flag service.
