feat: 멀티홉 변환 UI 자동 노출 (OutputsForInput → 그래프 reachability)
ProviderRegistry.OutputsForInput을 그래프 transitive closure로 전환. UI 코드 변경 0으로 멀티홉 변환(json→xlsx, svg→jpg 등)이 사이드바·카스케이드 메뉴에 자동 노출된다. 동일 포맷 self-edge는 제외. - DirectOutputsForInput(1홉)도 별도 보존 - 카스케이드 메뉴는 PopularOutputs 교집합이라 폭발 없이 풍부해짐 - 테스트 1개 추가 (멀티홉 노출 검증) — 총 38개 통과 - SSOT P6 in_progress
This commit is contained in:
parent
7235fc87f5
commit
47a4a961e2
5 changed files with 31 additions and 3 deletions
|
|
@ -55,6 +55,18 @@ public sealed class ProviderRegistry
|
|||
}
|
||||
|
||||
public IReadOnlyList<string> OutputsForInput(string inputExtension)
|
||||
{
|
||||
// 그래프 reachability(transitive closure)로 멀티홉 변환까지 노출한다 (예: json→xlsx, svg→jpg).
|
||||
// 동일 포맷(self-edge: txt→txt AI, png→png 압축)은 '다른 형식으로 변환' 목록에서 제외.
|
||||
var input = ConversionPair.Normalize(inputExtension);
|
||||
return _graph.ReachableOutputs(input, maxHops: 3, allowLossy: true)
|
||||
.Where(o => !string.Equals(o, input, StringComparison.OrdinalIgnoreCase))
|
||||
.OrderBy(e => e, StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>1홉 직접 출력만 (그래프 reachability 이전의 좁은 목록이 필요한 곳용).</summary>
|
||||
public IReadOnlyList<string> DirectOutputsForInput(string inputExtension)
|
||||
{
|
||||
var input = ConversionPair.Normalize(inputExtension);
|
||||
return _outputsByInput.TryGetValue(input, out var list)
|
||||
|
|
|
|||
|
|
@ -207,4 +207,20 @@ public class RegistryGraphIntegrationTests
|
|||
var path = graph.FindBestPath(".png", ".pdf", maxHops: 3);
|
||||
Assert.NotNull(path);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OutputsForInput_ExposesMultiHopReachable()
|
||||
{
|
||||
var reg = Everything2EverythingBootstrap.CreateDefault().Providers;
|
||||
|
||||
var jsonOut = reg.OutputsForInput(".json");
|
||||
Assert.Contains(".csv", jsonOut); // 직접
|
||||
Assert.Contains(".xlsx", jsonOut); // 멀티홉 json→csv→xlsx
|
||||
Assert.DoesNotContain(".json", jsonOut); // 동일 포맷 self 제외
|
||||
|
||||
var svgOut = reg.OutputsForInput(".svg");
|
||||
Assert.Contains(".png", svgOut); // 직접
|
||||
Assert.Contains(".jpg", svgOut); // 멀티홉 svg→png→jpg
|
||||
Assert.Contains(".pdf", svgOut); // 직접
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue