Skip to content

fix(github-sdlc-planning): coerce JSON-string args before epic-pipeline's mode guard - #322

Merged
zircote merged 4 commits into
mainfrom
fix/321-epic-pipeline-args-coercion
Jul 18, 2026
Merged

fix(github-sdlc-planning): coerce JSON-string args before epic-pipeline's mode guard#322
zircote merged 4 commits into
mainfrom
fix/321-epic-pipeline-args-coercion

Conversation

@zircote

@zircote zircote commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

What

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.

Coerces 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.

Testing

New test epic-pipeline-workflow-args-coercion.test.ts 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 — same wrapping approach as query-pipeline-workflow-guard.test.ts):

  • plan mode completes normally with a JSON-string args (fails before the fix, passes after)
  • a malformed JSON string throws a clear error instead of a raw parse failure
  • existing object-args and missing-mode guard behaviors are unaffected

Full local gates run clean: npm run typecheck, npm run lint, npm run test (570/570 passed) in plugins/github-sdlc-planning/mcp-server, and npm run build (Astro/Starlight) at the repo root.

Closes #321

…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

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

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 args via JSON.parse before validating args.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.

zircote added 3 commits July 18, 2026 09:58
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).
@zircote
zircote merged commit 0984d3b into main Jul 18, 2026
35 checks passed
@zircote
zircote deleted the fix/321-epic-pipeline-args-coercion branch July 18, 2026 14:21
zircote added a commit that referenced this pull request Jul 19, 2026
Version-bumped for catalog-lockstep consistency per this repo's
version-discipline convention (issue #49); every plugin picks up the four
fixes merged since v0.11.2 (#326, #325, #322, #323), propagated to
github-pull-requests/github-bug-capture's byte-identical copies where
applicable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

epic-pipeline.workflow.js hard-fails when the Workflow tool delivers args as a JSON string — should coerce before the mode guard

2 participants