[AZ-284] Autodev baseline + testability refactor

Phase A baseline outputs from /autodev (Steps 1-5):
- Problem & solution docs (_docs/00_problem, _docs/01_solution)
- Codebase documentation (_docs/02_document) incl. architecture,
  module-layout, glossary, system-flows, baseline compliance scan
- Test specs (blackbox, performance, resilience, security, resource,
  traceability matrix)
- Test task decomposition (_docs/02_tasks/todo): AZ-285..AZ-290
- Testability refactor (_docs/04_refactoring/01-testability-refactoring):
  - TC-01 Move DownloadedTileInfoV2 + new ExistingTileInfo to Common.DTO
  - TC-02 Replace dead ISatelliteDownloader API with real signatures
  - TC-03 GoogleMapsDownloaderV2 implements ISatelliteDownloader
  - TC-04 TileService depends on ISatelliteDownloader (mockable)
  - TC-05 DI + endpoints use ISatelliteDownloader
- Test runner scripts (scripts/run-tests.sh, run-performance-tests.sh)
- Autodev state pointer (_docs/_autodev_state.md)

Prepares the codebase for AZ-285..AZ-290 unit/integration test work.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-10 04:44:08 +03:00
parent 25a644a9bf
commit b0fffa6d42
68 changed files with 4192 additions and 11 deletions
@@ -5,18 +5,17 @@ using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using SatelliteProvider.Common.Configs;
using SatelliteProvider.Common.DTO;
using SatelliteProvider.Common.Interfaces;
using SatelliteProvider.Common.Utils;
namespace SatelliteProvider.Services;
public record DownloadedTileInfoV2(int X, int Y, int ZoomLevel, double CenterLatitude, double CenterLongitude, string FilePath, double TileSizeMeters);
public class RateLimitException : Exception
{
public RateLimitException(string message) : base(message) { }
}
public class GoogleMapsDownloaderV2
public class GoogleMapsDownloaderV2 : ISatelliteDownloader
{
private const string TILE_URL_TEMPLATE = "https://mt{0}.google.com/vt/lyrs=s&x={1}&y={2}&z={3}&token={4}";
private const string USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.0.0 Safari/537.36";
@@ -231,7 +230,7 @@ public class GoogleMapsDownloaderV2
GeoPoint centerGeoPoint,
double radiusM,
int zoomLevel,
IEnumerable<DataAccess.Models.TileEntity> existingTiles,
IEnumerable<ExistingTileInfo> existingTiles,
CancellationToken token = default)
{
if (!ALLOWED_ZOOM_LEVELS.Contains(zoomLevel))
+7 -3
View File
@@ -8,12 +8,12 @@ namespace SatelliteProvider.Services;
public class TileService : ITileService
{
private readonly GoogleMapsDownloaderV2 _downloader;
private readonly ISatelliteDownloader _downloader;
private readonly ITileRepository _tileRepository;
private readonly ILogger<TileService> _logger;
public TileService(
GoogleMapsDownloaderV2 downloader,
ISatelliteDownloader downloader,
ITileRepository tileRepository,
ILogger<TileService> logger)
{
@@ -36,11 +36,15 @@ public class TileService : ITileService
var centerPoint = new GeoPoint(latitude, longitude);
var existingTileInfos = existingTilesList
.Select(t => new ExistingTileInfo(t.Latitude, t.Longitude, t.TileZoom))
.ToList();
var downloadedTiles = await _downloader.GetTilesWithMetadataAsync(
centerPoint,
sizeMeters / 2,
zoomLevel,
existingTilesList,
existingTileInfos,
cancellationToken);
var result = new List<TileMetadata>();