feat(circleci): add read/workflow insights components#3235
feat(circleci): add read/workflow insights components#3235bitdeckai wants to merge 2 commits intosuperplanehq:mainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on March 12
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| if err != nil { | ||
| return err | ||
| } | ||
| workflow, err := client.GetWorkflow(config.WorkflowID) |
There was a problem hiding this comment.
Workflow data silently lost due to typed struct
Medium Severity
The GetWorkflow component calls client.GetWorkflow() which unmarshals into WorkflowResponse — a struct with only 5 fields (id, name, status, created_at, stopped_at). The CircleCI API returns additional fields like pipeline_id, pipeline_number, project_slug, started_by, and tag, all silently dropped during deserialization. When Emit() calls json.Marshal() on the output, only those 5 fields are preserved. The same data loss affects GetLastWorkflow via GetPipelineWorkflows(). All the other new read components correctly use map[string]any to preserve complete API responses.
Additional Locations (1)
| return map[string]any{ | ||
| "pipeline": pipelineResp, | ||
| "workflows": []any{}, | ||
| }, nil |
There was a problem hiding this comment.
Inconsistent pipeline field shape across code paths
Medium Severity
When no pipelines are found, the pipeline field is set to pipelineResp — the full paginated list response (containing items, next_page_token, etc.). When pipelines are found, pipeline is set to firstItem — a single pipeline object (containing id, number, state, etc.). Downstream consumers processing result["pipeline"] will encounter a completely different schema depending on whether pipelines exist, likely causing failures when accessing expected fields like id.


Summary
Adds five new CircleCI integration components and client methods to support read/insights use cases requested in #3223.
New components
What changed
Notes
Closes #3223