Fix formal review findings across all 9 review-sets#175
Merged
Malcolmnixon merged 3 commits intomainfrom Apr 1, 2026
Merged
Conversation
Agent-Logs-Url: https://github.com/demaconsulting/SpdxTool/sessions/7e5da612-1917-415a-9035-a05226aa5faf Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
…feedback Agent-Logs-Url: https://github.com/demaconsulting/SpdxTool/sessions/7e5da612-1917-415a-9035-a05226aa5faf Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
Malcolmnixon
April 1, 2026 22:54
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses issues found during formal reviews across multiple review-sets by fixing incorrect/unhelpful error handling in CLI code, preventing potential process I/O deadlocks, and aligning design documentation with the current implementation.
Changes:
- Improved CLI robustness and correctness (better error messages; safer
--depthparsing; log-file creation failures mapped toInvalidOperationException). - Prevented potential stdout/stderr deadlocks by reading both redirected streams concurrently in runners and
query. - Updated design documentation to match actual type/property names and the current system structure.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/DemaConsulting.SpdxTool.Tests/Runner.cs | Read stdout/stderr concurrently to avoid deadlock when capturing process output in tests. |
| test/DemaConsulting.SpdxTool.Targets.Tests/DotnetRunner.cs | Read stdout/stderr concurrently to avoid deadlock for dotnet integration test runs. |
| src/DemaConsulting.SpdxTool/Context.cs | Safer --depth parsing and improved log writer creation error handling. |
| src/DemaConsulting.SpdxTool/Commands/Validate.cs | Corrected command name in a YAML exception message. |
| src/DemaConsulting.SpdxTool/Commands/RenameId.cs | Corrected YAML exception message and removed unreachable dead code. |
| src/DemaConsulting.SpdxTool/Commands/Query.cs | Read stdout/stderr concurrently to avoid deadlock when querying external program output. |
| docs/design/utility.md | Updated RelationshipDirection enum values to match implementation. |
| docs/design/spdxtool-targets-system.md | Updated MSBuild property name to SpdxWorkflowFile to match targets. |
| docs/design/spdxtool-system.md | Updated registry naming to CommandsRegistry to match implementation. |
| docs/design/introduction.md | Corrected software structure diagram placement for SPDX-related units. |
| docs/design/commands/commands.md | Updated references from CommandRegistry to CommandsRegistry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
@copilot apply changes based on the comments in this thread |
…Process disposal Agent-Logs-Url: https://github.com/demaconsulting/SpdxTool/sessions/d6c7890b-568e-452b-a0be-0390962bb82c Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Malcolmnixon
approved these changes
Apr 1, 2026
This was referenced Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
Performed formal reviews for all 9 review-sets defined in
.reviewmark.yamland fixed the identified issues.Review Sets Processed
Code Fixes
RenameId.cs: Corrected wrong error message —'spdx'→'old'for the missingoldinput parameterRenameId.cs: Removed unreachable dead code (redundantoldId == newIdcheck after an early return that already handles this case)Validate.cs: Corrected wrong command name in error message —'to-markdown'→'validate'Context.cs: Replacedint.Parsewithint.TryParseso invalid--depthvalues throwInvalidOperationException(handled byProgram.Main) instead of an unhandledFormatExceptionContext.cs: WrappedStreamWriterconstructor in separate catch blocks forUnauthorizedAccessException,ArgumentException,NotSupportedException, andIOException, each producing a distinct descriptiveInvalidOperationExceptionmessageRunner.cs,DotnetRunner.cs,Query.cs: Fixed potential stdout/stderr deadlock — read both streams concurrently viaReadToEndAsync+Task.WaitAllinstead of sequentially withReadToEndRunner.cs,DotnetRunner.cs: Addedusing var processto ensure theProcessinstance and its redirected streams are properly disposed after each test runDocumentation Fixes
introduction.md: Fixed software structure diagram — movedRelationshipDirection.csandSpdxHelpers.csfrom theUtility (Subsystem)section to a correctSpdx (Unit Group)sectionspdxtool-system.md+commands/commands.md: Corrected class nameCommandRegistry→CommandsRegistrythroughout (to match the actual implementation)spdxtool-targets-system.md: Corrected MSBuild property nameSpdxToolWorkflow→SpdxWorkflowFile(to match the actual targets file)utility.md: CorrectedRelationshipDirectionenum values —Forward/Reverse/Both→Parent/Child/Sibling(to match the actual implementation)Type of Change
Related Issues
Pre-Submission Checklist
Before submitting this pull request, ensure you have completed the following:
Build and Test
dotnet build --configuration Releasedotnet test --configuration Releasedotnet run --project src/DemaConsulting.SpdxTool --configuration Release --framework net10.0--no-build -- --validateCode Quality
dotnet format --verify-no-changesQuality Checks
Please run the following checks before submitting:
./lint.sh(Unix/macOS) orcmd /c lint.bat/./lint.bat(Windows)Testing
Documentation
Additional Notes
The
--depthand--logexception-handling fixes alignContext.Createwith the documented/// <exception cref="InvalidOperationException">contract, so callers (includingProgram.Main) already handle these cases correctly without displaying raw stack traces to the user.The deadlock fix in
Runner.cs/DotnetRunner.cs/Query.csis latent but real — it manifests only when child process stderr output fills its OS buffer while the parent is blocked draining stdout.The
using var processfix inRunner.csandDotnetRunner.csensures OS handles and redirected stream resources are released promptly, preventing handle leaks across long test runs.