Add structured rtk dotnet support (build/test/restore) with binlog/TRX parsing, robust argument forwarding, and locale-stable fallback behavior#172
Conversation
|
@DavidFowler this might be something of interest to you It probably still misses a few things but might be a good start |
|
Will be testing this during the week. Thanks for enormous work. |
| find_recent_trx_in_dir(Path::new("./TestResults")) | ||
| } | ||
|
|
||
| fn find_recent_trx_in_dir(dir: &Path) -> Option<PathBuf> { |
There was a problem hiding this comment.
a failing dotnet test can produce a ./TestResults/<GUID>/test.trx and it looks like we don't check for that in here.
|
|
||
| lazy_static! { | ||
| // Note: (?s) enables DOTALL mode so . matches newlines | ||
| static ref TRX_COUNTERS_RE: Regex = Regex::new( |
There was a problem hiding this comment.
here and in line 12 regex takes in consideration the attribute order, but the xml report attribute order is not guaranteed, parser can silently miss counters/failed tests and under-report failures
| .any(|arg| matches!(arg.to_ascii_lowercase().as_str(), "-nologo" | "/nologo")) | ||
| } | ||
|
|
||
| fn has_logger_arg(args: &[String]) -> bool { |
There was a problem hiding this comment.
interesting one, and i think it can wrongly return true when an argument like --results-directory logs/logger-output is passed, or a test filter containing logger.
|
This is an outstanding PR — probably the most thorough community contribution we've received. The binary binlog parser, multi-layer fallback strategy (binlog → text → TRX), and 42 tests A few things to address before merge:
Without this, Claude Code will type dotnet build and it won't go through the RTK filter. Every command we support has a corresponding rewrite in .claude/hooks/rtk-rewrite.sh. Please add: --- .NET ---elif echo "$MATCH_CMD" | grep -qE '^dotnet[[:space:]]+(build|test|restore)([[:space:]]|$)'; then See the cargo/pytest/ruff sections in the hook file for examples.
In dotnet_cmd.rs, run_dotnet_with_binlog() for "build" does:
This function calls Regex::new() in a loop for every env var on every invocation. Should be lazy_static! to avoid recompilation. Not a blocker but matters for performance.
build_binlog_path() creates files in /tmp/rtk_dotnet_* but never removes them. Could accumulate over time. Consider cleaning up after parsing, similar to how you handle TRX cleanup. None of these are major — #1 is the only blocker. Great work! |
|
Thank you for the kinds words It will take a while until I can address those because I have a few prio things I need to get through first but I should be able to get back to this next week |
|
Thank you Dani :) Looking forward to try this out. |
Why
Benefits
Real-world impact (NServiceBus)
Solution-level run against NServiceBus.slnx:
More outputs