refactor(auth): read the environment through the funnel - #1842
Conversation
|
This pull request is part of a Mergify stack:
|
Merge Protections🔴 3 of 7 protections blocking · waiting on 👀 reviews and ⛓️ dependency
🔴 ⛓️ Depends-On RequirementsWaiting for
This rule is failing.Requirement based on the presence of
🔴 👀 Review RequirementsWaiting for
This rule is failing.
🔴 🔎 ReviewsWaiting for
This rule is failing.
Show 4 satisfied protections🟢 🤖 Continuous Integration
🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 📕 PR description
🟢 🚦 Auto-queueWhen all merge protections are satisfied, this pull request will be queued automatically. |
c53311d to
2de27ff
Compare
Revision history
|
There was a problem hiding this comment.
🟢 Approval recommended
No blocking issues were identified; the remaining comment is a minor cleanup nit.
Pull request overview
Refactors mergify-auth tests to use thread-local environment overlays instead of mutating process environment state.
Changes:
- Migrates machine, browser, and token tests to environment overlays.
- Preserves current-thread async token test behavior.
- Removes the crate-level
temp-envdependency and lockfile entry.
File summaries
| File | Description |
|---|---|
crates/mergify-auth/src/machine.rs |
Uses overlays for hostname tests. |
crates/mergify-auth/src/lib.rs |
Updates token-dependent async tests. |
crates/mergify-auth/src/browser.rs |
Uses overlays for browser environment tests. |
crates/mergify-auth/Cargo.toml |
Removes the direct temp-env dependency. |
Cargo.lock |
Removes the unused package entry. |
Review details
Suppressed comments (1)
crates/mergify-auth/Cargo.toml:27
- The crate-level dependency is removed, but
temp-env = "0.3"is still declared in the workspace dependency table atCargo.toml:75, and this is now the only repository reference to it. Please remove the unused workspace entry as part of dropping this dependency so the workspace manifest does not retain dead dependency configuration.
serde_json = { workspace = true }
- Files reviewed: 4/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
`mergify-auth` landed while this stack was in flight and its production side already reads through `mergify_core::env`, since `var_non_empty` predates the funnel. Only its tests were left: `machine`'s `COMPUTERNAME` / `HOSTNAME` chain, `browser`'s `SSH_CONNECTION` / `DISPLAY` / `WAYLAND_DISPLAY` probes, and `with_mergify_token`. They install an overlay now, like everywhere else, so the crate stops mutating the process environment and drops its `temp-env` dependency. `with_mergify_token` keeps its shape: the overlay is on this thread and the `current_thread` runtime it builds drives the future on that same thread, so the closure form still works and no call site changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Change-Id: I7d4c755cee8cc90db511ea671e5c23215300c03c
2de27ff to
6c614fe
Compare
mergify-authlanded while this stack was in flight and itsproduction side already reads through
mergify_core::env, sincevar_non_emptypredates the funnel. Only its tests were left:machine'sCOMPUTERNAME/HOSTNAMEchain,browser'sSSH_CONNECTION/DISPLAY/WAYLAND_DISPLAYprobes, andwith_mergify_token.They install an overlay now, like everywhere else, so the crate
stops mutating the process environment and drops its
temp-envdependency.
with_mergify_tokenkeeps its shape: the overlay is onthis thread and the
current_threadruntime it builds drives thefuture on that same thread, so the closure form still works and no
call site changes.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com