Skip to content

fix(test): correct gh-aw compile test workspace layout for dispatch-workflow validation - #1697

Merged
tamirdresher merged 1 commit into
devfrom
squad/fix-gh-aw-implement-worker
Aug 13, 2026
Merged

fix(test): correct gh-aw compile test workspace layout for dispatch-workflow validation#1697
tamirdresher merged 1 commit into
devfrom
squad/fix-gh-aw-implement-worker

Conversation

@tamirdresher

Copy link
Copy Markdown
Collaborator

Root cause

test/gh-aw-quality.test.ts -> gh-aw: compiled workflow contract -> strict-compiles and preserves prompt/config behavior has kept dev red on vitest since 2026-08-12T23:39 (PR CI, not the node --test release gate, which does not run this file - see note below).

The test builds an ephemeral git workspace, copies this repo's workflows/ into <workspace>/workflows/, then runs gh aw compile workflows/squad.md --strict.

#1682 added safe-outputs.dispatch-workflow: { workflows: [squad-implement-worker] } to workflows/squad.md. gh aw compile --strict (local version v0.85.4) validates that dispatch target against a .github/workflows/ directory it computes relative to the compiled file, assuming the standard depth <root>/.github/workflows/<file>.md. This repo's real gh-aw source lives one level shallower, at <root>/workflows/<file>.md, so gh aw's computed root lands one directory too high - the parent of the actual workspace/repo root. It can never find squad-implement-worker, and --strict compilation fails:

dispatch-workflow: workflow 'squad-implement-worker' not found in <...>/.github/workflows
Checked for: squad-implement-worker.md, .lock.yml, .yml, .yaml

I reproduced this locally in a clean temp git repo containing only workflows/, and independently confirmed the off-by-one behavior against the real repo root as well. squad-implement-worker.md is present and committed on dev - this was never a missing-source problem, only a test-workspace-layout problem.

What I changed (and why)

Only test/gh-aw-quality.test.ts. workflows/squad.md, workflows/squad-implement-worker.md, and #1682's dispatch-workflow feature surface are completely untouched - I did not revert, weaken, or touch the feature in any way.

