feat: ship Wave 5-6 multi-surface hygiene, optimization, and bug fixes

This commit is contained in:
Yun Chan 2026-11-14 11:51:41 +09:00
parent 01ef3293cf
commit 66b6b45ba9
399 changed files with 17828 additions and 11330 deletions

View file

@ -91,6 +91,24 @@ public sealed class SttControllerSecurityTests
Assert.Equal("edge-internal", service.LastUserEmail);
}
[Fact]
public async Task InternalGateway_PropagatesRequestAbortedTokenToSttService()
{
var service = new RecordingSttService();
using var cts = new CancellationTokenSource();
var controller = CreateController(
service,
null,
isAuthenticated: false,
suppliedGatewayToken: GatewayToken,
includeAudioForm: true,
requestAborted: cts.Token);
await controller.TranscribeFromQuotaGateway();
Assert.Equal(cts.Token, service.LastCancellationToken);
}
private static SttController CreateController(
RecordingSttService service,
string? userId,
@ -98,7 +116,8 @@ public sealed class SttControllerSecurityTests
string? email = null,
string configuredGatewayToken = GatewayToken,
string? suppliedGatewayToken = null,
bool includeAudioForm = false)
bool includeAudioForm = false,
CancellationToken requestAborted = default)
{
var claims = new List<Claim>();
if (userId != null) claims.Add(new Claim(ClaimTypes.NameIdentifier, userId));
@ -106,7 +125,8 @@ public sealed class SttControllerSecurityTests
var identity = new ClaimsIdentity(claims, isAuthenticated ? "test-auth" : null);
var context = new DefaultHttpContext
{
User = new ClaimsPrincipal(identity)
User = new ClaimsPrincipal(identity),
RequestAborted = requestAborted
};
if (includeAudioForm)
{
@ -152,6 +172,7 @@ public sealed class SttControllerSecurityTests
public int LastUserId { get; private set; }
public string? LastUserEmail { get; private set; }
public bool LastRecordUsage { get; private set; } = true;
public CancellationToken LastCancellationToken { get; private set; }
public Task<SttTranscribeResponse> TranscribeAsync(
int userId,
@ -160,19 +181,25 @@ public sealed class SttControllerSecurityTests
byte[]? audioBytes = null,
string? contentType = null,
string? fileName = null,
bool recordUsage = true)
bool recordUsage = true,
CancellationToken cancellationToken = default)
{
TranscribeCalls++;
LastUserId = userId;
LastUserEmail = userEmail;
LastRecordUsage = recordUsage;
LastCancellationToken = cancellationToken;
if (Exception != null) throw Exception;
return Task.FromResult(new SttTranscribeResponse(
"real transcript", 0.99, "ko", 1, "test", "test-model", 1, 0));
}
public Task<SttTestResultDto> TestEndpointAsync(int endpointId, string? testApiKey = null, string? testEndpointUrl = null) =>
public Task<SttTestResultDto> TestEndpointAsync(
int endpointId,
string? testApiKey = null,
string? testEndpointUrl = null,
CancellationToken cancellationToken = default) =>
throw new NotSupportedException();
public Task<List<SttProviderEndpointDto>> GetAllEndpointsAsync() =>