fix(presets): round-trip routing.md in preset save/apply#1429
Merged
bradygaster merged 2 commits intoJun 30, 2026
Conversation
savePreset now captures .squad/routing.md into the preset snapshot. applyPreset restores the saved routing.md before scaffolding so that custom label tables, module ownership mappings, and other routing rules survive the save/apply cycle. Closes #1412 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
🟡 Impact Analysis — PR #1429Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (1 file)
squad-sdk (1 file)
tests (1 file)
|
Contributor
🛫 PR Readiness Check
PR Scope: 📦🔧 Mixed (product + infrastructure)
|
| Status | Check | Details |
|---|---|---|
| ❌ | Single commit | 2 commits — consider squashing before review |
| ✅ | Not in draft | Ready for review |
| ❌ | Branch up to date | dev is 2 commit(s) ahead — rebase recommended |
| ❌ | 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 | All 4 Copilot thread(s) resolved |
| ✅ | CI passing | All checks passing |
Files Changed (3 files, +143 −1)
| File | +/− |
|---|---|
.changeset/fix-preset-routing-roundtrip.md |
+5 −0 |
packages/squad-sdk/src/presets/index.ts |
+28 −1 |
test/presets.test.ts |
+110 −0 |
Total: +143 −1
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to fix preset fidelity for routing configuration by ensuring .squad/routing.md is included in preset snapshots and restored on apply, preserving custom routing sections (labels, ownership mappings, etc.) across save → apply.
Changes:
- Update
savePreset()to capture.squad/routing.mdinto the preset directory. - Update
applyPreset()to restore a savedrouting.mdbefore preset scaffolding runs. - Add a regression test for routing round-trip and include a patch changeset for the SDK.
Show a summary per file
| File | Description |
|---|---|
| packages/squad-sdk/src/presets/index.ts | Adds save/restore logic for routing.md during preset save/apply. |
| test/presets.test.ts | Adds a new test verifying custom routing sections survive save→apply. |
| .changeset/fix-preset-routing-roundtrip.md | Patch changeset documenting the routing round-trip fix. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 4
- Review effort level: Low
… checks - Add overwriteRouting option to applyPreset so callers (e.g. squad init --preset) can replace an existing skeleton routing.md with the preset's saved version without forcing agent overwrites. - Use !== undefined instead of truthiness for readSync results so intentionally-empty routing.md files are faithfully round-tripped. - Add regression test for overwriteRouting replacing existing skeleton. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1412 —
squad preset save/applynow round-trips custom routing configuration.Problem
squad preset save <name>only snapshotted agent charters but dropped.squad/routing.md. Whensquad preset applyran later, only skeleton routing rows were regenerated from agent roles — custom label tables, module ownership mappings, and other routing rules were lost.Solution
savePreset— after copying agents, also capturesrouting.mdinto the preset directoryapplyPreset— if the preset contains a savedrouting.md, restores it before scaffolding runs, sowriteOrMergeRoutingsees the full custom content and only appends missing agent rowsChanges
packages/squad-sdk/src/presets/index.ts— save and restore logic forrouting.mdtest/presets.test.ts— new test verifying custom routing (label tables, module ownership) survives save→apply.changeset/fix-preset-routing-roundtrip.md— patch changesetTesting
All 37 preset tests pass including the new round-trip routing test.