|
| 1 | +# Stacked PR Reorganization Plan |
| 2 | + |
| 3 | +## Goal |
| 4 | +Remove PR #11054 and consolidate its foundation files into PR #11069, creating a cleaner 4-PR stack instead of 5. |
| 5 | + |
| 6 | +## Current Structure |
| 7 | +``` |
| 8 | +develop |
| 9 | + ↓ |
| 10 | +PR #11054 (dev/qit-e2e-workflows) - foundation + workflow |
| 11 | + ↓ |
| 12 | +PR #11069 (dev/qit-e2e-shopper-specs-migration) - shopper specs |
| 13 | + ↓ |
| 14 | +PR #11071 (dev/qit-e2e-merchant-specs-migration) - merchant specs |
| 15 | + ↓ |
| 16 | +PR #11078 (dev/qit-e2e-subscriptions-specs-migration) - subscriptions specs |
| 17 | + ↓ |
| 18 | +PR #11082 (dev/qit-e2e-enhance-workflows) - enhanced workflows |
| 19 | +``` |
| 20 | + |
| 21 | +## Target Structure |
| 22 | +``` |
| 23 | +develop |
| 24 | + ↓ |
| 25 | +PR #11069 (foundation + shopper specs) |
| 26 | + ↓ |
| 27 | +PR #11071 (merchant specs) |
| 28 | + ↓ |
| 29 | +PR #11078 (subscriptions specs) |
| 30 | + ↓ |
| 31 | +PR #11082 (GitHub Actions workflows) |
| 32 | +``` |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## Foundation Changes Analysis |
| 37 | + |
| 38 | +### Files #11069 Already Modifies from #11054 |
| 39 | +- `tests/qit/e2e-runner.sh` - Simplifies QIT binary handling |
| 40 | +- `tests/qit/e2e/bootstrap/setup.sh` - Enhances setup logic |
| 41 | +- `tests/qit/qit.yml` - Minor tweaks |
| 42 | + |
| 43 | +### Files #11069 Already Deletes from #11054 |
| 44 | +- `tests/qit/e2e/basic.spec.js` - Converts to TypeScript |
| 45 | +- `tests/qit/e2e/checkout.spec.js` - Converts to TypeScript |
| 46 | + |
| 47 | +### Foundation Files from #11054 That Come Along |
| 48 | +These files are already in the git history when rebasing #11069 onto develop: |
| 49 | + |
| 50 | +**Bootstrap scripts (Jetpack integration):** |
| 51 | +- `tests/qit/e2e/bootstrap/class-wp-cli-qit-dev-command.php` |
| 52 | +- `tests/qit/e2e/bootstrap/qit-jetpack-connection.php` |
| 53 | +- `tests/qit/e2e/bootstrap/qit-jetpack-status.php` |
| 54 | + |
| 55 | +**Configuration files:** |
| 56 | +- `tests/qit/config/default.env` |
| 57 | +- `tests/qit/e2e/.eslintrc.js` |
| 58 | +- `tests/js/jest.config.js` |
| 59 | + |
| 60 | +**Dependencies:** |
| 61 | +- `composer.json` (QIT CLI 0.4.0 → 0.10.0) |
| 62 | +- `composer.lock` |
| 63 | +- `package.json` |
| 64 | + |
| 65 | +**Changelog:** |
| 66 | +- `changelog/dev-qit-e2e-foundation` |
| 67 | + |
| 68 | +### File to Remove |
| 69 | +- `.github/workflows/qit-e2e.yml` - Will be added properly in #11082 |
| 70 | +- `changelog/dev-qit-e2e-workflows` - Workflow-specific changelog |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## Step-by-Step Execution Plan |
| 75 | + |
| 76 | +### Step 1: Create Backup Branches (Safety First!) |
| 77 | + |
| 78 | +```bash |
| 79 | +# Fetch latest from remote |
| 80 | +git fetch origin |
| 81 | + |
| 82 | +# Create backup branches in case we need to revert |
| 83 | +git branch backup-dev-qit-e2e-workflows origin/dev/qit-e2e-workflows |
| 84 | +git branch backup-dev-qit-e2e-shopper-specs-migration origin/dev/qit-e2e-shopper-specs-migration |
| 85 | +git branch backup-dev-qit-e2e-merchant-specs-migration origin/dev/qit-e2e-merchant-specs-migration |
| 86 | +git branch backup-dev-qit-e2e-subscriptions-specs-migration origin/dev/qit-e2e-subscriptions-specs-migration |
| 87 | +git branch backup-dev-qit-e2e-enhance-workflows origin/dev/qit-e2e-enhance-workflows |
| 88 | + |
| 89 | +echo "✅ Backups created! If anything goes wrong, you can restore with:" |
| 90 | +echo " git checkout dev/qit-e2e-shopper-specs-migration" |
| 91 | +echo " git reset --hard backup-dev-qit-e2e-shopper-specs-migration" |
| 92 | +``` |
| 93 | + |
| 94 | +### Step 2: Rebase #11069 onto develop |
| 95 | + |
| 96 | +```bash |
| 97 | +# Checkout #11069 branch |
| 98 | +git checkout dev/qit-e2e-shopper-specs-migration |
| 99 | + |
| 100 | +# Update develop locally |
| 101 | +git fetch origin develop:develop |
| 102 | + |
| 103 | +# Rebase onto develop (this brings all commits from #11054 + #11069) |
| 104 | +git rebase origin/develop |
| 105 | + |
| 106 | +# ✅ At this point, the branch has foundation + shopper specs |
| 107 | +# ❌ But it also has the workflow file from #11054 that we don't want |
| 108 | +``` |
| 109 | + |
| 110 | +### Step 3: Remove the workflow file |
| 111 | + |
| 112 | +**Simple approach (recommended):** |
| 113 | +```bash |
| 114 | +# Remove the workflow file (we'll add it properly in #11082) |
| 115 | +git rm .github/workflows/qit-e2e.yml |
| 116 | + |
| 117 | +# Remove workflow changelog (keep foundation changelog) |
| 118 | +git rm changelog/dev-qit-e2e-workflows |
| 119 | + |
| 120 | +# Commit the removal |
| 121 | +git commit -m "Remove workflow file - will be added in final PR |
| 122 | +
|
| 123 | +The workflow file from #11054 will be replaced by the enhanced |
| 124 | +workflows in the final PR. This keeps the foundation separate |
| 125 | +from workflow implementation." |
| 126 | + |
| 127 | +# ✅ Now #11069 has: foundation + shopper specs, no workflow |
| 128 | +``` |
| 129 | + |
| 130 | +**Alternative (interactive rebase to edit history):** |
| 131 | +```bash |
| 132 | +# Interactive rebase to clean up properly |
| 133 | +git rebase -i origin/develop |
| 134 | + |
| 135 | +# In the editor: |
| 136 | +# - Find the commit that added .github/workflows/qit-e2e.yml |
| 137 | +# - Change 'pick' to 'edit' for that commit |
| 138 | +# - Save and close |
| 139 | + |
| 140 | +# When rebase pauses: |
| 141 | +git rm .github/workflows/qit-e2e.yml |
| 142 | +git rm changelog/dev-qit-e2e-workflows || true |
| 143 | +git commit --amend --no-edit |
| 144 | +git rebase --continue |
| 145 | +``` |
| 146 | + |
| 147 | +### Step 4: Force push the updated branch |
| 148 | + |
| 149 | +```bash |
| 150 | +# Force push to update PR #11069 |
| 151 | +git push origin dev/qit-e2e-shopper-specs-migration --force-with-lease |
| 152 | + |
| 153 | +echo "✅ PR #11069 updated! It now targets develop and includes foundation" |
| 154 | +``` |
| 155 | + |
| 156 | +### Step 5: Rebase #11071 (merchant specs) onto the new #11069 |
| 157 | + |
| 158 | +```bash |
| 159 | +# Checkout #11071 |
| 160 | +git checkout dev/qit-e2e-merchant-specs-migration |
| 161 | + |
| 162 | +# Rebase onto the updated #11069 |
| 163 | +git rebase dev/qit-e2e-shopper-specs-migration |
| 164 | + |
| 165 | +# Force push |
| 166 | +git push origin dev/qit-e2e-merchant-specs-migration --force-with-lease |
| 167 | + |
| 168 | +echo "✅ PR #11071 rebased onto new #11069" |
| 169 | +``` |
| 170 | + |
| 171 | +### Step 6: Rebase #11078 (subscriptions specs) onto the new #11071 |
| 172 | + |
| 173 | +```bash |
| 174 | +# Checkout #11078 |
| 175 | +git checkout dev/qit-e2e-subscriptions-specs-migration |
| 176 | + |
| 177 | +# Rebase onto the updated #11071 |
| 178 | +git rebase dev/qit-e2e-merchant-specs-migration |
| 179 | + |
| 180 | +# Force push |
| 181 | +git push origin dev/qit-e2e-subscriptions-specs-migration --force-with-lease |
| 182 | + |
| 183 | +echo "✅ PR #11078 rebased onto new #11071" |
| 184 | +``` |
| 185 | + |
| 186 | +### Step 7: Rebase #11082 (workflows) onto the new #11078 |
| 187 | + |
| 188 | +```bash |
| 189 | +# Checkout #11082 |
| 190 | +git checkout dev/qit-e2e-enhance-workflows |
| 191 | + |
| 192 | +# Rebase onto the updated #11078 |
| 193 | +git rebase dev/qit-e2e-subscriptions-specs-migration |
| 194 | + |
| 195 | +# ⚠️ You might see a conflict for .github/workflows/qit-e2e.yml |
| 196 | +# This is expected! The file doesn't exist in the base anymore. |
| 197 | +``` |
| 198 | + |
| 199 | +**If you get a conflict:** |
| 200 | +```bash |
| 201 | +# Check the status |
| 202 | +git status |
| 203 | + |
| 204 | +# The workflow file changes should be applied as a new file creation |
| 205 | +# If git shows a conflict, resolve it by accepting the new version: |
| 206 | +git add .github/workflows/qit-e2e.yml |
| 207 | + |
| 208 | +# Continue the rebase |
| 209 | +git rebase --continue |
| 210 | +``` |
| 211 | + |
| 212 | +**Force push:** |
| 213 | +```bash |
| 214 | +git push origin dev/qit-e2e-enhance-workflows --force-with-lease |
| 215 | + |
| 216 | +echo "✅ PR #11082 rebased onto new #11078" |
| 217 | +``` |
| 218 | + |
| 219 | +### Step 8: Update PR targets on GitHub |
| 220 | + |
| 221 | +The force pushes automatically update the PR bases in most cases, but let's verify: |
| 222 | + |
| 223 | +```bash |
| 224 | +# Check current PR information |
| 225 | +gh pr view 11069 --json baseRefName,headRefName |
| 226 | +gh pr view 11071 --json baseRefName,headRefName |
| 227 | +gh pr view 11078 --json baseRefName,headRefName |
| 228 | +gh pr view 11082 --json baseRefName,headRefName |
| 229 | +``` |
| 230 | + |
| 231 | +**If any PR still shows the wrong base**, update it via GitHub CLI: |
| 232 | + |
| 233 | +```bash |
| 234 | +# Update PR #11069 to target develop (if not already) |
| 235 | +gh pr edit 11069 --base develop |
| 236 | + |
| 237 | +# Verify the others target the right branches |
| 238 | +# #11071 should target dev/qit-e2e-shopper-specs-migration |
| 239 | +# #11078 should target dev/qit-e2e-merchant-specs-migration |
| 240 | +# #11082 should target dev/qit-e2e-subscriptions-specs-migration |
| 241 | +``` |
| 242 | + |
| 243 | +**Update PR #11069 description** to mention it includes foundation: |
| 244 | + |
| 245 | +```bash |
| 246 | +gh pr edit 11069 --body "This PR migrates shopper E2E specs to QIT and includes the foundation from the removed PR #11054. |
| 247 | +
|
| 248 | +**Includes:** |
| 249 | +- QIT E2E foundation (bootstrap scripts, runner, config) |
| 250 | +- QIT CLI upgrade (0.4.0 → 0.10.0) |
| 251 | +- Jetpack integration for QIT environment |
| 252 | +- Shopper spec migration to TypeScript |
| 253 | +
|
| 254 | +**Note:** The GitHub Actions workflows will be added in the final PR (#11082)." |
| 255 | +``` |
| 256 | + |
| 257 | +### Step 9: Close PR #11054 |
| 258 | + |
| 259 | +```bash |
| 260 | +# Close PR #11054 with a comment explaining why |
| 261 | +gh pr close 11054 --comment "Closing this PR as the foundation has been merged into PR #11069 to reduce the number of stacked PRs. The GitHub Actions workflows will be added in the final PR #11082. |
| 262 | +
|
| 263 | +The foundation changes from this PR are preserved in #11069." |
| 264 | +``` |
| 265 | + |
| 266 | +--- |
| 267 | + |
| 268 | +## Verification Steps |
| 269 | + |
| 270 | +After completing all the above steps, verify everything: |
| 271 | + |
| 272 | +```bash |
| 273 | +# Verify PR chain |
| 274 | +gh pr view 11069 --json baseRefName,headRefName,title |
| 275 | +gh pr view 11071 --json baseRefName,headRefName,title |
| 276 | +gh pr view 11078 --json baseRefName,headRefName,title |
| 277 | +gh pr view 11082 --json baseRefName,headRefName,title |
| 278 | + |
| 279 | +# Verify #11054 is closed |
| 280 | +gh pr view 11054 --json state |
| 281 | + |
| 282 | +# Check that workflow file exists in #11082 but not in #11078 |
| 283 | +git checkout dev/qit-e2e-subscriptions-specs-migration |
| 284 | +ls -la .github/workflows/qit-e2e.yml # Should NOT exist |
| 285 | + |
| 286 | +git checkout dev/qit-e2e-enhance-workflows |
| 287 | +ls -la .github/workflows/qit-e2e.yml # Should exist |
| 288 | +ls -la .github/workflows/qit-e2e-pull-request.yml # Should exist |
| 289 | + |
| 290 | +# Return to develop |
| 291 | +git checkout develop |
| 292 | +``` |
| 293 | + |
| 294 | +--- |
| 295 | + |
| 296 | +## Rollback Procedure |
| 297 | + |
| 298 | +If any step fails or produces unexpected results: |
| 299 | + |
| 300 | +```bash |
| 301 | +# Restore from backups |
| 302 | +git checkout dev/qit-e2e-shopper-specs-migration |
| 303 | +git reset --hard backup-dev-qit-e2e-shopper-specs-migration |
| 304 | +git push origin dev/qit-e2e-shopper-specs-migration --force-with-lease |
| 305 | + |
| 306 | +# Repeat for other branches as needed |
| 307 | +git checkout dev/qit-e2e-merchant-specs-migration |
| 308 | +git reset --hard backup-dev-qit-e2e-merchant-specs-migration |
| 309 | +git push origin dev/qit-e2e-merchant-specs-migration --force-with-lease |
| 310 | + |
| 311 | +git checkout dev/qit-e2e-subscriptions-specs-migration |
| 312 | +git reset --hard backup-dev-qit-e2e-subscriptions-specs-migration |
| 313 | +git push origin dev/qit-e2e-subscriptions-specs-migration --force-with-lease |
| 314 | + |
| 315 | +git checkout dev/qit-e2e-enhance-workflows |
| 316 | +git reset --hard backup-dev-qit-e2e-enhance-workflows |
| 317 | +git push origin dev/qit-e2e-enhance-workflows --force-with-lease |
| 318 | +``` |
| 319 | + |
| 320 | +--- |
| 321 | + |
| 322 | +## Expected Outcomes |
| 323 | + |
| 324 | +### PR Sizes After Reorganization |
| 325 | +- **#11069**: ~5,800 additions (foundation + shopper specs) |
| 326 | +- **#11071**: ~3,400 additions (merchant specs) |
| 327 | +- **#11078**: ~1,500 additions (subscriptions specs) |
| 328 | +- **#11082**: ~750 additions (workflows) |
| 329 | + |
| 330 | +### Benefits |
| 331 | +✅ Eliminates PR #11054 from the review queue |
| 332 | +✅ Consolidates foundation + shopper specs into #11069 |
| 333 | +✅ Keeps workflow complexity separate in final PR #11082 |
| 334 | +✅ Clean linear PR chain: develop → specs → workflows |
| 335 | +✅ Reduces total number of PRs from 5 to 4 |
| 336 | +✅ Avoids reviewing intermediate workflow version |
| 337 | + |
| 338 | +### Review Strategy |
| 339 | +1. **Merge #11069** - Review foundation + shopper specs together |
| 340 | +2. **Merge #11071** - Review merchant specs |
| 341 | +3. **Merge #11078** - Review subscriptions specs |
| 342 | +4. **Merge #11082** - Review final workflow implementation |
| 343 | + |
| 344 | +--- |
| 345 | + |
| 346 | +## Notes |
| 347 | + |
| 348 | +- The workflow file in #11082 will show as a file creation (not modification) since it was removed from the history |
| 349 | +- All foundation changes from #11054 are preserved in #11069's git history |
| 350 | +- The commit history remains clean with clear separation between foundation and workflows |
| 351 | +- Each PR can still be reviewed and merged independently in sequence |
0 commit comments