Skip to content

Guard tests against tracked file changes - #2308

Merged
tamirdresher merged 4 commits into
github:devfrom
omercangumus:omercangumus/1807-test-working-tree-guard
Oct 26, 2026
Merged

tamirdresher merged 4 commits into
github:devfrom
omercangumus:omercangumus/1807-test-working-tree-guard

Conversation

@omercangumus

Copy link
Copy Markdown
Contributor

Closes #1807

Adds a Vitest global setup guard that snapshots tracked files before the suite and fails with the changed paths if tests mutate the checkout. CRLF-only differences are ignored. Moves the legacy casting upgrade fixture into the OS temp directory so it cannot write test repositories under the project root.

Verified with the focused guard and legacy upgrade tests (16 passing), build, and lint.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #2308

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 18
Files added 2
Files modified 16
Files deleted 0
Modules touched 2

🎯 Risk Factors

  • 18 files changed (6-20 → MEDIUM)
  • 2 modules touched (2-4 → MEDIUM)

📦 Modules Affected

root (1 file)
  • vitest.config.ts
tests (17 files)
  • test/acceptance/acceptance.test.ts
  • test/acceptance/features/init-command.feature
  • test/acceptance/steps/cli-steps.ts
  • test/casting-legacy-migration.test.ts
  • test/casting.test.ts
  • test/cli-packaging-smoke.test.ts
  • test/cli.test.ts
  • test/cli/cast.test.ts
  • test/cli/legacy-casting-upgrade.test.ts
  • test/cli/state-mcp-lifecycle.test.ts
  • test/init.test.ts
  • test/memory-governance.test.ts
  • test/memory-providers.test.ts
  • test/presets.test.ts
  • test/setup/tracked-worktree-guard.ts
  • test/speed-gates.test.ts
  • test/tracked-worktree-guard.test.ts

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

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit 98c292d

PR Scope: 🔧 Infrastructure

⚠️ 3 item(s) to address before review

Status Check Details
❌ Single commit 4 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 No source files changed — changeset not required
✅ 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 (18 files, +181 −33)

File +/−
test/acceptance/acceptance.test.ts +2 −2
test/acceptance/features/init-command.feature +4 −3
test/acceptance/steps/cli-steps.ts +28 −3
test/casting-legacy-migration.test.ts +2 −1
test/casting.test.ts +2 −1
test/cli-packaging-smoke.test.ts +6 −0
test/cli.test.ts +4 −6
test/cli/cast.test.ts +5 −2
test/cli/legacy-casting-upgrade.test.ts +3 −2
test/cli/state-mcp-lifecycle.test.ts +2 −1
test/init.test.ts +4 −7
test/memory-governance.test.ts +2 −1
test/memory-providers.test.ts +2 −1
test/presets.test.ts +2 −2
test/setup/tracked-worktree-guard.ts +57 −0
test/speed-gates.test.ts +2 −1
test/tracked-worktree-guard.test.ts +53 −0
vitest.config.ts +1 −0

Total: +181 −33


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

@omercangumus
omercangumus force-pushed the omercangumus/1807-test-working-tree-guard branch 5 times, most recently from 9891ae8 to 02d8ee3 Compare October 24, 2026 17:47
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@omercangumus
omercangumus force-pushed the omercangumus/1807-test-working-tree-guard branch from 02d8ee3 to 4c9a144 Compare October 24, 2026 18:11
@omercangumus
omercangumus marked this pull request as ready for review October 24, 2026 18:19
@tamirdresher

Copy link
Copy Markdown
Collaborator

Thanks Omer, great detective work tracking down the second working tree writer to est/acceptance/features/init-command.feature running squad init in process.cwd() and cleaning up the remaining process.cwd() test sandboxes. I verified the merge-tree against dev is clean and the �itest.config.ts global setup snapshot guard in est/setup/tracked-worktree-guard.ts is a solid systemic fix for #1807. dev is currently frozen for 2.0.0-preview.2, so we will merge this right after the release ships, early in the queue right behind #2306.

@omercangumus

Copy link
Copy Markdown
Contributor Author

Thanks for tracing the remaining test writers and checking the merge. Glad the snapshot guard closes the gap. Appreciate the queue update; I will leave the PR as-is through the freeze.

@tamirdresher
tamirdresher merged commit a9c7e71 into github:dev Oct 26, 2026
21 checks passed
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.

#1796 not fully fixed: a second writer still stamps squad.agent.md during full test runs

2 participants