Skip to main content

Pre-Mode Workflow Consolidation Plan

๐ŸŽฏ Goalโ€‹

Have ONE clear way to manage pre-release mode (beta, rc, next channels).

๐Ÿ“Š Current State (Confusing)โ€‹

Workflow 1: pre-mode.yml โœ… GOODโ€‹

  • Purpose: Enter or exit pre-mode
  • How it works: Creates a PR, waits for review, then merges
  • File: .github/workflows/pre-mode.yml
  • Script: .github/scripts/pre-mode-toggle.sh
  • Pros:
    • Safe (follows branch protection)
    • Creates reviewable PRs
    • Uses standard git workflow
  • Cons: None

Workflow 2: channel-release.yml โš ๏ธ DOES TOO MUCHโ€‹

  • Purpose: Enter/exit pre-mode + version + publish
  • How it works: Direct push to main (BAD)
  • File: .github/workflows/channel-release.yml
  • Pros:
    • All-in-one convenience
  • Cons:
    • Bypasses branch protection (lines 57, 64, 79 do git push)
    • Bypasses PR review for enter/exit
    • Confusing overlap with pre-mode.yml
    • Inconsistent with documented PR-based workflow

๐Ÿ” Analysis Detailsโ€‹

What pre-mode.yml Does:โ€‹

  1. Creates branch: pre/{action}-{channel}-{run_id}
  2. Runs: pnpm changeset pre enter {channel} OR pnpm changeset pre exit
  3. Commits changes to branch
  4. Opens PR with label release:pre-toggle
  5. Waits for PR approval and merge

What channel-release.yml Does (enter/exit):โ€‹

  1. Runs on main branch directly
  2. For "enter": Runs pnpm pre:enter:{channel}, versions, commits, pushes to main
  3. For "exit": Runs pnpm pre:exit, versions, commits, pushes to main
  4. Problem: No PR, no review, bypasses protection

What channel-release.yml Does (version/publish/snapshot):โ€‹

  1. For "version": Bumps versions, commits, pushes
  2. For "publish": Publishes to npm with prerelease tag
  3. For "snapshot": Publishes canary snapshot
  4. These are fine - they should happen AFTER pre-mode is active

Keep: pre-mode.yml (for enter/exit only)โ€‹

  • Use this to enter or exit pre-release mode
  • Creates a PR for review
  • Safe and follows best practices
  • Consistent with branch protection policy

Modify: channel-release.yml (remove enter/exit)โ€‹

  • Remove: "enter" and "exit" intents (lines 50-57, 72-79)
  • Keep: "version", "publish", "snapshot" intents
  • These operations should happen AFTER pre-mode is active via PR

New Workflow Becomes:โ€‹

Want to start beta testing?
โ†“
1. Run pre-mode.yml with "enter" + "beta"
โ†“
2. Review and merge the PR
โ†“
3. Make changes, merge PRs with changesets
โ†“
4. Run channel-release.yml with "version" (updates versions)
โ†“
5. Run channel-release.yml with "publish" (publishes to npm@beta)
โ†“
6. Repeat steps 3-5 as needed
โ†“
7. Ready for stable? Run pre-mode.yml with "exit"
โ†“
8. Merge PR, then normal release workflow takes over

๐Ÿ“‹ Implementation Stepsโ€‹

  1. โœ… Document the plan (this file)
  2. โณ Remove "enter" and "exit" from channel-release.yml inputs
  3. โณ Remove enter/exit steps from channel-release.yml (lines 50-57, 72-79)
  4. โณ Update channel-release.yml description to clarify scope
  5. โณ Create simple visual flowchart
  6. โณ Update docs/release-channels.md with new workflow
  7. โณ Update docs/releases/changesets-canonical.md quickstart section
  8. โณ Add troubleshooting section

๐Ÿ” Files to Modifyโ€‹

1. .github/workflows/channel-release.ymlโ€‹

Remove:

  • Input option "enter" from intent choices (line 12)
  • Input option "exit" from intent choices (line 12)
  • Step "Enter prerelease mode" (lines 50-57)
  • Step "Exit prerelease mode" (lines 72-79)

Update:

  • Description to: "Version and publish pre-release packages. Use pre-mode.yml to enter/exit pre-mode first."
  • Intent description to: "Action: version | publish | snapshot"

2. docs/release-channels.mdโ€‹

Update sections:

  • Workflow Overview: Clarify that channel-release.yml is for version/publish/snapshot only
  • Typical Sequence: Reference pre-mode.yml for enter/exit steps
  • Add clear section: "Which Workflow Do I Use?"

3. docs/releases/changesets-canonical.mdโ€‹

Update:

  • Quickstart section to reference pre-mode.yml for enter/exit
  • Remove any references to channel-release.yml for enter/exit
  • Update "What the automation does" section

4. docs/diagrams/pre-mode-workflow-simple.md (NEW)โ€‹

Create: Visual flowchart showing workflow progression

โš ๏ธ Breaking Changesโ€‹

None. The old workflow commands will simply not be available anymore.

Migration path:

  • Old way: Run channel-release.yml with intent=enter
  • New way: Run pre-mode.yml with action=enter
  • Impact: Users see clear error (invalid intent option)
  • Communication: Update docs before removing options

๐Ÿงช Testing Planโ€‹

After implementation, test this sequence:

  1. โœ… Run pre-mode.yml with action=enter, channel=beta
    • Verify PR is created
    • Verify PR has correct changesets pre-mode changes
  2. โœ… Merge the PR
    • Verify main branch is in pre-mode
  3. โœ… Run channel-release.yml with intent=version
    • Verify versions are bumped correctly
  4. โœ… Run channel-release.yml with intent=publish
    • Verify packages publish to beta tag
  5. โœ… Run channel-release.yml with intent=snapshot
    • Verify canary snapshot publishes
  6. โœ… Run pre-mode.yml with action=exit
    • Verify PR is created
    • Verify PR exits pre-mode correctly
  7. โœ… Merge exit PR
    • Verify main branch is out of pre-mode
  8. โŒ Try channel-release.yml with intent=enter
    • Verify clear error message (option not available)

๐Ÿ“š Documentation Updates Neededโ€‹

  • Update all references to "use channel-release for enter/exit"
  • Create simple flowchart diagram
  • Add "Which workflow should I use?" decision tree
  • Update troubleshooting section
  • Add common mistakes section
  • Update workflow dispatch descriptions

๐ŸŽ“ Why This Matters (ADHD Context)โ€‹

Problem: Two ways to do the same thing = confusion and mistakes

Solution: One workflow for enter/exit (safe), another for version/publish (operational)

Benefit:

  • Clear mental model: "pre-mode.yml = mode changes, channel-release.yml = package operations"
  • Consistent with branch protection
  • Easier to remember
  • Fewer decisions to make

๐Ÿš€ Next Stepsโ€‹

  1. Review this plan
  2. Get approval to proceed
  3. Implement workflow changes
  4. Update documentation
  5. Test the new workflow
  6. Communicate changes to users

๐Ÿ“ Notesโ€‹

  • Keep pre-mode-toggle.sh as-is (already works correctly)
  • No changes needed to package.json scripts
  • No changes needed to other workflows
  • This is a simplification, not a feature addition

Created: 2025-11-14 Status: Proposed Author: Consolidation analysis