Skip to content

refactor(pwsh): hoist Test-InMux into 05-lib as the single pane-detection source#76

Merged
Gerrrt merged 1 commit into
mainfrom
refactor/share-test-inmux
Jul 1, 2026
Merged

refactor(pwsh): hoist Test-InMux into 05-lib as the single pane-detection source#76
Gerrrt merged 1 commit into
mainfrom
refactor/share-test-inmux

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

What

Moves the "are we inside a psmux pane?" check into the pure helper layer (core/05-lib.ps1) as Test-InMux, exported from the Dotfiles module, and points both call sites at it. Follow-up to #75.

Why

os/30-windows.ps1 (psmux auto-attach guard) and os/33-psmux-pill.ps1 (pill auto-arm/status) each hand-maintained their own pane-marker list — and had drifted. 30-windows checked PSMUX / PSMUX_PANE (which psmux does not export), while the pill used the verified TMUX + PSMUX_SESSION pair. #75 fixed 30-windows' markers inline; this removes the possibility of drift entirely by giving both one source of truth.

Changes

  • core/05-lib.ps1 — new pure Test-InMux (TMUX + PSMUX_SESSION, per psmux src/pane.rs). Updated provides:.
  • Dotfiles.psd1 — export Test-InMux.
  • os/30-windows.ps1$InMux = Test-InMux; dropped the inline list. Updated requires:.
  • os/33-psmux-pill.ps1 — removed the local script:Test-InMux copy; call sites use the shared one. Updated requires:.
  • tests/Lib.Tests.ps1Test-InMux cases with env save/restore.
  • tests/Module.Tests.ps1 — document the export.

Verification

  • Pre-commit validation suite passed; manifest validates.
  • Test-InMux behavioral check: no markers → $false, TMUX$true, PSMUX_SESSION$true.
  • Replicated the strict LoadContract requires:-vs-AST computation for all three touched fragments → exact match.
  • Full Pester v5 suite runs on the Windows CI runner (only in-box Pester 3.4 is present locally).

🤖 Generated with Claude Code

…tion source

os/30-windows.ps1 (psmux auto-attach guard) and os/33-psmux-pill.ps1 (pill
auto-arm/status) each hand-maintained their own "are we inside a psmux pane?"
marker list, and had already drifted — 30-windows checked PSMUX / PSMUX_PANE
(which psmux does not export) while the pill used the verified TMUX +
PSMUX_SESSION pair. Move the check into the pure helper layer (core/05-lib.ps1)
as Test-InMux, export it from the Dotfiles module, and have both call sites use
it, so the marker set lives in exactly one place and can't drift again.

Adds Test-InMux unit tests (env save/restore) and documents the export.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 1, 2026 22:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates “inside a psmux pane” detection into a single shared helper (Test-InMux) in the core helper layer, exports it from the Dotfiles module, and updates the two previously-drifting call sites to use that shared implementation.

Changes:

  • Added Test-InMux to powershell/core/05-lib.ps1 and exported it via powershell/Dotfiles/Dotfiles.psd1.
  • Replaced duplicated / drifting pane-marker logic in powershell/os/30-windows.ps1 and powershell/os/33-psmux-pill.ps1 with the shared Test-InMux.
  • Added Pester coverage for Test-InMux and documented the new export in the module export tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/Module.Tests.ps1 Adds Test-InMux to the expected exported-functions list.
tests/Lib.Tests.ps1 Adds unit tests validating Test-InMux behavior with env var save/restore.
powershell/os/33-psmux-pill.ps1 Removes local Test-InMux copy and uses the shared helper; updates load-contract requires.
powershell/os/30-windows.ps1 Uses shared Test-InMux for the psmux auto-attach guard; updates load-contract requires.
powershell/Dotfiles/Dotfiles.psd1 Exports Test-InMux from the Dotfiles module.
powershell/core/05-lib.ps1 Introduces the shared Test-InMux implementation and updates load-contract provides.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Gerrrt Gerrrt merged commit 7ae7c99 into main Jul 1, 2026
7 checks passed
@Gerrrt Gerrrt deleted the refactor/share-test-inmux branch July 1, 2026 22:54
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