From 67f5fb8ecaa08148b2c4ab8a55b2e95665c83db2 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Thu, 17 Sep 2026 16:26:45 -0400 Subject: [PATCH] refactor(jobs): single-source strategy resolution in adapter LegacyPlateNesterAdapter.Create now delegates to PlateNesterFactory instead of carrying its own minimal Default-only switch, so built-in strategy resolution has one source of truth. Behavior unchanged: unknown keys still reject; all four built-ins now resolvable. 44 net8.0 tests pass in Debug and Release; 0 warnings. --- OpenNest.Engine/Jobs/Adapters/LegacyPlateNesterAdapter.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenNest.Engine/Jobs/Adapters/LegacyPlateNesterAdapter.cs b/OpenNest.Engine/Jobs/Adapters/LegacyPlateNesterAdapter.cs index 9aeb8a9..a01d7d7 100644 --- a/OpenNest.Engine/Jobs/Adapters/LegacyPlateNesterAdapter.cs +++ b/OpenNest.Engine/Jobs/Adapters/LegacyPlateNesterAdapter.cs @@ -18,10 +18,10 @@ public sealed class LegacyPlateNesterAdapter : IPlateNester this.engineFactory = engineFactory; } - /// Minimal built-in selection; never reads or changes NestEngineRegistry. - public static IPlateNester Create(string strategy) => strategy == "Default" - ? new LegacyPlateNesterAdapter(plate => new DefaultNestEngine(plate)) - : throw new NotSupportedException($"Unknown placement strategy: {strategy}."); + /// Convenience overload delegating to so strategy + /// resolution has a single source of truth; rejects unknown keys. Never reads or changes the + /// process-global NestEngineRegistry. + public static IPlateNester Create(string strategy) => PlateNesterFactory.Create(strategy); public PlateCandidate Place(PlatePlacementRequest request, IProgress progress = null, CancellationToken token = default)