You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: ServiceMapper.ToDto(Service domain, int? id = null) has zero callers in src/. It is only invoked from the unit-test project (tests/Servy.Core.UnitTests/Mappers/ServiceMapperTests.cs). All real persistence paths build the ServiceDto inline:
ServiceManager.InstallServiceAsync builds the DTO inline (Service.cs line ~301-356, ~55 lines duplicated logic from ToDto).
ServiceMapper.ToDomain (the inverse direction) IS used in production, so the class itself is not entirely dead — but ToDto is.
Why this matters:
Tests "verify" a method nobody calls in production, giving false confidence in the persistence path.
Anyone fixing a real DTO bug in ServiceManager.InstallServiceAsync won't see the test failure because the test exercises a different code path (ToDto vs the inline construction).
Severity: Info
File:
src/Servy.Core/Mappers/ServiceMapper.csLines: 22-89 (
ToDtomethod)Issue:
ServiceMapper.ToDto(Service domain, int? id = null)has zero callers insrc/. It is only invoked from the unit-test project (tests/Servy.Core.UnitTests/Mappers/ServiceMapperTests.cs). All real persistence paths build theServiceDtoinline:ServiceManager.InstallServiceAsyncbuilds the DTO inline (Service.cs line ~301-356, ~55 lines duplicated logic fromToDto).MainViewModel.ModelToServiceDto(Manager) does its own mapping (referenced in [Code Quality] Servy ServiceCommands.InstallService rebuilds Config→DTO mapping (drifts from MainViewModel.ModelToServiceDto, different sentinel values) #1021).Servy ServiceCommands.InstallServicerebuilds Config→DTO mapping (covered by [Code Quality] Servy ServiceCommands.InstallService rebuilds Config→DTO mapping (drifts from MainViewModel.ModelToServiceDto, different sentinel values) #1021).ServiceMapper.ToDomain(the inverse direction) IS used in production, so the class itself is not entirely dead — butToDtois.Why this matters:
ServiceManager.InstallServiceAsyncwon't see the test failure because the test exercises a different code path (ToDtovs the inline construction).ToDtoand the inline construction can drift silently. Same root cause as [Code Quality] Servy ServiceCommands.InstallService rebuilds Config→DTO mapping (drifts from MainViewModel.ModelToServiceDto, different sentinel values) #1021.Suggested fix:
Either:
ToDtoentirely (and its tests) — make the inline constructions the single source of truth, orServiceManager.InstallServiceAsync,MainViewModel.ModelToServiceDto, andServy ServiceCommands.InstallServiceto callServiceMapper.ToDto, eliminating ~150 lines of duplicate mapping logic and resolving [Code Quality] Servy ServiceCommands.InstallService rebuilds Config→DTO mapping (drifts from MainViewModel.ModelToServiceDto, different sentinel values) #1021 at the same time.Option 2 is the structurally cleaner fix — option 1 just acknowledges the dead code.
Code snippet (existing call sites):