1. Analyze the Request:
* Topic: Deprecation playbook for legacy UI components.
* Key Elements to Include:
* Replacement timelines (stages, deadlines).
* Telemetry monitoring (metrics to watch, success criteria).
* Communication cadences (who to tell, when, and how).
* Goal: Provide a structured, actionable document (a "playbook") that engineering teams can use to safely retire old UI code.
-
Determine the Structure of a Playbook:
- A playbook needs to be procedural.
- It should have distinct phases (e.g., Planning, Announcement, Execution, Cleanup).
- It needs specific artifacts (templates, checklists).
-
Drafting - Section by Section:
-
Title & Objective: clear and concise.
-
Scope: What components does this apply to? (Buttons, modals, entire pages).
-
Phase 1: Pre-Flight & Planning (The "Before"):
- Need to identify the legacy component and the new component.
- Crucial Step: Telemetry setup. You can't deprecate what you don't measure.
- Metric Definition: Usage count, active instances, errors.
-
Phase 2: Soft Launch & Migration Support (The "During"):
- This is the active phase.
- Need a codemod or linter rule? Yes, usually helpful.
- Communication: T-30, T-14 days notices.
-
Phase 3: Hard Deprecation (The "Turn Off"):
- Console warnings are no longer enough.
- Feature flags?
- Stop rendering?
-
Phase 4: Code Removal (The "Cleanup"):
- Deleting the code.
- Post-mortem.
-
Fleshing out the Specific Requirements (from the prompt):
-
Replacement Timelines:
- I need a standard timeline. Let's use a 90-day cycle (common in enterprise software).
- Breakdown: T-0 (Announce) -> T-30 (Migration) -> T-60 (Warning/Fallback) -> T-90 (Removal).
-
Telemetry Monitoring:
- What to measure? "Active Consuming Apps," "Render Count," "Fall-back Trigger Rate" (if we have a fallback).
- Tools: Grafana, Datadog, Mixpanel (generic references).
- Success Criteria: < 1% usage before deletion.
-
Communication Cadences:
- Audience: Internal devs (Platform), Product teams (Consumers), potentially external customers (if public API/UI).
- Channels: Slack, Email, Changelogs, PR comments.
- Schedule: T-60, T-30, T-14, T-7, T-0.
-
Refining the Content & Tone:
- Tone: Professional, authoritative but helpful.
- Format: Use bolding, lists, and tables for readability.
-
Self-Correction/Review during drafting:
- Initial thought: Just list steps.
- Correction: A "Playbook" implies a repeatable process. I should structure it as a lifecycle.
- Gap: What about breaking changes?
- Fix: Add a section on "Risk Assessment" or "Severity Levels" (e.g., cosmetic vs. functional).
-
Final Polish (Structuring the Output):
- Introduction: Purpose.
- The 4-Stage Lifecycle:
- Discovery & Telemetry (The Setup).
- Communication & Migration (The Grind).
- End-of-Life (EOL) Enforcement (The Warning).
- Code Removal (The End).
- The Timeline Table: (Visualizing the dates).
- The Communication Plan: (Who, When, What).
- Telemetry Dashboard: (What metrics to track).
- Appendix: (Templates).
-
Final Output Generation: (This matches the detailed response provided previously.)
- Key addition: Emphasized the difference between "Soft Deprecation" (console warnings) and "Hard Deprecation" (throwing errors/stopping renders).
-
(Self-Correction on "Telemetry"): Make sure to mention attribution. It's not enough to know OldButton is used; you need to know where (which team/repository) uses it so you can nag them specifically.
-
Finalizing the response. (Proceeding to generate the output based on these steps.)
This playbook outlines the standardized process for retiring legacy UI components in favor of new design system standards. It is designed to minimize technical debt while ensuring zero unplanned downtime for end-facing products.
🏛️ Legacy UI Component Deprecation Playbook
1. Overview & Guiding Principles
- Goal: Safely retire
<LegacyComponent /> and migrate all consumers to <NewComponent />.
- Principle: "No Breaking Surprises." All consumer teams must be notified, equipped with migration tools, and given adequate runway before code removal.
- Deprecation vs. Deletion:
- Deprecation: Component still works but triggers console warnings/lint errors. Patches only (no new features).
- Deletion: Component is physically removed from the codebase.
2. Replacement Timelines (The 90-Day Cycle)
Standard deprecation follows a T-Minus 90 Day schedule unless critical security vulnerabilities require an expedited process.
Phase 1: Preparation (Days -30 to 0)
- T-30d: Finalize
<NewComponent /> API.
- T-14d: Create Codemods (automated code transformations) and Migration Guides.
- T-7d: Internal Dogfooding: Platform team migrates 3 internal apps to prove stability.
Phase 2: Soft Deprecation (Days 1–30)
- T-0 (Go/No-Go): Release
vX.Y.Z marking <LegacyComponent /> as @deprecated.
- Action: Update documentation to "Legacy" status and redirect search traffic to the new component page.
- Telemetry: Enable specific usage tracking flags.
Phase 3: Active Migration (Days 31–75)
- T-30d to T-75d: "Migration Window."
- Support: Office hours scheduled for consuming engineering teams.
- Codemod Execution: Run automated scripts across the monorepo/polyrepo ecosystem.
Phase 4: Hard EOL (Days 76–90)
- T-76d: Stop-The-Line Check. If telemetry shows usage > 5%, extend timeline. If < 5%, proceed.
- T-85d: Create a "Kill Switch" PR (Feature Flag to disable rendering).
- T-90d: Deletion. Merge PR removing the component code. Release Major Version bump (if SemVer).
3. Telemetry & Monitoring Strategy
You cannot delete what you cannot measure. Telemetry drives the decision to pull the plug.
Metrics Dashboard
Create a specific dashboard for this deprecation project tracking the following KPIs:
| Metric | Source | Success Threshold (for Deletion) |
|---|
| Import Count | Static Analysis (e.g., Scipio, Glean) | 0 active imports in production code. |
| Render Count | Runtime Analytics (e.g., Segment, Heap) | < 1,000 renders/day globally. |
| Error Rate | Sentry / Datadog | No increase in PropType warnings or undefined errors related to the legacy component. |
| Bundle Size | Lighthouse / Webpack Bundle Analyzer | Decrease in main chunk size (expected). |
The "Kill Switch" Test
Before deleting code, use a Feature Flag to "turn off" the legacy component in a Staging Environment.
- Enable the Kill Switch.
- If the application crashes or displays a fallback UI, telemetry will catch the error spike.
- If successful, it proves the component is no longer rendering critical paths.
4. Communication Cadence
Communication must be multi-channel: Passive (Docs) and Active (Slack/Email).
The Schedule
| Timeline | Channel | Audience | Message Template |
|---|
| T-30 Days | RFC / Tech Design | Engineering Leads | "Proposal to Deprecate [Component]." Request feedback on timeline. |
| T-0 (Launch) | #eng-announce (Slack) | All Engineers | "⚠️ [Legacy] is now deprecated. Migration required by [Date]. See guide: [Link]." |
| T-30 Days | Email + Dashboard | Product Owners + Leads | "Migration Status: [X]% complete. At-risk deadline." |
| T-14 Days | PR Comments (Automated) | Code Authors | CI/CD Pipeline detects usage and blocks PR merging with error message. |
| T-7 Days | #eng-urgent | All Engineers | "Final Call: [Legacy] removal in 7 days. Unmigrated apps will break." |
| T+1 Day | Release Notes | External (if OSS) | "Breaking Change: Removal of [Component] in v[Major]." |
Runtime Communication (In-App)
While in the Soft Deprecation phase, inject console warnings into the developer browser tools:
[Deprecation Warning] You are using <LegacyButton />. This component will be removed on YYYY-MM-DD. Please migrate to <ButtonV2 />. Documentation: [Link]
5. Execution Checklist
Prior to Start
During Migration
Final Delete
6. Rollback Plan
If "Deletion Day" (T-90) arrives and critical systems are breaking:
- Immediate: Revert the PR (if small) or toggle the Feature Flag to re-enable the component.
- Communication: Send "Hold on Deprecation" notice to #eng-announce.
- Analysis: Review telemetry failure modes. Was it a missed import? A dynamic import?
- Reset: Establish a new T-90 date (add +30 days).
Appendix: Sample PR Description for Deletion
Title: refactor: Remove <LegacyTable> component
Description:
This PR removes the <LegacyTable> component as per the Deprecation Playbook.
- Deprecation RFC: #1234
- Migration Guide: [Link]
- Telemetry: Usage currently at 0.1% (Threshold: <1%).
- Bundle Impact: -45kb (gzipped).
Action Required:
If your app still relies on this component, pin your version to v4.0.0. Note that v4.0.0 will no longer receive security updates.