fix(github-sdlc-planning): coerce JSON-string args before epic-pipeline's mode guard - #322
Merged
Merged
Conversation
…ne's mode guard The Workflow tool can deliver `args` as a JSON-encoded string rather than an object (harness-dependent), so epic-pipeline.workflow.js's first guard -- which reads `args.mode` directly -- hard-failed 4ms in with zero agents run whenever that happened. Coerce a string `args` via JSON.parse before the mode guard, throwing a clear error if it isn't valid JSON, following the same convention already used by the sibling ticket-pipeline.js workflow's args coercion. Covered by a new test (epic-pipeline-workflow-args-coercion.test.ts) that executes the real workflow source -- the Workflow tool runs it as an async function body with args/agent/pipeline/phase/log injected, not as a plain ES module, so the test wraps it the same way query-pipeline-workflow-guard.test.ts does -- confirming plan mode still completes normally with a JSON-string args, a malformed string throws a clear error instead of a raw parse failure, and the existing object-args and missing-mode guard behaviors are unaffected. Closes #321
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a runtime launch failure in the epic-pipeline bundled workflow when the Workflow tool delivers args as a JSON-encoded string instead of an object, by coercing string args before the mode guard and adding unit coverage to prevent regressions.
Changes:
- Coerce stringified
argsviaJSON.parsebefore validatingargs.mode, with a clearer error on malformed JSON. - Add a unit test that executes the real workflow source via the same async-function-body wrapping used by the Workflow tool.
- Verify existing guard behavior remains unchanged for object args and missing
mode.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| plugins/github-sdlc-planning/skills/epic-pipeline/scripts/epic-pipeline.workflow.js | Adds JSON-string args coercion ahead of the mode guard to prevent early hard-fail. |
| plugins/github-sdlc-planning/mcp-server/test/unit/epic-pipeline-workflow-args-coercion.test.ts | Adds regression tests for string-args coercion, malformed JSON handling, and unchanged guard behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Parse a JSON-string args into a fresh resolvedArgs binding instead of reassigning the injected args binding in place, matching the established query-pipeline.workflow.js / ticket-pipeline.js convention. Avoids relying on the injected args binding being mutable (the unit test injects it as a mutable AsyncFunction parameter and cannot detect a const binding) and corrects the comment, which claimed to follow a convention it diverged from.
…ling Copilot review on PR #322 flagged the comment's reference to a 'ticket-pipeline.js' workflow as unresolvable from within this repo -- that script lives in the workspace root, not gdlc. Point the comment at query-pipeline.workflow.js only, the sibling convention that actually lives in this repo (gdlc#300).
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.
What
The Workflow tool can deliver
argsas a JSON-encoded string rather than an object (harness-dependent), soepic-pipeline.workflow.js's first guard — which readsargs.modedirectly — hard-failed 4ms in with zero agents run whenever that happened.Coerces a string
argsviaJSON.parsebefore the mode guard, throwing a clear error if it isn't valid JSON, following the same convention already used by the siblingticket-pipeline.jsworkflow's args coercion.Testing
New test
epic-pipeline-workflow-args-coercion.test.tsexecutes the real workflow source (the Workflow tool runs it as an async function body withargs/agent/pipeline/phase/loginjected, not as a plain ES module — same wrapping approach asquery-pipeline-workflow-guard.test.ts):args(fails before the fix, passes after)modeguard behaviors are unaffectedFull local gates run clean:
npm run typecheck,npm run lint,npm run test(570/570 passed) inplugins/github-sdlc-planning/mcp-server, andnpm run build(Astro/Starlight) at the repo root.Closes #321