Revert "Change TPA authentication integration name"#320
Revert "Change TPA authentication integration name"#320
Conversation
This reverts commit 968f56a.
Review Summary by QodoRevert TPA authentication integration name change
WalkthroughsDescription• Reverts integration name from 'tssc-trustificationauth-integration' to 'tssc-authentication-integration' • Restores original secret name in Kubernetes client calls • Updates error message to reflect correct integration name Diagramflowchart LR
A["tssc-trustificationauth-integration<br/>(incorrect)"] -- "revert to" --> B["tssc-authentication-integration<br/>(correct)"]
C["Error message<br/>with old name"] -- "update" --> D["Error message<br/>with correct name"]
File Changes1. src/rhtap/core/integration/authentication/authentication.ts
|
Code Review by Qodo
1. Secret rename breaks deployments
|
📝 WalkthroughWalkthroughThe authentication integration module's secret lookup has been updated to reference 'tssc-authentication-integration' instead of 'tssc-trustificationauth-integration'. The associated error message is updated to reflect this change. Control flow remains identical. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| */ | ||
| private async loadSecret(): Promise<Record<string, string>> { | ||
| const secret = await this.kubeClient.getSecret('tssc-trustificationauth-integration', 'tssc'); | ||
| const secret = await this.kubeClient.getSecret('tssc-authentication-integration', 'tssc'); |
There was a problem hiding this comment.
1. Secret rename breaks deployments 🐞 Bug ⛯ Reliability
Authentication now only looks for tssc-authentication-integration; environments still using the reverted secret name will fail during Authentication.initialize(), which is part of required service initialization for post-creation commands.
Agent Prompt
### Issue description
`Authentication.loadSecret()` is hardcoded to a single secret name. This PR changes that name, which can break any environment that still provisions the previous secret name. Because `Authentication.initialize()` is invoked as part of required service initialization, this failure prevents post-creation workflows.
### Issue Context
The integration secret name is not defined elsewhere in this repo (no manifest/docs), so runtime compatibility depends on cluster provisioning.
### Fix Focus Areas
- src/rhtap/core/integration/authentication/authentication.ts[32-39]
### Implementation direction (one of)
1) **Configurable name**: read secret name from env/config with default `tssc-authentication-integration`.
2) **Fallback**: attempt `tssc-authentication-integration`, and if not found, try the previous name (and log a warning/deprecation). Ensure errors are explicit about which names were tried.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/rhtap/core/integration/authentication/authentication.ts`:
- Around line 33-36: The method currently hardcodes the secret identity string
twice ("tssc-authentication-integration" and "tssc") which risks configuration
drift; extract the secret name and namespace into class-level static constants
(e.g., SECRET_NAME and SECRET_NAMESPACE) and use those constants in the
this.kubeClient.getSecret call and in the thrown Error message via a template
literal so there is a single source of truth; apply the same refactor pattern
for analogous constants in tpa.ts and other integration files for consistency
across the integration module.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b0b897b0-d828-4250-a67b-74d1c8fd6010
📒 Files selected for processing (1)
src/rhtap/core/integration/authentication/authentication.ts
| const secret = await this.kubeClient.getSecret('tssc-authentication-integration', 'tssc'); | ||
| if (!secret) { | ||
| throw new Error( | ||
| 'Authentication integration secret tssc-trustificationauth-integration not found in the cluster. Please ensure the secret exists.' | ||
| 'Authentication integration secret tssc-authentication-integration not found in the cluster. Please ensure the secret exists.' |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, locate and examine the authentication file
find . -name "authentication.ts" -type f | head -20Repository: redhat-appstudio/tssc-test
Length of output: 131
🏁 Script executed:
# Check if the file exists and view the relevant lines
if [ -f "src/rhtap/core/integration/authentication/authentication.ts" ]; then
echo "=== File found. Showing lines 25-45 for context ==="
sed -n '25,45p' src/rhtap/core/integration/authentication/authentication.ts
else
echo "File not found at specified path"
git ls-files | grep -i authentication | head -20
fiRepository: redhat-appstudio/tssc-test
Length of output: 858
🏁 Script executed:
# Search for secret name references across the repository
echo "=== Searching for tssc-authentication-integration references ==="
rg -n "tssc-authentication-integration" --max-count=50
echo ""
echo "=== Searching for tssc-trustificationauth-integration references ==="
rg -n "tssc-trustificationauth-integration" --max-count=50Repository: redhat-appstudio/tssc-test
Length of output: 560
🏁 Script executed:
# Look for manifest files that might define this secret
echo "=== Searching for secret definitions in manifests ==="
find . -type f \( -name "*.yaml" -o -name "*.yml" -o -name "*.json" \) ! -path "*/node_modules/*" ! -path "*/.git/*" | head -50 | xargs grep -l "tssc-authentication-integration\|authentication-integration" 2>/dev/null | head -20Repository: redhat-appstudio/tssc-test
Length of output: 123
🏁 Script executed:
# Check the tpa.ts file mentioned in the review for comparison
echo "=== Checking similar pattern in tpa.ts ==="
if [ -f "src/rhtap/core/integration/tpa/tpa.ts" ]; then
sed -n '30,50p' src/rhtap/core/integration/tpa/tpa.ts
fiRepository: redhat-appstudio/tssc-test
Length of output: 809
🏁 Script executed:
# Check for test files that might reference the authentication secret
echo "=== Searching for test files referencing authentication secret ==="
find . -type f \( -name "*.test.ts" -o -name "*.spec.ts" -o -name "*test*.ts" \) ! -path "*/node_modules/*" | xargs grep -l "tssc-authentication-integration\|Authentication" 2>/dev/null | head -20Repository: redhat-appstudio/tssc-test
Length of output: 199
🏁 Script executed:
# Verify the refactor suggestion is syntactically aligned with the file's class structure
echo "=== Checking Authentication class structure ==="
sed -n '1,30p' src/rhtap/core/integration/authentication/authentication.tsRepository: redhat-appstudio/tssc-test
Length of output: 1155
🏁 Script executed:
# Check what the test files actually contain regarding authentication secrets
echo "=== Content of component.test.ts ==="
grep -n -C3 "tssc-authentication-integration\|Authentication.*secret\|getSecret" ./tests/ui/component.test.ts | head -30
echo ""
echo "=== Content of gitopsResource.test.ts ==="
grep -n -C3 "tssc-authentication-integration\|Authentication.*secret\|getSecret" ./tests/ui/gitopsResource.test.ts | head -30Repository: redhat-appstudio/tssc-test
Length of output: 149
🏁 Script executed:
# Also verify this is the correct pattern to follow by checking if there are any constants already defined elsewhere
echo "=== Checking if constants are defined elsewhere in integration classes ==="
rg -n "private static readonly.*=.*'" src/rhtap/core/integration/ | head -20Repository: redhat-appstudio/tssc-test
Length of output: 298
Hoist the authentication secret identity into static constants to eliminate configuration drift risk.
The secret name tssc-authentication-integration appears twice in this method—once in the lookup and again in the error message. Since this PR reverts a prior configuration change, duplicating the literal makes it easy to update one location inconsistently on future changes. Extract both the name and namespace as static constants, and use a template literal in the error message for a single source of truth across the class.
Suggested refactor
export class Authentication implements IntegrationSecret {
private static instance: Authentication | null = null;
+ private static readonly SECRET_NAME = 'tssc-authentication-integration';
+ private static readonly SECRET_NAMESPACE = 'tssc';
private readonly logger: Logger;
private kubeClient: KubeClient;
private secret: Record<string, string> = {};
private async loadSecret(): Promise<Record<string, string>> {
- const secret = await this.kubeClient.getSecret('tssc-authentication-integration', 'tssc');
+ const secret = await this.kubeClient.getSecret(
+ Authentication.SECRET_NAME,
+ Authentication.SECRET_NAMESPACE
+ );
if (!secret) {
throw new Error(
- 'Authentication integration secret tssc-authentication-integration not found in the cluster. Please ensure the secret exists.'
+ `Authentication integration secret ${Authentication.SECRET_NAME} not found in the cluster. Please ensure the secret exists.`
);
}
return secret;
}The same pattern exists in tpa.ts and other integration files; consider standardizing this across the integration module for consistent configuration management and reduced maintenance burden on future reverts.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const secret = await this.kubeClient.getSecret('tssc-authentication-integration', 'tssc'); | |
| if (!secret) { | |
| throw new Error( | |
| 'Authentication integration secret tssc-trustificationauth-integration not found in the cluster. Please ensure the secret exists.' | |
| 'Authentication integration secret tssc-authentication-integration not found in the cluster. Please ensure the secret exists.' | |
| export class Authentication implements IntegrationSecret { | |
| private static instance: Authentication | null = null; | |
| private static readonly SECRET_NAME = 'tssc-authentication-integration'; | |
| private static readonly SECRET_NAMESPACE = 'tssc'; | |
| private readonly logger: Logger; | |
| private kubeClient: KubeClient; | |
| private secret: Record<string, string> = {}; | |
| private async loadSecret(): Promise<Record<string, string>> { | |
| const secret = await this.kubeClient.getSecret( | |
| Authentication.SECRET_NAME, | |
| Authentication.SECRET_NAMESPACE | |
| ); | |
| if (!secret) { | |
| throw new Error( | |
| `Authentication integration secret ${Authentication.SECRET_NAME} not found in the cluster. Please ensure the secret exists.` | |
| ); | |
| } | |
| return secret; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/rhtap/core/integration/authentication/authentication.ts` around lines 33
- 36, The method currently hardcodes the secret identity string twice
("tssc-authentication-integration" and "tssc") which risks configuration drift;
extract the secret name and namespace into class-level static constants (e.g.,
SECRET_NAME and SECRET_NAMESPACE) and use those constants in the
this.kubeClient.getSecret call and in the thrown Error message via a template
literal so there is a single source of truth; apply the same refactor pattern
for analogous constants in tpa.ts and other integration files for consistency
across the integration module.
|
@xinredhat: The following test has Failed, say /retest to rerun failed tests.
Inspecting Test ArtifactsTo inspect your test artifacts, follow these steps:
mkdir -p oras-artifacts
cd oras-artifacts
oras pull quay.io/konflux-test-storage/rhtap-team/rhtap-cli:e2e-4.20-ph7qrTest results analysis<not enabled> OCI Artifact Browser URL<not enabled> |
Reverts #319
Summary by CodeRabbit