shmuelie / shmuelie/powershell-modules

Copilot plugin and marketplace discovery hide native command failures

Open
#281 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug module:copilot theme:testing
Dominant language
PowerShell
Stars
0
Forks
0
Avg merge
21m
Merged PRs (30d)
124

Description

Peer-review finding

Reviewed snapshot: 5c38677469756c69f86678c0b907d82e15d0a539.
The reviewer and parent independently reproduced this against unchanged source.
Only fresh synthetic session homes and a fixed non-mutating native stub were
used; no real conversation history, user configuration or Copilot process was
accessed. Do not run destructive reproduction commands against real sessions.

Severity: Medium. Confidence: 10/10.
Suggested existing labels: bug, module:copilot.

Locations: modules\Shmuelie.Copilot\Plugins.ps1:26-29
(Get-CopilotPlugin); modules\Shmuelie.Copilot\Marketplaces.ps1:23-26
(Get-CopilotMarketplace) and 143-146 (Get-CopilotMarketplacePlugin).

These discovery commands capture combined native output and emit only lines
matching their successful-list patterns. They never check the native exit code,
and discarded diagnostics are not surfaced on PowerShell's error stream.
Consequently discovery failure is indistinguishable from an empty installation
or marketplace; dependent pipelines can quietly do no work.

Minimal controlled-native reproduction:

Use a scratch .cmd as the only resolved native boundary:

@echo off
echo Error: synthetic native discovery failure
exit /b 17

With $PSNativeCommandUseErrorActionPreference = $false (the standard opt-out
behavior), redirect the module's command resolver to that stub and invoke each
command with -ErrorAction Stop -ErrorVariable errors. For marketplace browsing,
pass -Name synthetic.

Actual for all three: Native exit code 17, zero result objects, zero error
records, and no caught exception. The diagnostic disappears. No real marketplace,
credentials, or user configuration was accessed.

Expected: Native failure is reported as a PowerShell error with actionable
diagnostics, distinguishable from an empty successful response. -ErrorAction Stop must be effective for callers.

Acceptance criteria: Capture/check native status before successful-output
parsing and propagate diagnostics. Add regressions for nonzero exits and successful
empty lists for all three readers. Ensure dependent install/register/update
pipelines cannot treat failed discovery as a successful empty inventory.

Related pattern: #259 covers separate DSC resource wrappers. This issue covers the canonical Shmuelie.Copilot discovery commands and is not the DSC marketplace argument issue #261.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Get-CopilotPlugin in modules\Shmuelie.Copilot\Plugins.ps1 and Get-CopilotMarketplace plus Get-CopilotMarketplacePlugin in Marketplaces.ps1. Run the controlled .cmd stub through the command resolver, including -Name synthetic for marketplace browsing, then add regressions covering nonzero exits and successful empty lists. Done means native diagnostics become PowerShell errors, -ErrorAction Stop works, and dependent pipelines do not treat failed discovery as empty.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.