Skip to content

fix(cli): back up workflows during upgrade - #1709

Merged
bradygaster merged 2 commits into
github:devfrom
omercangumus:omercangumus/1493-upgrade-workflow-backup
Aug 23, 2026
Merged

bradygaster merged 2 commits into
github:devfrom
omercangumus:omercangumus/1493-upgrade-workflow-backup

Conversation

@omercangumus

Copy link
Copy Markdown
Contributor

Fixes #1493

squad upgrade refreshed existing .github/workflows/*.yml files in place. If a repo had local CI edits, the old workflow content was discarded before the new template/stub was written.

Changed both upgrade paths that write workflow files to compare the current file with the next generated content first. If the current file is non-empty and different, upgrade writes <workflow>.local-backup and logs the backup before refreshing the workflow.

Regression coverage: test/workflows.test.cjs now modifies squad-ci.yml, runs squad upgrade, and checks that the pre-upgrade content exists in .local-backup with a visible log line.

Commands run:

  • node --test test/workflows.test.cjs — failed before the fix with missing squad-ci.yml.local-backup; passes after the fix
  • npm run build — passes
  • npm run lint — passes
  • npm test — fails locally; same command also fails on unmodified upstream/dev after stashing this diff. The base run includes ENOSPC from C: reaching 0 bytes free plus existing Windows/locale/worktree-sensitive failures (gh-aw-quality, watch-capabilities, telemetry, acceptance init in a worktree). Not touching those here.

Fixes github#1493

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit 4ad4b81

PR Scope: 📦🔧 Mixed (product + infrastructure)

⚠️ 3 item(s) to address before review

Status Check Details
❌ Single commit 2 commits — consider squashing before review
✅ Not in draft Ready for review
✅ Branch up to date Up to date with dev
❌ Copilot review No Copilot review yet — it may still be processing
✅ Changeset present Changeset file found
✅ Scope clean No .squad/ or docs/proposals/ files
✅ No merge conflicts No merge conflicts
✅ Copilot threads resolved No Copilot review threads
❌ CI passing 9 check(s) still running

Files Changed (4 files, +73 −0)

File +/−
.changeset/1493-upgrade-workflow-backup.md +5 −0
index.cjs +16 −0
packages/squad-cli/src/cli/core/upgrade.ts +16 −0
test/workflows.test.cjs +36 −0

Total: +73 −0


This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

@github-actions

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #1709

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 4
Files added 1
Files modified 3
Files deleted 0
Modules touched 3

🎯 Risk Factors

  • 4 files changed (≤5 → LOW)
  • 3 modules touched (2-4 → MEDIUM)

📦 Modules Affected

root (2 files)
  • .changeset/1493-upgrade-workflow-backup.md
  • index.cjs
squad-cli (1 file)
  • packages/squad-cli/src/cli/core/upgrade.ts
tests (1 file)
  • test/workflows.test.cjs

This report is generated automatically for every PR. See #733 for details.

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Architectural Review

⚠️ Architectural review: 1 warning(s).

Severity Category Finding Files
🟡 warning bootstrap-area 1 file(s) in the bootstrap area (packages/squad-cli/src/cli/core/) were modified. These files must maintain zero external dependencies. Review carefully. packages/squad-cli/src/cli/core/upgrade.ts

Automated architectural review — informational only.

@omercangumus
omercangumus marked this pull request as ready for review August 13, 2026 21:13
@github-actions

Copy link
Copy Markdown
Contributor

👋 Friendly nudge — this PR has had no activity for 7 days.

What needs attention:

  • 👀 No approving reviews yet. Request a review from a teammate.
  • ⬇️ 30 commits behind dev. Rebase to pick up latest changes.

If this PR is abandoned, please close it. If it's blocked on something external, leave a comment so the team knows.
This is an automated check that runs on weekdays. It won't nudge the same PR more than once per week.

@bradygaster
bradygaster merged commit 6a4ff10 into github:dev Aug 23, 2026
16 checks passed
bradygaster added a commit that referenced this pull request Aug 23, 2026
…1843)

`squad upgrade` has backed up locally customized Squad-owned files to
`<file>.local-backup` for a while, and #1709 extended that to workflow
files, but the behavior was never documented outside .squad/decisions.md.

Adds a section to the self-upgrade feature docs covering:
- which files are covered (squad.agent.md + managed workflows)
- how to restore from a backup
- version stamps are stripped before comparison, so a version-only diff
  does not trigger a spurious backup
- only the most recent backup is kept per file
- backups are not gitignored
- --dry-run previews the squad.agent.md backup only; it returns before
  workflow files are processed

Also cross-references the behavior from the `squad upgrade` row in the
CLI reference for discoverability.

Docs-only, no changeset required.

Co-authored-by: brady gaster <bradygaster@github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2af08ff0-56a4-43e4-903b-3153c0910a13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

squad upgrade overwrites local edits to .github/workflows/*

2 participants