In the compile test:

  • Copy workflows/ into <workspace>/.github/workflows/ instead of <workspace>/workflows/.
  • Compile .github/workflows/squad.md (was workflows/squad.md), and read the resulting lock file from the matching path.
  • This mirrors exactly how real downstream consumers install and compile this repo's workflows per docs/src/content/docs/guide/gh-aw.md: gh aw add owner/squad/workflows/squad-implement-worker.md@dev owner/squad/workflows/squad.md@dev lands both .md files together in the consumer's own .github/workflows/, alongside shared/*.md, which is the layout gh aw compile --strict's dispatch-workflow validation actually expects.
  • I verified this placement in a fully isolated compile (outside this repo/worktree entirely): with .github/workflows/ layout, gh aw compile .github/workflows/squad.md --strict succeeds (exit 0, 1 succeeded, 2 warnings, dispatch-workflow resolves).
  • That same isolated compile also revealed a second, previously-passing assertion in this test needed updating: gh aw records {{#runtime-import ...}} placeholder paths relative to the repo root, not relative to the compiled file's directory. With this real layout the compiled output legitimately contains {{#runtime-import .github/workflows/shared/planning-ontology.md}} and {{#runtime-import .github/workflows/squad.md}} (previously asserted as the bare shared/planning-ontology.md / squad.md, which only held for the old, incorrect bare-workflows/ test layout). Updated both literal assertions to match gh aw's genuine, verified behavior.
  • Added a 20s explicit test timeout (gh aw compile subprocess reliably takes ~2-3s, but can exceed vitest's 5s default under full-suite parallel resource contention on some machines - observed this directly while re-running the full suite for verification; this is a low-risk hardening of the exact test being touched, not scope creep).

Local verification

  • npx vitest run test/gh-aw-quality.test.ts -t "strict-compiles": 1 passed, 78 skipped.
  • Full gh-aw-quality.test.ts file: the only remaining failures (12) are pre-existing, unrelated, Windows-only execSync(..., { shell: '/bin/sh' }) calls (Team Guard roster-row detection, Cast PR dedup jq filter) that ENOENT because /bin/sh doesn't exist on Windows. These are not caused by this change and were already confirmed (via the real failing CI run's logs) not to occur on Linux CI, where only this one dispatch-workflow test failed.
  • Full npx vitest run (all ~272 test files, ~7500 tests) on this Windows dev machine: pre-existing, unrelated flakiness exists independent of this change (roughly 60-65 of 272 files fail even on a clean dev checkout, mostly Windows//bin/sh and environment-specific issues) - I confirmed this is not a regression by diffing my change against a stashed/reverted state and re-running. My diff is a single, 26-line change to one test's workspace setup and two literal assertions; nothing else was touched.
  • Note for reviewers: running the full suite also has a pre-existing side effect where some build/test step rewrites ~150 template files in the working tree with different line endings, and stamps a version comment into .github/agents/squad.agent.md. This is unrelated repo behavior (not part of my diff) - I reverted it every time it appeared and confirmed via git diff --stat -w that it is pure line-ending churn plus one unrelated version-stamp side effect, before committing.

Note on why dev looked green on the release gate despite this

squad-release.yml runs node --test test/*.test.cjs, while PR CI runs vitest. test/gh-aw-quality.test.ts is a .ts file the release gate's glob never sees, so this red vitest test did not block dev -> main promotion (e.g. the v0.12.0 release-prep PR #1691 merged despite it). Worth knowing if dev looks green from the release workflow's perspective while PR CI disagrees.

Confirming #1682 is untouched

  • git diff for this PR touches only test/gh-aw-quality.test.ts.
  • workflows/squad.md's dispatch-workflow, issue_number/aw_context inputs, and bots: trigger are all present, unmodified, on this branch.
  • workflows/squad-implement-worker.md is unmodified.

@bradygaster - flagging directly since you own #1682 and the dispatch-workflow feature; this PR only adjusts how the test verifies it compiles, it does not change the feature's behavior or configuration.

test/gh-aw-quality.test.ts's compiled-workflow-contract test copied
workflows/ into a bare workflows/ dir inside the ephemeral test git
repo, then ran gh aw compile workflows/squad.md --strict. Since
#1682 added safe-outputs.dispatch-workflow (workflows: [squad-implement-worker])
to workflows/squad.md, gh aw v0.85.4's dispatch-workflow validation now
resolves its expected .github/workflows/ location relative to the
compiled file, assuming the standard <root>/.github/workflows/<file>.md
depth. Because this repo's source lives one level shallower, at
<root>/workflows/<file>.md, gh aw's resolution lands one directory
too high (confirmed empirically against both the test workspace and
the real repo root), so it can never find squad-implement-worker and
fails --strict compilation. This is the sole cause of dev's vitest
red status since 2026-08-12T23:39.

Fix: mirror the real downstream deployment layout inside the test
workspace instead - copy workflows/ into <workspace>/.github/workflows/
and compile .github/workflows/squad.md, matching exactly how
docs/src/content/docs/guide/gh-aw.md documents real installs via
gh aw add owner/squad/workflows/squad-implement-worker.md@dev
owner/squad/workflows/squad.md@dev (both files land side-by-side in
the consumer's .github/workflows/). Verified this placement in an
isolated compile outside any repo/worktree - dispatch-workflow
resolves and compile succeeds with exit 0.

This also changes the compiled runtime-import placeholder paths from
bare shared/planning-ontology.md to .github/workflows/shared/planning-ontology.md,
which is gh-aw's genuine, repo-root-relative behavior for that layout
(reproduced in the same isolated compile) - updated the two literal
assertions to match. Added a 20s test timeout since gh aw compile can
exceed vitest's 5s default under full-suite parallel load.

workflows/squad.md, workflows/squad-implement-worker.md, and #1682's
dispatch-workflow feature are completely untouched.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 13, 2026 12:46
@github-actions

Copy link
Copy Markdown
Contributor

🟢 Impact Analysis — PR #1697

Risk tier: 🟢 LOW

📊 Summary

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

🎯 Risk Factors

  • 1 files changed (≤5 → LOW)
  • 1 module(s) touched (≤1 → LOW)

📦 Modules Affected

tests (1 file)
  • test/gh-aw-quality.test.ts

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

@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 2ccdd37

PR Scope: 🔧 Infrastructure

⚠️ 2 item(s) to address before review

Status Check Details
Single commit 1 commit — clean history
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 1 unresolved Copilot thread(s) — fix and resolve before merging
CI passing All checks passing

Files Changed (1 file, +26 −6)

File +/−
test/gh-aw-quality.test.ts +26 −6

Total: +26 −6


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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the gh aw compile --strict contract test workspace layout to mirror real downstream installs (.github/workflows/), so dispatch-workflow validation can resolve squad-implement-worker correctly and the test stops failing on CI.

Changes:

  • Copy workflows/ into <workspace>/.github/workflows/ and compile .github/workflows/squad.md in the ephemeral test repo.
  • Update runtime-import literal expectations to match paths recorded relative to the repo root under the new layout.
  • Add an explicit 20s timeout to reduce flakiness from gh aw compile subprocess duration under contention.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

// Mirror that real deployment layout in the ephemeral test workspace (instead
// of a bare `workflows/` copy) so the dispatch target `squad-implement-worker`
// resolves the same way it will for every real downstream install.
cpSync(WORKFLOWS_DIR, join(workspace, '.github', 'workflows'), { recursive: true });
@tamirdresher
tamirdresher merged commit daf64fb into dev Aug 13, 2026
16 checks passed
@tamirdresher
tamirdresher deleted the squad/fix-gh-aw-implement-worker branch August 13, 2026 14:03
shantanusharma pushed a commit to shantanusharma/squad that referenced this pull request Aug 15, 2026
dev's git history was orphaned on 2026-07-13 (root commit 4c5772c,
196 commits) and no longer shares a common ancestor with main (root
commit f4830e4, 1722 commits). This silently blocked promotion:
`git merge-base dev main` fails outright and PR bradygaster#1698 (dev -> main)
is unmergeable as a result. The v0.11.0 promotion (2026-06-29)
predates the reset, which is why it succeeded and this one cannot.

This merges upstream/main into dev with --allow-unrelated-histories
to give the two branches a real common ancestor again, so future
dev -> main promotions work through normal fast-forward/merge
mechanics instead of hitting this dead end.

Conflict resolution policy (277 add/add conflicts, all resolved in
dev's favor):
- dev is the live 0.12.0 release line; main is 44 days stale.
- Verified the one main-only code fix, bradygaster#1415
  (`tools: ['*']` in .github/agents/squad.agent.md), is already
  present on dev, so taking dev's side loses no code.
- All conflicts resolved via `git checkout --ours` (dev) + `git add`.
- Verified afterward: package.json / packages/squad-cli/package.json /
  packages/squad-sdk/package.json still read 0.12.0; CHANGELOG.md
  still holds the `## [0.12.0] - 2026-08-12` entry; test/gh-aw-quality
  .test.ts still holds the bradygaster#1697 `.github/workflows` layout fix;
  workflows/squad.md and workflows/squad-implement-worker.md still
  hold the bradygaster#1682 feature.

Non-conflicting content that arrived from main (~60 files):
- Restored (content lost in the July reset): 7 docs pages under
  docs/src/content/{blog,docs}/ and 5 .squad/decisions/inbox/*.md
  decision records. The 5 decision files matched a gitignore pattern
  for new `git add` but were mechanically staged fine via the merge
  itself (already-tracked-on-main content merges at the object level
  and isn't filtered by .gitignore), so all 12 were kept.
- 6 agent history.md / decisions.md files auto-merged cleanly
  (three-way, non-conflicting) and are kept as-is: they interleave
  older content from main with dev's newer entries, recovering more
  history lost in the reset.
- Dropped: 48 .changeset/*.md files that arrived from main. They are
  already consumed into CHANGELOG.md's 0.12.0 entry; re-adding them
  risks tripping the Changeset Drift check for content that's already
  released. .changeset/ after this merge contains exactly what dev
  had (README.md, config.json, max-reasoning-effort.md).

Net effect verified via `git diff --cached --stat`: only 18 files
show a real diff versus dev's tip (the 12 restored files + 6
auto-merged history files); all 275 conflict resolutions and all 48
changeset removals are no-ops against dev's existing tree.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

2 participants