Skip to content

Commit 74e5ad1

Browse files
authored
fix(inventory): address review feedback on area path counts (#124)
## Summary Follow-up to #123 addressing CodeRabbit and Codex review feedback. - **Case-sensitive comparer**: `AreaPathCounts` now uses the default case-sensitive comparer — Azure DevOps area paths are case-sensitive and `OrdinalIgnoreCase` would silently merge distinct paths - **Resume fix**: `inventory-areapath.csv` is now reloaded on resume so previously-collected rows are not overwritten when an interrupted inventory run is retried - **Unused import**: Removed `using System.Collections.ObjectModel` from `InventoryReport.cs` Note: the `GetValueOrDefault` nitpick was not applied — the TFS Object Model project targets `net481` where that method is unavailable; `TryGetValue` is kept there. ## Test plan - [x] All 1022 tests passing (`dotnet test`) - [x] Full solution builds with 0 errors 🤖 Generated with [Claude Code](https://claude.com/claude-code)
2 parents e73c4a7 + 79d63b1 commit 74e5ad1

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/DevOpsMigrationPlatform.Abstractions.Agent/Discovery/ProjectDiscoverySummary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ public class ProjectDiscoverySummary
3535
/// Work item count keyed by System.AreaPath. Populated on the final event only.
3636
/// Empty when the discovery path does not support field-level area path collection.
3737
/// </summary>
38-
public Dictionary<string, int> AreaPathCounts { get; } = new(StringComparer.OrdinalIgnoreCase);
38+
public Dictionary<string, int> AreaPathCounts { get; } = new();
3939
}

src/DevOpsMigrationPlatform.Abstractions/ControlPlaneApi/InventoryReport.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System;
55
using System.Collections.Generic;
6-
using System.Collections.ObjectModel;
76

87
namespace DevOpsMigrationPlatform.Abstractions.ControlPlaneApi;
98

src/DevOpsMigrationPlatform.Infrastructure.Agent/Discovery/InventoryOrchestrator.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,19 @@ public async Task RunAsync(
154154
orgProjectData.Values.Sum(l => l.Count));
155155
}
156156

157+
// Reload previously-written area-path CSV rows so a resumed run doesn't overwrite them.
158+
var existingAreaPathCsv = await ReadInventoryCsvAsync(package, OrgAreaPathCsvIndexFor(orgSlug), ct).ConfigureAwait(false);
159+
if (existingAreaPathCsv is not null)
160+
{
161+
var apLines = existingAreaPathCsv.Split('\n');
162+
for (int i = 1; i < apLines.Length; i++) // skip header
163+
{
164+
var trimmed = apLines[i].TrimEnd('\r');
165+
if (!string.IsNullOrWhiteSpace(trimmed))
166+
areaPathCsvBuilder.AppendLine(trimmed);
167+
}
168+
}
169+
157170
sink.Emit(new ProgressEvent
158171
{
159172
Module = moduleName,

0 commit comments

Comments
 (0)