Skip to content

fix: return 404 on deploy/stop for non-existent workflow IDs#137

Merged
intel352 merged 2 commits intofeat/issue-86-admin-decomp-bfrom
copilot/sub-pr-123
Feb 23, 2026
Merged

fix: return 404 on deploy/stop for non-existent workflow IDs#137
intel352 merged 2 commits intofeat/issue-86-admin-decomp-bfrom
copilot/sub-pr-123

Conversation

Copy link
Contributor

Copilot AI commented Feb 23, 2026

The deploy and stop pipeline routes were performing an UPDATE then returning steps.get-workflow.row unconditionally — when the workflow ID didn't exist, db_query (mode: single) returned found: false with an empty row, causing a 200 {} response instead of a 404.

Changes

  • Both /deploy and /stop pipelines: added check-exists (step.db_query) + check-found (step.conditional) before the UPDATE, consistent with the PUT/DELETE workflow route pattern
  • If the workflow is not found, the pipeline short-circuits to a not-found step returning 404 {"error": "workflow not found"}
  • The UPDATE is skipped entirely for non-existent IDs
- name: check-exists
  type: step.db_query
  config:
    database: admin-db
    query: "SELECT id FROM workflows WHERE id = ?"
    params: ["{{index .steps \"parse-request\" \"path_params\" \"id\"}}"]
    mode: single
- name: check-found
  type: step.conditional
  config:
    field: "steps.check-exists.found"
    routes:
      "false": not-found
    default: set-now
# ... activate/deactivate, get-workflow, respond ...
- name: not-found
  type: step.json_response
  config:
    status: 404
    body:
      error: "workflow not found"

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Copilot AI changed the title [WIP] Decompose V1 CRUD routes into pipeline primitives fix: return 404 on deploy/stop for non-existent workflow IDs Feb 23, 2026
Copilot AI requested a review from intel352 February 23, 2026 14:44
@intel352 intel352 marked this pull request as ready for review February 23, 2026 16:10
@intel352 intel352 merged commit ed82e90 into feat/issue-86-admin-decomp-b Feb 23, 2026
@intel352 intel352 deleted the copilot/sub-pr-123 branch February 23, 2026 16:10
intel352 added a commit that referenced this pull request Feb 23, 2026
* feat: decompose V1 CRUD routes into pipeline primitives (#86)

Replace 6 V1 admin CRUD routes that delegated to V1APIHandler with
declarative pipeline definitions using admin-db:

- POST /api/v1/admin/organizations/{id}/projects (create project)
- POST /api/v1/admin/projects/{id}/workflows (create workflow in project)
- POST /api/v1/admin/workflows (create workflow)
- PUT /api/v1/admin/workflows/{id} (update workflow + version)
- POST /api/v1/admin/workflows/{id}/deploy (deploy workflow)
- POST /api/v1/admin/workflows/{id}/stop (stop workflow)

Each route now uses pipeline steps (request_parse, validate, set,
db_exec, db_query, conditional, json_response) instead of Go delegates.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: return 404 on deploy/stop for non-existent workflow IDs (#137)

* Initial plan

* fix: add 404 handling to deploy and stop workflow pipelines

Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>

---------

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