Skip to content

feat(pipeline): add search command#1269

Open
schurchleycci wants to merge 2 commits intonextfrom
add-pipeline-search
Open

feat(pipeline): add search command#1269
schurchleycci wants to merge 2 commits intonextfrom
add-pipeline-search

Conversation

@schurchleycci
Copy link
Copy Markdown

@schurchleycci schurchleycci commented May 4, 2026

Summary

  • Adds circleci pipeline search wrapping POST /api/v2/pipeline/search. Takes a raw filter expression via --filter plus --after/--before for date scoping. For simple branch filtering use circleci pipeline list; this command is the door to the filter-expression API.
  • Adds apiclient.FlexTime so JSON decoding tolerates the empty timestamp strings the search endpoint returns on some pipelines.
  • Extends the fake CircleCI server with a /pipeline/search handler that records the most recent request body so tests can assert the filter passes through unchanged.

Notes

  • --project selects the project (slug like gh/org/repo) and defaults to the current git remote, matching the rest of the pipeline group.
  • actor.id requires a UUID, not a login. Called out in Long.
  • If --after/--before are omitted, the API applies its own ~2-week default window. Documented in Long.

Test plan

  • task build succeeds
  • task lint clean (only the pre-existing gosec finding in internal/iostream/drain_bsd.go remains, unrelated to this PR)
  • Full acceptance + unit suites pass (go test -count=1 ./...)
  • Live smoke against gh/CircleCI-Public/circleci-cli: default search, --filter 'pipeline.git.branch == "next"', pipeline.git.branch starts-with "feat/", --after, --json --jq
  • New acceptance coverage:
    • TestPipelineSearch — golden table output
    • TestPipelineSearch_JSON — golden JSON output
    • TestPipelineSearch_WithFilter — raw filter passes through unchanged
    • TestPipelineSearch_EmptyTimestamp — verifies FlexTime handles the empty-string created_at/updated_at the API returns
    • TestPipelineSearch_EmptyResults — empty result path

🤖 Generated with Claude Code

@schurchleycci schurchleycci force-pushed the add-pipeline-search branch from 9109194 to 6c71211 Compare May 4, 2026 14:53
Wraps POST /pipeline/search with structured shorthand flags (--branch,
--actor, --state) and a --filter escape hatch for raw expressions. Adds
FlexTime to handle empty timestamp strings the search endpoint returns
on early-lifecycle pipelines, scoped to SearchPipeline only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@schurchleycci schurchleycci force-pushed the add-pipeline-search branch from 6c71211 to 915a025 Compare May 4, 2026 14:56
@schurchleycci schurchleycci marked this pull request as ready for review May 4, 2026 14:58
SearchPipelines treated len(all) >= limit as a stop condition without
guarding for non-positive limit, so --limit -5 panicked on all[:-5] and
--limit 0 returned an empty slice masking real results. Match the
ListPipelines guard, and reject non-positive --limit at the cmd layer
with ExitBadArguments so the contract is explicit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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.

1 participant