Skip to content

Fix review issues: I/O error handling, console color safety, requirements traceability#45

Merged
Malcolmnixon merged 1 commit intomainfrom
copilot/fix-review-issues
Apr 4, 2026
Merged

Fix review issues: I/O error handling, console color safety, requirements traceability#45
Malcolmnixon merged 1 commit intomainfrom
copilot/fix-review-issues

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 4, 2026

Summary

Formal code reviews were performed on all 14 review-sets defined in .reviewmark.yaml. Three issues were found and fixed.

Changes

src/DemaConsulting.ReviewMark/Program.cs (Critical)

  • Wrapped both File.WriteAllText() calls (for --plan and --report output files) in try-catch blocks that convert IOException, UnauthorizedAccessException, and DirectoryNotFoundException into InvalidOperationException. Previously these propagated as unhandled exceptions causing a crash (exit code 134) instead of a graceful error (exit code 1).

src/DemaConsulting.ReviewMark/Cli/Context.cs (Medium)

  • Changed WriteError to use a try-finally block when setting/restoring Console.ForegroundColor, ensuring the console color is always restored even if Console.Error.WriteLine throws an exception.

docs/reqstream/review-mark/cli/cli.yaml (Medium)

  • Added missing test references to ReviewMark-Cmd-PlanDepth: Context_Create_PlanDepthFlag_WithValueGreaterThanFive_ThrowsArgumentException
  • Added missing test references to ReviewMark-Cmd-ReportDepth: Context_Create_ReportDepthFlag_WithValueGreaterThanFive_ThrowsArgumentException, Context_Create_ReportDepthFlag_MissingValue_ThrowsArgumentException, Context_Create_ReportDepthFlag_NonNumeric_ThrowsArgumentException, Context_Create_ReportDepthFlag_Zero_ThrowsArgumentException

… Context.cs, missing test refs in cli.yaml

Agent-Logs-Url: https://github.com/demaconsulting/ReviewMark/sessions/ac56b6a1-fc95-41b9-8f21-2a884f7253a0

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
@Malcolmnixon Malcolmnixon marked this pull request as ready for review April 4, 2026 01:15
Copilot AI review requested due to automatic review settings April 4, 2026 01:15
Copy link
Copy Markdown
Contributor

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

This PR improves ReviewMark’s CLI robustness and requirements traceability by hardening error handling for output file writes, making stderr color changes safer, and updating ReqStream links to existing tests.

Changes:

  • Wrap File.WriteAllText() for --plan and --report outputs to convert expected I/O failures into user-facing errors (exit code 1 instead of crash).
  • Ensure Console.ForegroundColor is restored via try/finally in Context.WriteError.
  • Add missing test references for --plan-depth / --report-depth constraints in ReqStream CLI requirements.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/DemaConsulting.ReviewMark/Program.cs Converts certain plan/report file write exceptions into InvalidOperationException for graceful CLI failure.
src/DemaConsulting.ReviewMark/Cli/Context.cs Uses try/finally to restore console color after writing errors.
docs/reqstream/review-mark/cli/cli.yaml Adds missing links from CLI requirements to existing tests for depth flag validation.

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

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.

3 participants