wip: doctor/cli/docs/api to vector db consolidation; api hardening for descriptions, tenant, and scopes; migrations and conversions of all DALs to EF v10

This commit is contained in:
master
2026-02-23 15:30:50 +02:00
parent bd8fee6ed8
commit e746577380
1424 changed files with 81225 additions and 25251 deletions

View File

@@ -1,5 +1,6 @@
using StellaOps.Auth.Client;
using StellaOps.Cli.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -44,6 +45,7 @@ public static class StellaOpsTokenClientExtensions
/// <summary>
/// Gets a cached access token or requests a new one if not cached or expired.
/// This is a compatibility shim for the old GetCachedAccessTokenAsync pattern.
/// Cache key includes effective tenant to prevent cross-tenant cache collisions.
/// </summary>
public static async Task<StellaOpsTokenCacheEntry> GetCachedAccessTokenAsync(
this IStellaOpsTokenClient client,
@@ -54,7 +56,7 @@ public static class StellaOpsTokenClientExtensions
var scopeList = scopes?.Where(s => !string.IsNullOrWhiteSpace(s)).OrderBy(s => s).ToArray() ?? [];
var scope = string.Join(" ", scopeList);
var cacheKey = $"cc:{scope}";
var cacheKey = BuildCacheKey(scope);
// Check cache first
var cached = await client.GetCachedTokenAsync(cacheKey, cancellationToken).ConfigureAwait(false);
@@ -84,7 +86,7 @@ public static class StellaOpsTokenClientExtensions
{
ArgumentNullException.ThrowIfNull(client);
var cacheKey = $"cc:{scope ?? "default"}";
var cacheKey = BuildCacheKey(scope ?? "default");
// Check cache first
var cached = await client.GetCachedTokenAsync(cacheKey, cancellationToken).ConfigureAwait(false);
@@ -113,4 +115,14 @@ public static class StellaOpsTokenClientExtensions
ArgumentNullException.ThrowIfNull(client);
return await client.RequestClientCredentialsTokenAsync(null, null, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Builds a cache key that includes the effective tenant to prevent cross-tenant
/// token cache collisions when users switch tenants between CLI invocations.
/// </summary>
private static string BuildCacheKey(string scope)
{
var tenant = TenantProfileStore.GetEffectiveTenant(null) ?? "none";
return $"cc:{tenant}:{scope}";
}
}