Skip to content

Added invalid token cache for Alfred and Nexus#24196

Merged
dhr-verma merged 4 commits intomicrosoft:mainfrom
dhr-verma:vermadhr/cacheValidationErrorsOnClientServices
Apr 11, 2025
Merged

Added invalid token cache for Alfred and Nexus#24196
dhr-verma merged 4 commits intomicrosoft:mainfrom
dhr-verma:vermadhr/cacheValidationErrorsOnClientServices

Conversation

@dhr-verma
Copy link
Copy Markdown
Contributor

Description

Alfred, Nexus and Historian validate access tokens by making API calls to Riddler. We have seen significant amount of these calls fail with a 401 or 403 error. Indicating that Riddler has determined tokens to invalid multiple times. To try and reduce the calls b/w these services and riddler, this PR introduces a means to cache invalid tokens. These tokens can be cached in plaintext since these are invalid and cannot be made valid in the future.

Copilot AI review requested due to automatic review settings March 31, 2025 16:00
@github-actions github-actions Bot added area: server Server related issues (routerlicious) base: main PRs targeted against main branch labels Mar 31, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a caching mechanism for invalid access tokens used by Alfred, Nexus, and Historian to reduce redundant API calls to Riddler when tokens are known to be invalid.

  • Introduces a new IInvalidTokenError interface and exports it for consistency.
  • Implements invalid token caching logic in the TenantManager with proper error conversion.
  • Updates Nexus and Alfred runner factories to integrate a Redis cache for invalid tokens via new customization options.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
server/routerlicious/packages/services/src/tenant.ts Adds invalid token caching logic and error conversion in token verification.
server/routerlicious/packages/services-core/src/tenant.ts Defines the IInvalidTokenError interface.
server/routerlicious/packages/services-core/src/index.ts Exports IInvalidTokenError.
server/routerlicious/packages/routerlicious-base/src/utils/constants.ts Adds a new constant for invalid token cache prefix.
server/routerlicious/packages/routerlicious-base/src/nexus/runnerFactory.ts Integrates Redis cache for invalid tokens into Nexus resources.
server/routerlicious/packages/routerlicious-base/src/nexus/customizations.ts Adds customization option for the invalid token cache Redis connection manager.
server/routerlicious/packages/routerlicious-base/src/alfred/runnerFactory.ts Integrates Redis cache for invalid tokens into Alfred resources.
server/routerlicious/packages/routerlicious-base/src/alfred/customizations.ts Adds customization option for the invalid token cache Redis connection manager.

Comment thread server/routerlicious/packages/services/src/tenant.ts
@dhr-verma dhr-verma closed this Mar 31, 2025
@dhr-verma dhr-verma reopened this Apr 11, 2025
Comment thread server/routerlicious/packages/services/src/tenant.ts Outdated
@dhr-verma dhr-verma requested a review from znewton April 11, 2025 19:46
@dhr-verma dhr-verma enabled auto-merge (squash) April 11, 2025 19:46
@dhr-verma dhr-verma merged commit 0f09a28 into microsoft:main Apr 11, 2025
28 checks passed
dhr-verma added a commit that referenced this pull request Apr 14, 2025
## Description

Follow-up to #24196,
adds the invalid token cache to Historian as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: server Server related issues (routerlicious) base: main PRs targeted against main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants