refactor(ci): consolidate the CI-env scrubber into a shared testing module#1442
Conversation
|
This pull request is part of a Mergify stack:
|
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 👀 Review RequirementsWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 ReviewsWonderful, this rule succeeded.
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
32cbcd9 to
c542b1f
Compare
9484593 to
3e6ba1c
Compare
Revision history
|
3e6ba1c to
6d57a9c
Compare
c542b1f to
141fec6
Compare
3d06f0f to
d7c68e9
Compare
d7c68e9 to
5b8ad61
Compare
|
@jd this pull request is now in conflict 😩 |
…odule `with_ci_env` (clear every CI-provider env var before applying test overrides) lived in two copies — one inside the `tests` sub-module of `detector.rs`, one inside `scopes_send.rs` (which also had a `with_ci_env_async` counterpart). Both spelled the same 10-var list inline; both were drifting candidates. Extract to a new `crate::testing` (`#[cfg(test)] mod testing`) with the env-var list named as a const, sync + async variants behind one helper that builds the override list. Each test module now does a plain `use crate::testing::with_ci_env;`. Net `-71 / +51`. No behavior change; the existing 49 `mergify-ci` tests still pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Change-Id: Icd8c84417ad51b242cc8d9664d1cd40fff744497
5b8ad61 to
ac2002a
Compare
There was a problem hiding this comment.
Pull request overview
Consolidates two duplicated with_ci_env test helpers (in detector.rs and scopes_send.rs) into a new crate-level #[cfg(test)] mod testing module. The shared helper centralizes the CI-provider env var list and exposes both sync and async variants, also adding GITHUB_OUTPUT to the scrub list to avoid clobbering a GHA runner's step-output file when the suite runs on Actions.
Changes:
- New
crates/mergify-ci/src/testing.rswithCI_ENV_VARSconst pluswith_ci_env/with_ci_env_asynchelpers built ontemp_env. - Removed inline helpers in
detector.rsandscopes_send.rs, replaced withuse crate::testing::.... - Wired the new module via
#[cfg(test)] mod testing;inlib.rs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/mergify-ci/src/testing.rs | New shared test helper module with const env-var list and sync/async scrubbers. |
| crates/mergify-ci/src/scopes_send.rs | Drops duplicated sync+async helpers, imports shared ones. |
| crates/mergify-ci/src/detector.rs | Drops duplicated sync helper, imports shared one. |
| crates/mergify-ci/src/lib.rs | Registers the new testing module under #[cfg(test)]. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge Queue Status
This pull request spent 23 seconds in the queue, including 3 seconds running CI. Required conditions to merge
|
#1443) Two unrelated polish items grouped because each is too small for its own commit: 1. Module docs across `mergify-core`, `mergify-config`, `mergify-queue`, `mergify-cli`, and `mergify-py-shim` were pinned to the phase numbering the port plan used during bootstrapping ("Phase 1.2 populates…", "Phase 1.7 ports…", "Phase 6 deletes…"). Those references no longer aid the reader and contradict the project rule about not embedding phase numbers in long-lived artifacts — rewrite each docstring to describe the module's *current* shape and let `git log` reconstruct the trajectory if anyone needs it. 2. `freeze/list.rs::write_row` still had an `if theme.enabled { … theme.fg(c) } else { Style::new() }` branch around the Status cell — the same redundant indirection the earlier dedup pass removed elsewhere. `Theme::fg` already collapses to `Style::new()` when colors are disabled, so the outer branch is pure noise. Drop it. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Depends-On: #1442
with_ci_env(clear every CI-provider env var before applyingtest overrides) lived in two copies — one inside the
testssub-module of
detector.rs, one insidescopes_send.rs(whichalso had a
with_ci_env_asynccounterpart). Both spelled the same10-var list inline; both were drifting candidates.
Extract to a new
crate::testing(#[cfg(test)] mod testing) withthe env-var list named as a const, sync + async variants behind one
helper that builds the override list. Each test module now does a
plain
use crate::testing::with_ci_env;.Net
-71 / +51. No behavior change; the existing 49mergify-citests still pass.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com