Skip to content

refactor: extract publish configuration factory#205

Merged
PrzemyslawKlys merged 1 commit intomainfrom
codex/thin-cmdlets-publish-config-main-v2
Mar 11, 2026
Merged

refactor: extract publish configuration factory#205
PrzemyslawKlys merged 1 commit intomainfrom
codex/thin-cmdlets-publish-config-main-v2

Conversation

@PrzemyslawKlys
Copy link
Member

Summary

  • extract New-ConfigurationPublish request mapping and validation into a typed factory
  • move secret-file loading and Azure Artifacts repository resolution out of the cmdlet
  • add focused tests for file-backed API keys, repository credentials, and Azure Artifacts presets

Validation

  • dotnet test .\PowerForge.Tests\PowerForge.Tests.csproj -c Release --filter "PublishConfigurationFactoryTests|FormatConfigurationFactoryTests|ValidationConfigurationFactoryTests"
  • pwsh .\Module\Build\Build-Module.ps1 -NoSign

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1a5f20f268

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

};

if (destination == PublishDestination.GitHub && string.IsNullOrWhiteSpace(request.UserName))
throw new ArgumentException("UserName is required for GitHub. Please fix New-ConfigurationPublish and provide UserName", nameof(request));

Choose a reason for hiding this comment

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

P2 Badge Use PSArgumentException for cmdlet-facing validation

The factory now throws ArgumentException for user input validation (for example missing UserName on GitHub), but New-ConfigurationPublish previously surfaced these as PSArgumentException; this changes the observable exception type for the same invalid input and can break existing PowerShell automation that catches PSArgumentException from this cmdlet. Since this method is now the cmdlet’s validation path, wrapping or rethrowing as PSArgumentException would preserve backward-compatible error behavior.

Useful? React with 👍 / 👎.

@PrzemyslawKlys PrzemyslawKlys merged commit 5a0da4a into main Mar 11, 2026
6 of 7 checks passed
@PrzemyslawKlys PrzemyslawKlys deleted the codex/thin-cmdlets-publish-config-main-v2 branch March 11, 2026 16:32
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.

1 participant