Parse the Cargo package list by column instead of by regex - #5312
Merged
Gabriel Dufresne (GabrielDuf) merged 1 commit intoAug 21, 2026
Conversation
Copilot started reviewing on behalf of
Gabriel Dufresne (GabrielDuf)
August 21, 2026 19:31
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors Cargo package-list parsing into structured, testable logic and safely handles missing package-version metadata.
Changes:
- Adds column-based parsing for Cargo installed/update output.
- Integrates parsed entries with Cargo package discovery and fallback behavior.
- Adds comprehensive parser tests and null-safe package details handling.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
CargoListParsingTests.cs |
Tests normal, malformed, prerelease, Git, and fallback output formats. |
CargoPkgDetailsHelper.cs |
Avoids exceptions when matching version metadata is absent. |
CargoListParsing.cs |
Defines the parsed entry model and parsing routines. |
Cargo.cs |
Uses structured entries for installed packages and updates. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Marc-André Moreau (mamoreau-devolutions)
approved these changes
Aug 21, 2026
Gabriel Dufresne (GabrielDuf)
deleted the
fix/5239-cargo-blank-package-id
branch
August 21, 2026 20:06
4 tasks
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.
This pull request refactors and improves the way the Cargo package manager integration parses and processes the output of
cargo install-update --listandcargo install --list. The changes introduce a more robust and testable parsing logic, replace brittle regular expressions with structured parsing, and add comprehensive unit tests to ensure correctness. Additionally, some minor improvements are made to package details handling.Parsing and Data Model Improvements:
CargoListEntryrecord and moved parsing logic for installed and updatable Cargo packages to a new file,CargoListParsing.cs, with robust handling of edge cases and malformed input. This includes new regexes and parsing methods for both update and install list outputs.Cargomanager to use the new parsing logic and data model, replacing previous use ofMatchand regexes withCargoListEntryobjects throughout the codebase. This improves maintainability and correctness, especially in edge cases.Testing:
CargoListParsingTests.cs, covering various real-world and edge case outputs from Cargo, ensuring the new parsing logic is robust and reliable.Minor Improvements:
CargoPkgDetailsHelper.csby usingFirstOrDefaultand null checks to avoid exceptions when version data is missing.These changes make the Cargo integration more reliable, easier to maintain, and better tested.