Skip to content

Report returned command errors in machine mode - #287

Merged
Mike Krüger (mkrueger) merged 7 commits into
mainfrom
dev/mkrueger/fix/278-machine-error-diagnostics
Nov 5, 2026
Merged

Mike Krüger (mkrueger) merged 7 commits into
mainfrom
dev/mkrueger/fix/278-machine-error-diagnostics

Conversation

@mkrueger

Copy link
Copy Markdown
Collaborator

Fixes #278.

Summary

  • Emit structured JSON diagnostics on stderr for ordinary returned command errors in machine mode, fixing silent theme failures and rejected non-interactive edit calls.
  • Preserve exit codes, human-readable behavior, structured failure payloads, warnings, and 2> / 2>> redirection.
  • Avoid duplicate diagnostics when output rendering fails, including with --verbose.
  • Update automation documentation and changelog.

Validation

  • Both application and test projects build without warnings.
  • Full offline suite: 5,098 passed, 6 skipped.
  • Review validation: 250 focused tests passed.
  • Process tests cover JSON/CSV/quiet/default startup/verbose modes, stderr redirection, scripts, blocks, pipelines, and expressions.
  • Renderer tests cover warning envelopes and duplicate suppression.
Preserve structured stderr diagnostics for theme and edit failures, including warnings and redirection, without duplicate render-error reporting.

Fixes #278

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🟢 Approval recommended

No active review issues were identified for the machine-mode error-reporting changes.

No open issues 🎉

What changed in this PR

Addresses #278 by making returned command failures, including failed theme operations and rejected non-interactive edit calls, emit structured JSON diagnostics on stderr in machine mode.

Changes:

  • Report ordinary command errors while preserving warning envelopes and stderr redirection.
  • Prevent duplicate diagnostics after output-rendering failures, including with --verbose.
  • Add regression coverage and document the automation behavior.
File Description
docs/​navigation.md Document machine-mode command errors and stderr redirection.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Core/​ShellInterpreter.cs Emit returned errors and suppress duplicate rendering diagnostics.
CosmosDBShell.Tests/​Shell/​ExecuteCommandExceptionTests.cs Test warning envelopes, redirection, and duplicate suppression.
CosmosDBShell.Tests/​Parser/​CommandStatementTests.cs Update warning expectations for returned command failures.
CosmosDBShell.Tests/​Integration/​ShellProcessTests.cs Cover errors across output modes, redirection, scripts, and expressions.
CHANGELOG.md Record the fix for silent machine-mode failures.

Review effort: Balanced

@github-code-quality

github-code-quality Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: C#

C# / code-coverage/dotnet

main f6b1dd6 dev/mkrueger/fix/278... c9e79ac +/-
74% 74% 0%
View coverage of the 3 most impacted files.
File main f6b1dd6 dev/mkrueger/fix/278... c9e79ac +/-
D:\a\CosmosDBSh...lInterpreter.cs 80% 80% 0%
D:\a\CosmosDBSh...ThemeCommand.cs 70% 71% +1%
D:\a\CosmosDBSh...\EditCommand.cs 51% 56% +5%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated November 05, 2026 12:15 UTC

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 09:53

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.

🟢 Approval recommended

No active review issues block approval of the machine-mode command-error reporting changes.

No open issues 🎉

Review effort: Balanced

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 10:09

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.

🟢 Approval recommended

The machine-mode command-error reporting change has no active review issues.

No open issues 🎉

Review effort: Balanced

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🟡 Changes recommended

The integration tests sanitize stderr before parsing and asserting, allowing ANSI-colored, invalid machine-mode JSON to pass undetected.

1 open issue

Review effort: Balanced

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🔵 Needs a closer look

Human assessment is needed because a critical interaction between expression evaluation and outer exception handling can emit duplicate JSON diagnostics for an already-reported failure.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

…#287

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🟢 Approval recommended

No active review issues remain in the changes to machine-mode command-error diagnostics.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mkrueger
Mike Krüger (mkrueger) requested a balanced review from Copilot November 5, 2026 12:06

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.

🟢 Approval recommended

No active review issues are recorded for the machine-mode command error reporting changes.

No open issues 🎉

Review effort: Balanced

@mkrueger
Mike Krüger (mkrueger) merged commit 3acd215 into main Nov 5, 2026
13 checks passed
@mkrueger
Mike Krüger (mkrueger) deleted the dev/mkrueger/fix/278-machine-error-diagnostics branch November 5, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants