Skip to content

Commit 1d69645

Browse files
authored
Merge pull request #75 from runcycles/fix/case-insensitive-scope-matching
fix: case-insensitive scope matching in getBalances/listReservations
2 parents aa7a5a2 + 7d40ee7 commit 1d69645

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

cycles-protocol-service/cycles-protocol-service-data/src/main/java/io/runcycles/protocol/data/repository/RedisReservationRepository.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ public ReservationListResponse listReservations(String tenant, String idempotenc
494494
if (!tenant.equals(fields.get("tenant"))) continue;
495495
if (status != null && !status.equals(fields.get("state"))) continue;
496496
if (idempotencyKey != null && !idempotencyKey.equals(fields.get("idempotency_key"))) continue;
497-
String scopePath = fields.getOrDefault("scope_path", "");
497+
String scopePath = fields.getOrDefault("scope_path", "").toLowerCase();
498498
if (workspaceSegment != null && !scopeHasSegment(scopePath, workspaceSegment)) continue;
499499
if (appSegment != null && !scopeHasSegment(scopePath, appSegment)) continue;
500500
if (workflowSegment != null && !scopeHasSegment(scopePath, workflowSegment)) continue;
@@ -566,6 +566,9 @@ public BalanceResponse getBalances(String tenant, String workspace, String app,
566566

567567
String trueScope = budget.get("scope");
568568
if (trueScope == null) continue;
569+
// Normalize stored scope to lowercase for case-insensitive matching.
570+
// Admin API may have stored mixed-case values before normalization was added.
571+
trueScope = trueScope.toLowerCase();
569572

570573
// Filter by tenant and optional subject fields.
571574
// Use exact segment boundary checks to avoid prefix false-positives

0 commit comments

Comments
 (0)