Skip to content

[Nitro CLI] Return proper not found error for mutation errors - #10111

Merged
tobias-tengler merged 1 commit into
mainfrom
tte/nitro-mutation-not-found-errors
Jul 13, 2026
Merged

tobias-tengler merged 1 commit into
mainfrom
tte/nitro-mutation-not-found-errors

Conversation

@tobias-tengler

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 13, 2026 16:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates Nitro CLI command error handling so typed “not found” mutation errors are surfaced as a consistent “not found” failure (via NitroClientNotFoundException), producing the standard guidance message about entity absence/permissions and --cloud-url. The change is validated by converting many prior “unexpected mutation error” theory cases into dedicated snapshot tests that assert the new not-found output.

Changes:

  • Map various typed GraphQL mutation “not found” errors to NitroClientNotFoundException across multiple commands.
  • Update/expand CLI test coverage with new snapshot-based [Fact] tests for the standardized not-found stderr output (and remove the old theory cases that asserted the previous behavior).
  • Remove a stale project reference from Nitro.CommandLine.slnx.

Reviewed changes

Copilot reviewed 70 out of 70 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Nitro/CommandLine/test/CommandLine.Tests/GlobalOptionsTests.cs Moves global-options CLI test into the fixture-based test base.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Stages/EditStagesCommandTests.cs Adds dedicated not-found snapshot tests for stage edit.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Stages/DeleteStageCommandTests.cs Adds dedicated not-found snapshot tests for stage delete.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Schemas/ValidateSchemaCommandTests.cs Adds dedicated not-found snapshot tests for schema validation.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Schemas/UploadSchemaCommandTests.cs Adds dedicated not-found snapshot test for schema upload.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Schemas/PublishSchemaCommandTests.cs Adds dedicated not-found snapshot tests for schema publish.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/PersonalAccessTokens/RevokePersonalAccessTokenCommandTests.cs Adds dedicated not-found snapshot test for PAT revoke.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/OpenApi/ValidateOpenApiCollectionCommandTests.cs Adds dedicated not-found snapshot tests for OpenAPI validate.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/OpenApi/UploadOpenApiCollectionCommandTests.cs Adds dedicated not-found snapshot test for OpenAPI upload.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/OpenApi/PublishOpenApiCollectionCommandTests.cs Adds dedicated not-found snapshot tests for OpenAPI publish.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/OpenApi/DeleteOpenApiCollectionCommandTests.cs Adds dedicated not-found snapshot test for OpenAPI delete.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/OpenApi/CreateOpenApiCollectionCommandTests.cs Adds dedicated not-found snapshot test for OpenAPI create.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Mocks/UpdateMockCommandTests.cs Adds dedicated not-found snapshot test for mock update.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Mocks/CreateMockCommandTests.cs Adds dedicated not-found snapshot test for mock create.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Mcp/ValidateMcpFeatureCollectionCommandTests.cs Adds dedicated not-found snapshot tests for MCP validate.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Mcp/UploadMcpFeatureCollectionCommandTests.cs Adds dedicated not-found snapshot test for MCP upload.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Mcp/PublishMcpFeatureCollectionCommandTests.cs Adds dedicated not-found snapshot tests for MCP publish.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Mcp/DeleteMcpFeatureCollectionCommandTests.cs Adds dedicated not-found snapshot test for MCP delete.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Mcp/CreateMcpFeatureCollectionCommandTests.cs Adds dedicated not-found snapshot test for MCP create.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/GlobalOptionsCommandTests.cs Removes old standalone global-options test file (replaced by GlobalOptionsTests).
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Fusion/FusionValidateCommandTests.cs Adds dedicated not-found snapshot tests for fusion validate.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Fusion/FusionUploadCommandTests.cs Adds dedicated not-found snapshot test for fusion upload.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Fusion/FusionPublishCommandTests.cs Adds extensive dedicated not-found snapshot tests for fusion publish flows.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Fusion/FusionConfigurationPublishValidateCommandTests.cs Adds request-not-found snapshot test for publish validate.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Fusion/FusionConfigurationPublishCommitCommandTests.cs Adds request-not-found snapshot test for publish commit.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Fusion/FusionConfigurationPublishCancelCommandTests.cs Adds request-not-found snapshot test for publish cancel.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Fusion/FusionConfigurationPublishBeginCommandTests.cs Adds API/stage not-found snapshot tests for publish begin.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Clients/ValidateClientCommandTests.cs Adds dedicated not-found snapshot tests for client validate.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Clients/UploadClientCommandTests.cs Adds dedicated not-found snapshot test for client upload.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Clients/UnpublishClientCommandTests.cs Adds dedicated not-found snapshot tests for client unpublish.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Clients/PublishClientCommandTests.cs Adds dedicated not-found snapshot tests for client publish.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Clients/DeleteClientCommandTests.cs Updates not-found snapshot to include standardized guidance lines.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Clients/CreateClientCommandTests.cs Adds dedicated API-not-found snapshot test for client create.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Apis/SetApiSettingsCommandTests.cs Adds dedicated API-not-found snapshot test for set-settings.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/Apis/DeleteApiCommandTests.cs Removes ApiNotFound from mutation error theory cases (no direct replacement test added).
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/ApiKeys/DeleteApiKeyCommandTests.cs Adds dedicated API-key-not-found snapshot test.
src/Nitro/CommandLine/test/CommandLine.Tests/Commands/ApiKeys/CreateApiKeyCommandTests.cs Adds dedicated API/role-not-found snapshot tests.
src/Nitro/CommandLine/src/CommandLine/Commands/Stages/EditStagesCommand.cs Throws NitroClientNotFoundException for API/stage not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Stages/DeleteStageCommand.cs Throws NitroClientNotFoundException for API/stage not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Schemas/UploadSchemaCommand.cs Throws NitroClientNotFoundException for API not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Schemas/SchemaHelpers.cs Throws NitroClientNotFoundException for API/stage/schema not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Schemas/PublishSchemaCommand.cs Throws NitroClientNotFoundException for API/stage/schema not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/PersonalAccessTokens/RevokePersonalAccessTokenCommand.cs Throws NitroClientNotFoundException for PAT not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/OpenApi/ValidateOpenApiCollectionCommand.cs Throws NitroClientNotFoundException for stage/collection not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/OpenApi/UploadOpenApiCollectionCommand.cs Throws NitroClientNotFoundException for collection not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/OpenApi/PublishOpenApiCollectionCommand.cs Throws NitroClientNotFoundException for stage/collection/version not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/OpenApi/DeleteOpenApiCollectionCommand.cs Throws NitroClientNotFoundException for collection not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/OpenApi/CreateOpenApiCollectionCommand.cs Throws NitroClientNotFoundException for API not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Mocks/UpdateMockCommand.cs Throws NitroClientNotFoundException for mock schema not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Mocks/CreateMockCommand.cs Throws NitroClientNotFoundException for API not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Mcp/ValidateMcpFeatureCollectionCommand.cs Throws NitroClientNotFoundException for stage/collection not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Mcp/UploadMcpFeatureCollectionCommand.cs Throws NitroClientNotFoundException for collection not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Mcp/PublishMcpFeatureCollectionCommand.cs Throws NitroClientNotFoundException for stage/collection/version not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Mcp/DeleteMcpFeatureCollectionCommand.cs Throws NitroClientNotFoundException for collection not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Mcp/CreateMcpFeatureCollectionCommand.cs Throws NitroClientNotFoundException for API not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Fusion/PublishCommand/FusionConfigurationPublishCancelCommand.cs Throws NitroClientNotFoundException for request not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Fusion/FusionUploadCommand.cs Throws NitroClientNotFoundException for API not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Fusion/FusionPublishHelpers.cs Throws NitroClientNotFoundException for API/stage/request not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Fusion/FusionPublishCommand.cs Throws NitroClientNotFoundException for request not found typed errors in publish flow.
src/Nitro/CommandLine/src/CommandLine/Commands/Clients/ValidateClientCommand.cs Throws NitroClientNotFoundException for client/stage not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Clients/UploadClientCommand.cs Throws NitroClientNotFoundException for client not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Clients/UnpublishClientCommand.cs Throws NitroClientNotFoundException for stage/client/version not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Clients/PublishClientCommand.cs Throws NitroClientNotFoundException for client/stage/version not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Clients/DeleteClientCommand.cs Throws NitroClientNotFoundException for client not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Clients/CreateClientCommand.cs Throws NitroClientNotFoundException for API not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Apis/SetApiSettingsCommand.cs Throws NitroClientNotFoundException for API not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/Apis/DeleteApiCommand.cs Throws NitroClientNotFoundException for API not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/ApiKeys/DeleteApiKeyCommand.cs Throws NitroClientNotFoundException for API key not found typed errors.
src/Nitro/CommandLine/src/CommandLine/Commands/ApiKeys/CreateApiKeyCommand.cs Throws NitroClientNotFoundException for API/role not found typed errors.
src/Nitro/CommandLine/Nitro.CommandLine.slnx Removes stale client project entry from the solution.

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

