[AZ-372] Apply dotnet format whitespace cleanup; archive batch 22
ci/woodpecker/push/01-test Pipeline was successful
ci/woodpecker/push/02-build-push Pipeline was successful

Pure whitespace-only cleanup uncovered by the new format gate from the
previous commit. Verified via `git diff -w --stat`: only 4 files differ
when whitespace is ignored, and those differ only by the BOM byte.

Cleanup kinds applied across 22 source files:
- BOM removal (MapConfig.cs, SatTile.cs, GeoUtils.cs,
  IntegrationTests/Program.cs)
- CRLF -> LF (IntegrationTests/Program.cs)
- Trailing whitespace on blank lines (Common, Api, DataAccess,
  IntegrationTests, Services.RegionProcessing,
  Services.TileDownloader)
- Final newline added (RoutePoint.cs, GeoPoint.cs, others)

After this commit `dotnet format whitespace SatelliteProvider.sln
--verify-no-changes` exits 0; AC-1 is enforceable from `scripts/
run-tests.sh` going forward.

Also lands the batch 22 report, code-review report
(PASS_WITH_WARNINGS, 2 Low findings — both deferred per spec),
dependency-table status update (AZ-372 -> Done (In Testing)), task
archive (todo/ -> done/), and autodev state update.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-11 04:43:08 +03:00
parent 68359350fc
commit 534ab41b8e
28 changed files with 519 additions and 279 deletions
@@ -28,9 +28,9 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
private static readonly System.Collections.Concurrent.ConcurrentDictionary<string, Task<DownloadedTileInfoV2>> _activeDownloads = new();
public GoogleMapsDownloaderV2(
ILogger<GoogleMapsDownloaderV2> logger,
IOptions<MapConfig> mapConfig,
IOptions<StorageConfig> storageConfig,
ILogger<GoogleMapsDownloaderV2> logger,
IOptions<MapConfig> mapConfig,
IOptions<StorageConfig> storageConfig,
IOptions<ProcessingConfig> processingConfig,
IHttpClientFactory httpClientFactory)
{
@@ -53,14 +53,14 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
{
var str = JsonConvert.SerializeObject(new { mapType = "satellite" });
var response = await httpClient.PostAsync(url, new StringContent(str));
if (!response.IsSuccessStatusCode)
{
var errorBody = await response.Content.ReadAsStringAsync();
_logger.LogError("Failed to get session token. Status: {StatusCode}, Response: {Response}",
_logger.LogError("Failed to get session token. Status: {StatusCode}, Response: {Response}",
response.StatusCode, errorBody);
}
response.EnsureSuccessStatusCode();
var sessionResponse = await response.Content.ReadFromJsonAsync<SessionResponse>();
return sessionResponse?.Session;
@@ -99,7 +99,7 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
var timestamp = DateTime.UtcNow.ToString("yyyyMMddHHmmss");
var subdirectory = _storageConfig.GetTileSubdirectoryPath(zoomLevel, tileX, tileY);
Directory.CreateDirectory(subdirectory);
var filePath = _storageConfig.GetTileFilePath(zoomLevel, tileX, tileY, timestamp);
var imageBytes = await ExecuteWithRetryAsync(async () =>
@@ -107,14 +107,14 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
using var httpClient = _httpClientFactory.CreateClient(GoogleMapsTilesClientName);
var response = await httpClient.GetAsync(url, token);
if (!response.IsSuccessStatusCode)
{
var errorBody = await response.Content.ReadAsStringAsync(token);
_logger.LogError("Single tile download failed. Tile: ({X}, {Y}), Status: {StatusCode}, Response: {Response}",
_logger.LogError("Single tile download failed. Tile: ({X}, {Y}), Status: {StatusCode}, Response: {Response}",
tileX, tileY, response.StatusCode, errorBody);
}
response.EnsureSuccessStatusCode();
return await response.Content.ReadAsByteArrayAsync(token);
@@ -171,7 +171,7 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
{
attempt++;
lastException = ex;
if (attempt >= maxRetries)
{
_logger.LogError(ex, "Rate limit (429) exceeded after {Attempts} attempts. This indicates Google Maps API throttling.", maxRetries);
@@ -196,7 +196,7 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
{
attempt++;
lastException = ex;
if (attempt >= maxRetries)
{
_logger.LogError(ex, "Server error ({StatusCode}) after {Attempts} attempts", ex.StatusCode, maxRetries);
@@ -218,14 +218,14 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
{
throw new InvalidOperationException($"Retry logic exhausted after {maxRetries} attempts", lastException);
}
throw new InvalidOperationException("Retry logic failed unexpectedly");
}
public async Task<List<DownloadedTileInfoV2>> GetTilesWithMetadataAsync(
GeoPoint centerGeoPoint,
double radiusM,
int zoomLevel,
GeoPoint centerGeoPoint,
double radiusM,
int zoomLevel,
IEnumerable<ExistingTileInfo> existingTiles,
CancellationToken token = default)
{
@@ -247,7 +247,7 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
for (var x = xMin; x <= xMax; x++)
{
var tileCenter = GeoUtils.TileToWorldPos(x, y, zoomLevel);
var tolerance = _processingConfig.LatLonTolerance;
var existingTile = existingTiles.FirstOrDefault(t =>
Math.Abs(t.Latitude - tileCenter.Lat) < tolerance &&
@@ -271,14 +271,14 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
}
var sessionToken = await GetSessionToken();
var downloadTasks = new List<Task<DownloadedTileInfoV2?>>();
int sessionTokenUsageCount = 0;
for (int i = 0; i < tilesToDownload.Count; i++)
{
var tileInfo = tilesToDownload[i];
if (sessionTokenUsageCount >= _processingConfig.SessionTokenReuseCount)
{
sessionToken = await GetSessionToken();
@@ -290,11 +290,11 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
sessionTokenUsageCount++;
var downloadTask = DownloadTileAsync(
tileInfo.x,
tileInfo.y,
tileInfo.center,
tileInfo.tileSizeMeters,
zoomLevel,
tileInfo.x,
tileInfo.y,
tileInfo.center,
tileInfo.tileSizeMeters,
zoomLevel,
currentToken,
tileIndex,
tilesToDownload.Count,
@@ -304,25 +304,25 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
}
var results = await Task.WhenAll(downloadTasks);
var downloadedTiles = results.Where(r => r != null).Cast<DownloadedTileInfoV2>().ToList();
return downloadedTiles;
}
private async Task<DownloadedTileInfoV2?> DownloadTileAsync(
int x,
int y,
GeoPoint tileCenter,
double tileSizeMeters,
int zoomLevel,
int x,
int y,
GeoPoint tileCenter,
double tileSizeMeters,
int zoomLevel,
string? sessionToken,
int tileIndex,
int totalTiles,
CancellationToken token)
{
var tileKey = $"{zoomLevel}_{x}_{y}";
var downloadTask = _activeDownloads.GetOrAdd(tileKey, _ => PerformDownloadAsync(
x, y, tileCenter, tileSizeMeters, zoomLevel, sessionToken, tileIndex, totalTiles, token));
@@ -337,11 +337,11 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
}
private async Task<DownloadedTileInfoV2> PerformDownloadAsync(
int x,
int y,
GeoPoint tileCenter,
double tileSizeMeters,
int zoomLevel,
int x,
int y,
GeoPoint tileCenter,
double tileSizeMeters,
int zoomLevel,
string? sessionToken,
int tileIndex,
int totalTiles,
@@ -362,7 +362,7 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
var timestamp = DateTime.UtcNow.ToString("yyyyMMddHHmmss");
var subdirectory = _storageConfig.GetTileSubdirectoryPath(zoomLevel, x, y);
Directory.CreateDirectory(subdirectory);
var filePath = _storageConfig.GetTileFilePath(zoomLevel, x, y, timestamp);
var imageBytes = await ExecuteWithRetryAsync(async () =>
@@ -370,14 +370,14 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
using var httpClient = _httpClientFactory.CreateClient(GoogleMapsTilesClientName);
var response = await httpClient.GetAsync(url, token);
if (!response.IsSuccessStatusCode)
{
var errorBody = await response.Content.ReadAsStringAsync(token);
_logger.LogError("Tile download failed. Tile: ({X}, {Y}), Status: {StatusCode}, Response: {Response}",
_logger.LogError("Tile download failed. Tile: ({X}, {Y}), Status: {StatusCode}, Response: {Response}",
x, y, response.StatusCode, errorBody);
}
response.EnsureSuccessStatusCode();
return await response.Content.ReadAsByteArrayAsync(token);
@@ -405,7 +405,7 @@ public class GoogleMapsDownloaderV2 : ISatelliteDownloader
}
catch (HttpRequestException ex)
{
_logger.LogError(ex, "HTTP request failed for tile ({X}, {Y}). StatusCode: {StatusCode}",
_logger.LogError(ex, "HTTP request failed for tile ({X}, {Y}). StatusCode: {StatusCode}",
x, y, ex.StatusCode);
throw;
}
@@ -84,9 +84,9 @@ public class TileService : ITileService
}
public async Task<IEnumerable<TileMetadata>> GetTilesByRegionAsync(
double latitude,
double longitude,
double sizeMeters,
double latitude,
double longitude,
double sizeMeters,
int zoomLevel)
{
var tiles = await _tileRepository.GetTilesByRegionAsync(latitude, longitude, sizeMeters, zoomLevel);