Skip to content

test(windows): restore MISE_TRUSTED_CONFIG_PATHS after the trust suite - #11948

Merged
jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:test/windows-trusted-paths-env-restore
Aug 13, 2026
Merged

jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:test/windows-trusted-paths-env-restore

Conversation

@JamBalaya56562

@JamBalaya56562 JamBalaya56562 commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

e2e-win/trusted_config_paths.Tests.ps1's AfterAll removed MISE_TRUSTED_CONFIG_PATHS
outright. Pester runs every suite in one process, so if the process had inherited a value, it was
gone for whatever suite ran next.

Saved in BeforeAll, restored in AfterAll — removed only when there was nothing to restore:

$script:OriginalTrusted = [Environment]::GetEnvironmentVariable('MISE_TRUSTED_CONFIG_PATHS', 'Process')
…
if ($null -eq $script:OriginalTrusted) {
    Remove-Item Env:MISE_TRUSTED_CONFIG_PATHS -ErrorAction Ignore
} else {
    [Environment]::SetEnvironmentVariable('MISE_TRUSTED_CONFIG_PATHS', $script:OriginalTrusted, 'Process')
}

AfterEach is unchanged: it clears the var between this suite's own tests, each of which sets it
explicitly. Only the cross-suite leak needed fixing.

This is the same pattern the new suites in #11937 use. The one other file with the same clear-only
AfterAll is task.Tests.ps1, fixed alongside its other changes in #11924 — the two were split so
each lands with the file it belongs to.

Test-only, one file. Windows Pester tests do not run in a Linux container, so windows-e2e is
what exercises it.

Summary by CodeRabbit

  • Bug Fixes
    • Improved end-to-end test cleanup by preserving and restoring the MISE_TRUSTED_CONFIG_PATHS environment setting, preventing test runs from affecting subsequent processes.

`AfterAll` removed the variable outright. Pester runs every suite in one
process, so an inherited value was lost for whatever suite ran next. Save it
in `BeforeAll` and restore it -- or remove it only when there was nothing to
restore. `AfterEach` still clears it between this suite's own tests, which
each set it explicitly.

The same clear-only pattern in task.Tests.ps1 is fixed in jdx#11924.
@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 55dfe30e-988c-4303-8db9-db09d3a9fb68

📥 Commits

Reviewing files that changed from the base of the PR and between 84579c0 and 144847b.

📒 Files selected for processing (1)
  • e2e-win/trusted_config_paths.Tests.ps1

📝 Walkthrough

Walkthrough

The Windows test suite now preserves the initial process-level MISE_TRUSTED_CONFIG_PATHS value and restores it after the tests. Teardown removes the variable only when it was initially unset.

Changes

Trusted configuration test isolation

Layer / File(s) Summary
Environment state restoration
e2e-win/trusted_config_paths.Tests.ps1
Setup saves the original MISE_TRUSTED_CONFIG_PATHS value. Teardown restores the value or removes the variable when it was initially unset.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Mergeability Score: ⚪ Minimal · up to 14484

This test-only change restores the process environment state after the Windows trust suite and does not introduce an actionable merge-blocking risk; it is merge-ready after normal checks and review.

Poem

I’m a rabbit guarding paths in the night,
Saving each setting and setting it right.
If none was there, I clear the trace,
If one was there, I put it in place.
Tests hop onward, clean and bright.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes restoring MISE_TRUSTED_CONFIG_PATHS after the Windows trust test suite.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@JamBalaya56562
JamBalaya56562 marked this pull request as ready for review August 13, 2026 18:10
@greptile-apps

greptile-apps Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes Windows Pester test isolation by preserving the process's original MISE_TRUSTED_CONFIG_PATHS value and restoring it after the trust suite.

  • Captures the original process-scoped value during BeforeAll.
  • Restores non-null values during AfterAll, while keeping the variable absent when it was originally unset.

Confidence Score: 5/5

The PR appears safe to merge because the changed suite now restores the process environment state it inherited.

The save and cleanup operations use the same process environment scope, distinguish an unset variable from an empty or non-empty value, and run in the correct Pester lifecycle order.

Important Files Changed

Filename Overview
e2e-win/trusted_config_paths.Tests.ps1 Correctly adds null-aware process-environment preservation around the suite without changing its existing per-test cleanup.

Reviews (1): Last reviewed commit: "test(windows): restore MISE_TRUSTED_CONF..." | Re-trigger Greptile

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