@github-actions

Copy link
Copy Markdown
Contributor

Patch coverage

98.8% of changed lines covered (80/81)

File Covered Changed Patch %
…/src/CommandLine/Commands/Apis/DeleteApiCommand.cs 1 2 50.0% 🔴
…/src/CommandLine/Commands/ApiKeys/CreateApiKeyCommand.cs 2 2 100.0% 🟢
…/src/CommandLine/Commands/ApiKeys/DeleteApiKeyCommand.cs 1 1 100.0% 🟢
…/src/CommandLine/Commands/Apis/SetApiSettingsCommand.cs 2 2 100.0% 🟢
…/src/CommandLine/Commands/Clients/CreateClientCommand.cs 2 2 100.0% 🟢
…/src/CommandLine/Commands/Clients/DeleteClientCommand.cs 2 2 100.0% 🟢
…/src/CommandLine/Commands/Clients/PublishClientCommand.cs 6 6 100.0% 🟢
…/src/CommandLine/Commands/Clients/UnpublishClientCommand.cs 3 3 100.0% 🟢
…/src/CommandLine/Commands/Clients/UploadClientCommand.cs 2 2 100.0% 🟢
…/src/CommandLine/Commands/Clients/ValidateClientCommand.cs 4 4 100.0% 🟢
…/src/CommandLine/Commands/Fusion/FusionPublishCommand.cs 2 2 100.0% 🟢
…/src/CommandLine/Commands/Fusion/FusionPublishHelpers.cs 8 8 100.0% 🟢
…/src/CommandLine/Commands/Fusion/FusionUploadCommand.cs 2 2 100.0% 🟢
…/PublishCommand/FusionConfigurationPublishCancelCommand.cs 2 2 100.0% 🟢
…/Commands/Mcp/CreateMcpFeatureCollectionCommand.cs 1 1 100.0% 🟢
…/Commands/Mcp/DeleteMcpFeatureCollectionCommand.cs 2 2 100.0% 🟢
…/Commands/Mcp/PublishMcpFeatureCollectionCommand.cs 5 5 100.0% 🟢
…/Commands/Mcp/UploadMcpFeatureCollectionCommand.cs 2 2 100.0% 🟢
…/Commands/Mcp/ValidateMcpFeatureCollectionCommand.cs 3 3 100.0% 🟢
…/src/CommandLine/Commands/Mocks/CreateMockCommand.cs 1 1 100.0% 🟢

+12 more changed files; see the JSON below for uncovered lines.

Uncovered changed lines (JSON)
{
  "sha": "4c0d65b289efaecc67e2bdc8f9578c9f1bcc86da",
  "files": [
    { "path": "src/Nitro/CommandLine/src/CommandLine/Commands/Apis/DeleteApiCommand.cs", "ranges": [[75, 75]] }
  ]
}

Project coverage: 53.7% (230651/429488 lines)

@tobias-tengler
tobias-tengler merged commit d4a6290 into main Jul 13, 2026
148 checks passed
@tobias-tengler
tobias-tengler deleted the tte/nitro-mutation-not-found-errors branch July 13, 2026 17:23
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