Skip to content

fix(cicd): fix aggregate commands, add --level to events search#526

Merged
platinummonkey merged 1 commit into
DataDog:mainfrom
telecatser:feat/cicd-aggregate-fix-and-level-search
May 26, 2026
Merged

fix(cicd): fix aggregate commands, add --level to events search#526
platinummonkey merged 1 commit into
DataDog:mainfrom
telecatser:feat/cicd-aggregate-fix-and-level-search

Conversation

@telecatser
Copy link
Copy Markdown
Contributor

Summary

Fixes two silent bugs where pup cicd events aggregate and pup cicd tests aggregate called the search API instead of the aggregate API, making those commands return search hits rather than bucketed counts/averages. Also adds --level to pup cicd events search for job/stage/step granularity filtering.

Changes

  • src/commands/cicd.rs: Fix events_aggregate and tests_aggregate to call aggregate_ci_app_pipeline_events / aggregate_ci_app_test_events — previously both called the search API silently
  • src/commands/cicd.rs: Wire compute, group_by, limit args that were previously dropped with .. in both aggregate match arms (src/main.rs)
  • src/commands/cicd.rs: Add --level param to events_search (pipeline/stage/job/step); injects @ci.level:<value> filter into query
  • src/commands/cicd.rs: Replace hand-rolled aggregation function parser with util::parse_compute_raw pattern from traces.rs; compute now uses avg(@duration) / percentile(@duration, 95) syntax — removes the need for a separate --metric flag
  • src/commands/cicd.rs: Simplify 6-line time-parsing boilerplate in 4 functions → util::parse_time_to_datetime().to_rfc3339() (already used in tests_list)
  • src/commands/cicd.rs: Extract build_ci_compute_spec shared helper used by both aggregate functions
  • src/main.rs: Change aggregate limit from i32 to i64 to match the API type directly
  • agents/cicd.md: Fix pup cicd tests flakypup cicd flaky-tests search; fix pipeline search/aggregate → pup cicd events search/aggregate; add test-optimization settings/policies/flaky-test-update commands
  • skills/dd-pup/SKILL.md: Add CI/CD quick-reference rows

Testing

  • All existing tests pass
  • New tests: test_cicd_events_aggregate, test_cicd_tests_aggregate, test_cicd_events_search_invalid_level, test_cicd_events_aggregate_invalid_compute, test_cicd_tests_aggregate_invalid_compute
  • cargo clippy -- -D warnings clean
  • cargo fmt --check clean

🤖 Generated with Claude Code

pup cicd events aggregate and pup cicd tests aggregate were silently
calling the search API instead of the aggregate API, and the compute/
group_by/limit args defined in the CLI enum were dropped with `..`
and never passed through. This meant aggregation returned search hits
rather than bucketed counts/averages, making the feature unusable.

- Fix events_aggregate and tests_aggregate to call the correct
  aggregate_ci_app_pipeline_events / aggregate_ci_app_test_events APIs
- Add --level flag to pup cicd events search (pipeline/stage/job/step)
  for granularity filtering, consistent with the MCP software-delivery
  skill that uses ci_level for unblock-pr workflows
- Replace hand-rolled parse_ci_aggregation_function with util::parse_compute_raw,
  matching the established pattern from traces.rs / logs.rs; compute now
  accepts avg(@duration), percentile(@duration, 95) etc. — no separate
  --metric flag needed
- Simplify time parsing across all cicd functions using the existing
  util::parse_time_to_datetime().to_rfc3339() instead of the 6-line
  manual timestamp-millis conversion block
- Fix agents/cicd.md: correct pup cicd tests flaky → pup cicd flaky-tests
  search, pipeline search → pup cicd events search, add test-optimization
  settings/policies/flaky-test-update commands
- Add CI/CD quick-reference rows to skills/dd-pup/SKILL.md

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@telecatser telecatser marked this pull request as ready for review May 26, 2026 14:04
@telecatser telecatser requested a review from a team as a code owner May 26, 2026 14:04
@platinummonkey platinummonkey merged commit 4fa9863 into DataDog:main May 26, 2026
6 checks passed
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