Skip to content

ci(release): fail the PSGallery check on a query error instead of assuming not-published#12

Merged
tablackburn merged 2 commits into
mainfrom
ci/harden-psgallery-check
May 23, 2026
Merged

ci(release): fail the PSGallery check on a query error instead of assuming not-published#12
tablackburn merged 2 commits into
mainfrom
ci/harden-psgallery-check

Conversation

@tablackburn
Copy link
Copy Markdown
Owner

@tablackburn tablackburn commented May 22, 2026

Follow-up to the recovery-gap fix (#11). Now that Publish is gated only on the PSGallery check, Find-Module -ErrorAction SilentlyContinue returning $null for both a genuine miss and a transient query failure could trigger a blind publish. Fix: capture -ErrorVariable — publish only on a clean miss (genuine not-found records no error, verified), throw on a recorded error so the run is retryable. Surfaced by CodeRabbit/Copilot during the YTMP rollout. YAML parses; no manifest change.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved PowerShell Gallery publish workflow error handling to properly capture and escalate errors when checking module versions, preventing silent failures and ensuring transient issues cause the workflow to fail appropriately instead of proceeding with publishing.

Review Change Stack

…uming not-published

Follow-up to recovery-gap #11. Publish is now gated only on this check, so a
transient Find-Module failure (returning $null under -ErrorAction SilentlyContinue)
was indistinguishable from a genuine miss and could trigger a blind publish. Capture
-ErrorVariable: publish only on a clean miss (genuine not-found records no error,
verified); throw on a recorded error so the run is retryable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 22, 2026 01:24
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6e80b1f4-6964-4050-a4fa-7b931aa6b718

📥 Commits

Reviewing files that changed from the base of the PR and between b3a45b2 and 1f1c4d7.

📒 Files selected for processing (1)
  • .github/workflows/PublishModuleToPowerShellGallery.yaml

📝 Walkthrough

Walkthrough

The workflow's PSGallery version check now captures errors from Find-Module and throws when a query fails, distinguishing transient network failures from genuine module absence while preserving success and not-found paths.

Changes

PSGallery Version Check Error Handling

Layer / File(s) Summary
PSGallery existence check with error detection
.github/workflows/PublishModuleToPowerShellGallery.yaml
The Find-Module query now uses -ErrorVariable to detect failures. If an error occurs, the step throws with the captured exception message instead of treating it as "not published." Module found and not-found cases preserve their existing exists=true and exists=false outputs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A rabbit hops through PowerShell lanes,
Where errors once masked in the rains,
Now fail loud and clear when queries go wrong,
While true and false sing their publish song! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: improving error handling in the PSGallery check to fail on query errors instead of assuming not-published.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/harden-psgallery-check

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 and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the release workflow’s PowerShell Gallery preflight check to distinguish a true “module version not found” from a transient PSGallery query failure, preventing accidental publishes when the lookup fails.

Changes:

  • Captures Find-Module errors via -ErrorVariable while keeping the normal “not found” case silent.
  • Throws (fails the job) when a PSGallery query error is recorded, making the run retryable instead of attempting a blind publish.

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

@tablackburn
Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Full review triggered.

@tablackburn
Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Full review triggered.

@tablackburn
Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Full review triggered.

@tablackburn tablackburn merged commit d8addf2 into main May 23, 2026
11 checks passed
@tablackburn tablackburn deleted the ci/harden-psgallery-check branch May 23, 2026 05:55
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