Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds Shared/HidHideIoctlContract.h and a reusable HidHide::CliParsing module, refactors code to use the shared IOCTL and parsing APIs, introduces a GoogleTest C++ test project that compiles CLI and IOCTL tests, and updates solution and build scripts to include Shared and run unit tests in CI. ChangesTesting Infrastructure and Contract Extraction
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
build/Build.cs (1)
290-292: ⚡ Quick winAdd retry/backoff around GoogleTest package download.
At line 291, a single transient HTTP failure will fail the whole restore. A small bounded retry loop with exponential backoff materially improves CI reliability.
🔧 Proposed refactor
- using var http = new HttpClient(); - File.WriteAllBytes(tempZip, http.GetByteArrayAsync(url).GetAwaiter().GetResult()); + using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(30) }; + byte[] payload = Array.Empty<byte>(); + Exception? last = null; + for (var attempt = 1; attempt <= 3; attempt++) + { + try + { + payload = http.GetByteArrayAsync(url).GetAwaiter().GetResult(); + last = null; + break; + } + catch (Exception ex) when (attempt < 3) + { + last = ex; + System.Threading.Thread.Sleep(TimeSpan.FromSeconds(attempt * 2)); + } + } + if (last != null) throw last; + File.WriteAllBytes(tempZip, payload);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@build/Build.cs` around lines 290 - 292, Replace the single synchronous download call (using HttpClient and GetByteArrayAsync then File.WriteAllBytes with tempZip) with a bounded retry loop that catches transient failures (HttpRequestException, TaskCanceledException and other network errors), retries e.g., 3 attempts with exponential backoff and small jitter (e.g., 200ms * 2^attempt + jitter) between attempts, and only throws after the final failed attempt; ensure the HttpClient is disposed correctly and that the successful response bytes are written to tempZip via File.WriteAllBytes after a successful download (keep the same tempZip, HttpClient and GetByteArrayAsync symbols to locate the code).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@HidHide.Tests/HidHide.Tests.vcxproj`:
- Around line 222-223: The Import for the Microsoft.googletest...targets is
currently wrapped in an Exists condition and silently skips when missing; add an
explicit pre-build check that fails fast with a clear error when that targets
file is absent. Implement a target (e.g., CheckGoogleTestTargets) that runs
BeforeTargets="Build" and uses the same Exists(...) path but emits an MSBuild
<Error> with a message referencing the missing Google.Test package and the
required targets file so the build stops immediately rather than later failing
on missing gtest/gtest.h; reference the existing Import target name/identifier
from the diff when locating where to add this check.
In `@HidHideCLI/HidHideCLI.vcxproj`:
- Line 168: In the AdditionalIncludeDirectories XML entries the MSBuild variable
is mistyped as (SolutionDir)HidHide\src; update each occurrence of the token
"(SolutionDir)HidHide\src" to "$(SolutionDir)HidHide\src" so the variable
expands correctly (these appear in the AdditionalIncludeDirectories elements
such as the one shown and its other repeated entries).
In `@HidHideCLI/src/CliParsing.cpp`:
- Line 14: Replace narrow-character classification with wide-character
classification: add `#include` <cwctype> and change the lambdas that call
std::isspace to use std::iswspace instead (e.g., in the value trimming call
inside ExtractValue, the similar lambda inside ExtractKeyword, and the one in
ExtractString). Update each occurrence of std::isspace(character) to
std::iswspace(character) to correctly handle wchar_t inputs and ensure the
proper header is included.
---
Nitpick comments:
In `@build/Build.cs`:
- Around line 290-292: Replace the single synchronous download call (using
HttpClient and GetByteArrayAsync then File.WriteAllBytes with tempZip) with a
bounded retry loop that catches transient failures (HttpRequestException,
TaskCanceledException and other network errors), retries e.g., 3 attempts with
exponential backoff and small jitter (e.g., 200ms * 2^attempt + jitter) between
attempts, and only throws after the final failed attempt; ensure the HttpClient
is disposed correctly and that the successful response bytes are written to
tempZip via File.WriteAllBytes after a successful download (keep the same
tempZip, HttpClient and GetByteArrayAsync symbols to locate the code).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 07d8a432-d920-40d9-8e28-ccc81f0a1b2c
📒 Files selected for processing (15)
HidHide.Tests/HidHide.Tests.vcxprojHidHide.Tests/HidHide.Tests.vcxproj.filtersHidHide.Tests/cli_parsing_tests.cppHidHide.Tests/ioctl_contract_tests.cppHidHide.slnHidHide/HidHide.vcxprojHidHide/src/Logic.hHidHideCLI/HidHideCLI.vcxprojHidHideCLI/HidHideCLI.vcxproj.filtersHidHideCLI/src/CliParsing.cppHidHideCLI/src/CliParsing.hHidHideCLI/src/CommandInterpreter.cppHidHideCLI/src/FilterDriverProxy.cppShared/HidHideIoctlContract.hbuild/Build.cs
There was a problem hiding this comment.
🧹 Nitpick comments (1)
build/Build.cs (1)
293-313: ⚡ Quick winPreserve the last download exception for actionable CI failures.
After retries, the thrown
InvalidOperationExceptionloses the underlying network/root-cause details, which makes incident triage slower.Proposed patch
const int maxAttempts = 3; byte[]? payload = null; + Exception? lastDownloadError = null; for (var attempt = 0; attempt < maxAttempts; attempt++) { try { using var http = new HttpClient(); payload = http.GetByteArrayAsync(url).GetAwaiter().GetResult(); break; } catch (Exception ex) when (attempt < maxAttempts - 1 && IsTransientNuGetDownloadFailure(ex)) { + lastDownloadError = ex; var jitter = Random.Shared.Next(0, 101); var delayMs = 200 * (1 << attempt) + jitter; Thread.Sleep(delayMs); } + catch (Exception ex) + { + lastDownloadError = ex; + break; + } } if (payload == null) - throw new InvalidOperationException($"Failed to download Google Test NuGet package after {maxAttempts} attempts from {url}"); + throw new InvalidOperationException( + $"Failed to download Google Test NuGet package after {maxAttempts} attempts from {url}", + lastDownloadError);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@build/Build.cs` around lines 293 - 313, The retry loop for downloading the Google Test NuGet package currently discards the last exception, so modify the code around the for-loop (which uses maxAttempts, payload, attempt, IsTransientNuGetDownloadFailure and url) to capture the last caught Exception (e.g., store it in a local Exception? lastException inside the catch) and after the loop, when payload == null throw the InvalidOperationException including that captured exception as the innerException (or include its message in the thrown message) so CI logs retain the original network/root-cause details for triage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@build/Build.cs`:
- Around line 293-313: The retry loop for downloading the Google Test NuGet
package currently discards the last exception, so modify the code around the
for-loop (which uses maxAttempts, payload, attempt,
IsTransientNuGetDownloadFailure and url) to capture the last caught Exception
(e.g., store it in a local Exception? lastException inside the catch) and after
the loop, when payload == null throw the InvalidOperationException including
that captured exception as the innerException (or include its message in the
thrown message) so CI logs retain the original network/root-cause details for
triage.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c06cc240-286a-429e-aafd-b3f7ea65e030
📒 Files selected for processing (4)
HidHide.Tests/HidHide.Tests.vcxprojHidHideCLI/HidHideCLI.vcxprojHidHideCLI/src/CliParsing.cppbuild/Build.cs
🚧 Files skipped from review as they are similar to previous changes (3)
- HidHideCLI/HidHideCLI.vcxproj
- HidHide.Tests/HidHide.Tests.vcxproj
- HidHideCLI/src/CliParsing.cpp
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@build/Build.cs`:
- Around line 277-327: The EnsureGoogleTestNuGetPackage method currently writes
and extracts remote bytes (tempZip/payload) without integrity checks; add a
verification step before extraction: perform an HTTP HEAD to the same url to
read the Content-MD5 (or Content-MD5 base64/Content-MD5-like header) and compare
it to the downloaded payload (payload) after GetByteArrayAsync and before
File.WriteAllBytes, retrying/failing with lastException if mismatch, or
alternatively after extracting tempZip run a CLI verification using "dotnet
nuget verify" (or "nuget verify") against tempZip and throw an
InvalidOperationException if verification fails; keep this logic inside
EnsureGoogleTestNuGetPackage so marker/temp cleanup/error messages remain
consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e70af688-04e5-4ae1-9976-99dc4b75d22f
📒 Files selected for processing (1)
build/Build.cs
Summary by CodeRabbit
New Features
Tests
Chores