Skip to content

Commit df573f7

Browse files
michaelmcneesclaude
andcommitted
fix: use named response types and fix govulncheck filter exit code
- Replace all ad-hoc map[string]any response payloads with their declared named types (ExecutionListResponse, WorkflowListResponse, WorkflowDetailResponse, WorkflowVersionListResponse) so runtime responses match the documented Swagger types and are validated at compile time - Add || true to the ACTIONABLE grep pipeline so grep's non-zero exit when all vulns are excluded doesn't abort the step under set -e - Regenerate swagger.json/yaml Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1cdc247 commit df573f7

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

.github/workflows/engine-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
# Fixed in: N/A — no upstream fix available. Remove exclusions when a patched release ships.
6666
OUTPUT=$(govulncheck ./... 2>&1 || true)
6767
echo "$OUTPUT"
68-
ACTIONABLE=$(echo "$OUTPUT" | grep -E '^Vulnerability #[0-9]+:' | grep -vE 'GO-2026-4887|GO-2026-4883')
68+
ACTIONABLE=$(echo "$OUTPUT" | grep -E '^Vulnerability #[0-9]+:' | grep -vE 'GO-2026-4887|GO-2026-4883' || true)
6969
if [ -n "$ACTIONABLE" ]; then
7070
echo "FAIL: unfixed actionable vulnerabilities found"
7171
exit 1

packages/engine/internal/server/api.go

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func (s *Server) handleListExecutions(w http.ResponseWriter, r *http.Request) {
166166
return
167167
}
168168

169-
writeJSON(w, http.StatusOK, map[string]any{"executions": executions})
169+
writeJSON(w, http.StatusOK, ExecutionListResponse{Executions: executions})
170170
}
171171

172172
// handleGetExecution handles GET /api/v1/executions/{id} with step details.
@@ -385,7 +385,7 @@ func (s *Server) handleListWorkflows(w http.ResponseWriter, r *http.Request) {
385385
if workflows == nil {
386386
workflows = []workflow.WorkflowSummary{}
387387
}
388-
writeJSON(w, http.StatusOK, map[string]any{"workflows": workflows})
388+
writeJSON(w, http.StatusOK, WorkflowListResponse{Workflows: workflows})
389389
}
390390

391391
// handleGetWorkflow handles GET /api/v1/workflows/{name} — returns latest version.
@@ -418,11 +418,10 @@ func (s *Server) handleGetWorkflow(w http.ResponseWriter, r *http.Request) {
418418
return
419419
}
420420

421-
var def json.RawMessage = content
422-
writeJSON(w, http.StatusOK, map[string]any{
423-
"name": name,
424-
"version": version,
425-
"definition": def,
421+
writeJSON(w, http.StatusOK, WorkflowDetailResponse{
422+
Name: name,
423+
Version: version,
424+
Definition: json.RawMessage(content),
426425
})
427426
}
428427

@@ -454,7 +453,7 @@ func (s *Server) handleListWorkflowVersions(w http.ResponseWriter, r *http.Reque
454453
if versions == nil {
455454
versions = []workflow.VersionSummary{}
456455
}
457-
writeJSON(w, http.StatusOK, map[string]any{"name": name, "versions": versions})
456+
writeJSON(w, http.StatusOK, WorkflowVersionListResponse{Name: name, Versions: versions})
458457
}
459458

460459
// handleGetWorkflowVersion handles GET /api/v1/workflows/{name}/versions/{version}.
@@ -490,11 +489,10 @@ func (s *Server) handleGetWorkflowVersion(w http.ResponseWriter, r *http.Request
490489
return
491490
}
492491

493-
var def json.RawMessage = content
494-
writeJSON(w, http.StatusOK, map[string]any{
495-
"name": name,
496-
"version": version,
497-
"definition": def,
492+
writeJSON(w, http.StatusOK, WorkflowDetailResponse{
493+
Name: name,
494+
Version: version,
495+
Definition: json.RawMessage(content),
498496
})
499497
}
500498

0 commit comments

Comments
 (0)