feat(ci-insights): Add mergify tests show command#1382
Conversation
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🔴 👀 Review RequirementsWaiting for
This rule is failing.
🔴 🔎 ReviewsWaiting for
This rule is failing.
🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
mergify ci tests lookup commandmergify ci tests lookup command
6544154 to
57267f7
Compare
Revision history
|
There was a problem hiding this comment.
Pull request overview
Adds a new native Rust mergify ci tests lookup command to batch-resolve CI Insights test identities by name (glob-aware), fetch per-test health/metrics, and render either human output or a single JSON payload. This extends the Rust-native mergify ci surface area and introduces a reusable HTTP helper for ordered/repeated query parameters.
Changes:
- Add
mergify ci tests lookup NAME...command (CLI wiring, API calls, rendering, exit-code aggregation, and unit tests). - Add
HttpClient::get_with_queryto support ordered/repeated query params with proper encoding. - Update docs and add a live smoke test exercising the lookup endpoint.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| skills/mergify-ci/SKILL.md | Documents the new ci tests lookup command, options, and exit codes. |
| README.md | Mentions test health inspection under the mergify ci command group. |
| func-tests/test_live_smoke.py | Adds a live smoke test for the lookup endpoint (no-match path). |
| crates/mergify-core/src/http.rs | Introduces get_with_query plus unit tests for ordering/encoding behavior. |
| crates/mergify-cli/src/main.rs | Adds clap subcommand plumbing + native dispatch for ci tests lookup and JSON mode selection. |
| crates/mergify-ci/src/tests_lookup.rs | Implements lookup + details fan-out, rendering, JSON payload, exit code policy, and tests. |
| crates/mergify-ci/src/lib.rs | Exposes the new tests_lookup module. |
| crates/mergify-ci/src/detector.rs | Adds split_owner_repo helper with tests. |
| crates/mergify-ci/Cargo.toml | Adds Rust deps needed by the new command (chrono, futures). |
| Cargo.lock | Lockfile updates for newly introduced/updated dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
57267f7 to
3d1d1d8
Compare
|
@remyduthu this pull request is now in conflict 😩 |
mergify ci tests lookup commandmergify ci tests show command
3d1d1d8 to
10479a6
Compare
Code reviewFound 1 issue:
🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
51d9b34 to
099fc3a
Compare
099fc3a to
7a3a0d2
Compare
mergify ci tests show commandmergify tests show command
7a3a0d2 to
93627c6
Compare
|
|
||
| [dependencies] | ||
| chrono = { version = "0.4", default-features = false, features = ["clock", "serde", "std"] } | ||
| futures = { version = "0.3", default-features = false, features = ["std"] } |
There was a problem hiding this comment.
Fair question — and on a second look the dep wasn't earning its slot. Dropped in fb35e47: fetch_all_details now uses tokio::task::JoinSet (rt feature only, no new top-level crate) for the same bounded fan-out (5 concurrent detail fetches, input order preserved). Clean rebuild no longer compiles the futures meta crate or its -executor/-macro/-sink/-io siblings.
93627c6 to
a42941c
Compare
Wraps two CI Insights endpoints into a single batch command:
- `GET /v1/ci/{owner}/repositories/{repo}/search/tests` resolves test
identities by name (glob-aware) on the default branch. Filters
(`test_name`, `pipeline_name`, `job_name`, …) travel as repeated
query parameters; page size travels as `per_page`.
- `GET /v1/ci/{owner}/repositories/{repo}/tests/{test_id}` returns the
full health/metrics payload for one identity.
The search is a true batch API — pass one or more `<NAME>` positionals
(globs allowed) and one block per match is rendered. `--json` emits a
single `{"tests": [...]}` document; the human renderer hides metadata
lines for absent fields rather than printing placeholders. Exit code
reflects the worst health observed across results (0 = healthy or
unknown, 1 = any flaky, 6 = any broken).
Token and API URL resolution moved from `scopes_send.rs` into a new
`common.rs` so every Mergify-targeting `ci` subcommand shares the same
explicit-flag → env-var → default fallback chain. `split_owner_repo`
moved into `detector.rs` next to the existing `owner/repo` validators.
A new `HttpClient::get_with_query` helper percent-encodes values and
preserves repeated keys in caller order, which the search endpoint
relies on for `test_name` repetition.
Also adds a live-smoke case that exercises the search endpoint with a
guaranteed-nonexistent name so the round-trip stays independent of
canary repository state.
Fixes: MRGFY-7166
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Change-Id: Iafe286495b7842079e9c63b437a6305926fc22a5
a42941c to
fb35e47
Compare
Wraps two CI Insights endpoints into a single batch command:
GET /v1/ci/{owner}/repositories/{repo}/search/testsresolves testidentities by name (glob-aware) on the default branch. Filters
(
test_name,pipeline_name,job_name, …) travel as repeatedquery parameters; page size travels as
per_page.GET /v1/ci/{owner}/repositories/{repo}/tests/{test_id}returns thefull health/metrics payload for one identity.
The search is a true batch API — pass one or more
<NAME>positionals(globs allowed) and one block per match is rendered.
--jsonemits asingle
{"tests": [...]}document; the human renderer hides metadatalines for absent fields rather than printing placeholders. Exit code
reflects the worst health observed across results (0 = healthy or
unknown, 1 = any flaky, 6 = any broken).
Token and API URL resolution moved from
scopes_send.rsinto a newcommon.rsso every Mergify-targetingcisubcommand shares the sameexplicit-flag → env-var → default fallback chain.
split_owner_repomoved into
detector.rsnext to the existingowner/repovalidators.A new
HttpClient::get_with_queryhelper percent-encodes values andpreserves repeated keys in caller order, which the search endpoint
relies on for
test_namerepetition.Also adds a live-smoke case that exercises the search endpoint with a
guaranteed-nonexistent name so the round-trip stays independent of
canary repository state.
Fixes: MRGFY-7166
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com