chore: remove BlobPathStrings helper#90
Conversation
Use BlobPaths directly in tests so blob names stay strongly typed and the obsolete string wrapper cannot drift from production paths.
📝 WalkthroughWalkthroughThis PR migrates test blob path construction from the ChangesTest Blob Path Helper Migration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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 `@src/Arius.Architecture.Tests/DependencyTests.cs`:
- Line 17: The hard-coded upward Path.Combine chain used to initialize
RepositoryRoot from AppContext.BaseDirectory is brittle; replace it with a
deterministic repo-root discovery routine: implement a FindRepositoryRoot method
that walks parent directories from AppContext.BaseDirectory and returns the
first directory containing a repo marker (for example a .git folder or the
solution file or the known file BlobPathStrings.cs), use that method to set
RepositoryRoot and to compute helperPath (and update the checks around
helperPath/BlobPathStrings.cs referenced on lines ~146-148) and make the test
fail loudly if no repo marker is found instead of proceeding with a wrong path.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: dbba7058-b8a7-4003-b4e5-97c2c0ed13a6
📒 Files selected for processing (11)
src/Arius.Architecture.Tests/DependencyTests.cssrc/Arius.Core.Tests/Fakes/FakeMetadataOnlyBlobContainerService.cssrc/Arius.Core.Tests/Features/ArchiveCommand/ArchiveRecoveryTests.cssrc/Arius.Core.Tests/Features/ChunkHydrationStatusQuery/ResolveFileHydrationStatusesHandlerTests.cssrc/Arius.Core.Tests/Features/ListQuery/ListQueryHandlerTests.cssrc/Arius.Core.Tests/Features/RestoreCommand/RestoreCommandHandlerTests.cssrc/Arius.Core.Tests/Shared/ChunkStorage/ChunkStorageHydrationStatusTests.cssrc/Arius.Core.Tests/Shared/ChunkStorage/ChunkStorageServiceReadTests.cssrc/Arius.Core.Tests/Shared/ChunkStorage/ChunkStorageServiceUploadTests.cssrc/Arius.Core.Tests/Shared/FileTree/FileTreeServiceTests.cssrc/Arius.Tests.Shared/BlobPathStrings.cs
💤 Files with no reviewable changes (1)
- src/Arius.Tests.Shared/BlobPathStrings.cs
| /// </summary> | ||
| public class DependencyTests | ||
| { | ||
| private static readonly string RepositoryRoot = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "..")); |
There was a problem hiding this comment.
Repository root discovery is brittle and can produce false-green test results.
Using a fixed .. depth from AppContext.BaseDirectory is environment-dependent; if output layout changes, helperPath can point to the wrong location and the test may pass even when BlobPathStrings.cs exists.
💡 Proposed fix
- private static readonly string RepositoryRoot = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", ".."));
+ private static readonly string RepositoryRoot = ResolveRepositoryRoot();
+
+ private static string ResolveRepositoryRoot()
+ {
+ var dir = new DirectoryInfo(AppContext.BaseDirectory);
+ while (dir is not null)
+ {
+ var testsSharedDir = Path.Combine(dir.FullName, "src", "Arius.Tests.Shared");
+ if (Directory.Exists(testsSharedDir))
+ return dir.FullName;
+
+ dir = dir.Parent;
+ }
+
+ throw new DirectoryNotFoundException(
+ $"Could not resolve repository root from '{AppContext.BaseDirectory}'.");
+ }Also applies to: 146-148
🤖 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 `@src/Arius.Architecture.Tests/DependencyTests.cs` at line 17, The hard-coded
upward Path.Combine chain used to initialize RepositoryRoot from
AppContext.BaseDirectory is brittle; replace it with a deterministic repo-root
discovery routine: implement a FindRepositoryRoot method that walks parent
directories from AppContext.BaseDirectory and returns the first directory
containing a repo marker (for example a .git folder or the solution file or the
known file BlobPathStrings.cs), use that method to set RepositoryRoot and to
compute helperPath (and update the checks around helperPath/BlobPathStrings.cs
referenced on lines ~146-148) and make the test fail loudly if no repo marker is
found instead of proceeding with a wrong path.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #90 +/- ##
=======================================
Coverage 78.77% 78.77%
=======================================
Files 78 78
Lines 5277 5277
Branches 722 722
=======================================
Hits 4157 4157
+ Misses 929 928 -1
- Partials 191 192 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Use BlobPaths directly in tests so blob names stay strongly typed and the obsolete string wrapper cannot drift from production paths.
Summary by CodeRabbit
Tests
Chores