Skip to content

Add Secret Management UI Implementation - #3129

Open
npamudika wants to merge 7 commits into
wso2:mainfrom
npamudika:secret-management
Open

Add Secret Management UI Implementation#3129
npamudika wants to merge 7 commits into
wso2:mainfrom
npamudika:secret-management

Conversation

@npamudika

@npamudika npamudika commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Purpose

Platform API already supports encrypting upstream credentials for LLM providers, LLM proxies, MCP proxies, and REST APIs via {{ secret "handle" }} placeholders (added in #2149, but two gaps made that feature incomplete in practice:

  • No UI to manage secrets directly. The only way to create, rotate, or delete a secret was a raw API/CLI call — there was no screen in AI Workspace for it, "no dedicated Secrets screen in any portal").
  • Rotation/deletion wasn't live. A gateway only picked up a rotated or deleted secret on its next reconnect-triggered poll sync. An already-connected gateway kept serving the old credential — e.g. rotating a leaked API key didn't actually stop it being used until that gateway happened to reconnect or restart.
  • While building and testing the fix for (2), a related latent bug surfaced: BuildAPIDeploymentYAML silently dropped upstream.main/sandbox.auth from the REST API deployment YAML, so secret-backed REST API upstream credentials never reached the gateway at all — it just quietly forwarded requests with no auth header.

Resolves:

#2149

Goals

  • Ship a dedicated Secrets UI in AI Workspace (list/search, create, view, rotate, delete) under Organization Settings, scope-gated on ap:secret:read.
  • Push secret.updated / secret.deprecated events from platform-api to every connected gateway-controller over the existing control-plane WebSocket, so rotation/deletion takes effect in about a second instead of waiting for the next reconnect.
  • Fix the REST API deployment YAML gap so secret-backed REST API upstreams actually work.
  • Close a set of correctness, UX, and hardening gaps found via a dedicated live-testing pass against a real running stack (docker platform-api + ai-workspace + gateway-controller + gateway-runtime): a rotate-form field-name mismatch that silently dropped display-name edits, missing server-side handle validation (a handle containing / was creatable but then permanently unreachable via the API), a broadcast-ordering bug, an unhelpful validation error message, and frontend accessibility/robustness gaps.

Approach

Backend (Go, platform-api):

  • SecretService — full CRUD, broadcastSecretEvent (best-effort, fans out to every gateway in the org via GatewayEventsService), server-side handle validation (constants.SecretHandlePattern / SecretHandleMaxLength, mirroring the frontend's slug rule), and ValidateSecretRefs now distinguishes a missing handle from a deprecated one in its error message.
  • GatewayEventsService.BroadcastSecretUpdatedEvent / BroadcastSecretDeprecatedEvent — new event types on the existing EventHub WebSocket channel used for all other control-plane push events.
    dto.UpstreamTarget gained an Auth field, and BuildAPIDeploymentYAML now copies it through — the deployment-YAML fix.

Backend (Go, gateway-controller):

  • client.go dispatch: handleSecretUpdatedEvent fetches the new plaintext on demand and re-encrypts it into local storage; handleSecretDeprecatedEvent evicts the local copy. Both fall back cleanly to the existing poll-based sync if the push is missed (disconnected gateway, delivery failure, etc.).

Frontend (AI Workspace):

  • Five new pages under portals/ai-workspace/src/pages/appShell/appShellPages/secret/: SecretsList, CreateSecret, SecretOverview, RotateSecret, DeleteSecretDialog — wired into App.tsx routing and the Settings nav.
  • Accessibility: list rows are keyboard-navigable (role="link", tabIndex, Enter/Space handling, aria-label).
  • Hardening: autoComplete="new-password" on credential inputs (avoids browser password-manager prompts), and a new useIsMounted hook guards state updates in Create/Rotate/Delete after the component has unmounted.

UIs

Screenshot 2026-08-05 at 11 14 57 Screenshot 2026-08-05 at 11 15 16 Screenshot 2026-08-05 at 11 15 35 Screenshot 2026-08-05 at 11 15 59 Screenshot 2026-08-05 at 11 16 12 Screenshot 2026-08-05 at 11 16 48

User Stories

  • As an AI Workspace admin, I can create, view, rotate, and delete secrets from the UI without needing API/CLI access.
  • As an admin rotating a leaked or expiring credential, the new value takes effect on every already-connected gateway within about a second, not just on that gateway's next reconnect.
  • As an admin trying to delete a secret still in use, I see exactly which resources reference it instead of a generic failure.
  • As a keyboard/assistive-technology user, I can navigate and operate the Secrets list without a mouse.

Documentation

https://github.com/wso2/api-platform/blob/main/docs/rest-apis/platform-api/secrets.md

Automation Tests

  • Unit tests (Go): 42 test functions across the secret-management surface
  • Integration/e2e tests (Cucumber/godog, tests/integration-e2e/):
  1. features/secret_lifecycle.feature (2 scenarios) — rotation and deletion pushing live to an already-connected gateway, verified against the gateway's own management API.
  2. features/rest_api_secret.feature, features/policy_secret.feature (1 each) — on-demand secret resolution at deploy time for REST APIs and policy params.
  3. Additionally hand-verified live against a real docker stack (platform-api + ai-workspace + gateway-controller + gateway-runtime) this session: full create/rotate/delete UI flow, XSS-payload rendering safety, delete-blocked-by-reference dialog, disconnected-gateway reconnect catch-up, and every fix above reproduced pre-fix and confirmed post-fix.

Related PRs

Refer the PRs mentioned in #2149

Test Environment

  • Go: 1.26.5 (per platform-api/go.mod)
  • Node: 20.20.2 (per portals/ai-workspace/.nvmrc)
  • OS: macOS 15.7.3 (Darwin 24.6.0, arm64)
  • Database: SQLite (local dev); the shared ValidateSecretRefs/handle-validation logic is DB-agnostic and covered against SQLite in tests — not separately re-verified against PostgreSQL/SQL Server in this pass.
  • Browser: Chromium-based embedded test browser (headless automation) against the built AI Workspace frontend bundle.
  • Containers: Docker Compose stack — platform-api, ai-workspace, gateway-controller, gateway-runtime, sample-backend, all built from this branch's source.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Naduni Pamudika seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@npamudika, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 44 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e8c83663-aaca-40cf-b6e5-9b7ad310a35f

📥 Commits

Reviewing files that changed from the base of the PR and between ec6b891 and 9facac3.

📒 Files selected for processing (32)
  • gateway/gateway-controller/pkg/controlplane/client.go
  • gateway/gateway-controller/pkg/controlplane/events.go
  • gateway/gateway-controller/pkg/controlplane/sync_secrets_test.go
  • platform-api/internal/constants/constants.go
  • platform-api/internal/dto/api.go
  • platform-api/internal/model/secret.go
  • platform-api/internal/repository/secret.go
  • platform-api/internal/server/server.go
  • platform-api/internal/service/gateway_events.go
  • platform-api/internal/service/mcp_secret_resolution_test.go
  • platform-api/internal/service/secret_service.go
  • platform-api/internal/service/secret_service_broadcast_test.go
  • platform-api/internal/service/secret_service_test.go
  • platform-api/internal/utils/api.go
  • platform-api/internal/utils/api_test.go
  • portals/ai-workspace/cypress/e2e/001-providers/002-provider-secret-management.cy.js
  • portals/ai-workspace/cypress/e2e/001-providers/003-llm-proxy-secret-management.cy.js
  • portals/ai-workspace/src/App.tsx
  • portals/ai-workspace/src/apis/secretApis.ts
  • portals/ai-workspace/src/clients/choreoApiClient.ts
  • portals/ai-workspace/src/hooks/useIsMounted.ts
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/CreateSecret.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/DeleteSecretDialog.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/RotateSecret.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/SecretOverview.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/SecretsList.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/settings/Main.tsx
  • tests/integration-e2e/README.md
  • tests/integration-e2e/features/secret_lifecycle.feature
  • tests/integration-e2e/secret_helpers_test.go
  • tests/integration-e2e/secret_lifecycle_steps_test.go
  • tests/integration-e2e/steps_test.go
📝 Walkthrough

Walkthrough

The change adds revision-aware secret lifecycle events, gateway synchronization, secret handle validation, upstream authentication serialization, portal secret management pages, SQL Server locking support, and integration coverage for live rotation and deprecation.

Changes

Secret lifecycle backend

Layer / File(s) Summary
Secret contracts and validation
gateway/gateway-controller/pkg/controlplane/events.go, platform-api/internal/model/secret.go, platform-api/internal/constants/constants.go, platform-api/internal/service/secret_service.go, platform-api/internal/service/secret_service_test.go
Adds lifecycle event payloads, revision fields, handle constraints, and separate validation for missing and deprecated references.
Secret event broadcasting
platform-api/internal/service/gateway_events.go, platform-api/internal/service/secret_service.go, platform-api/internal/server/server.go, platform-api/internal/service/secret_service_broadcast_test.go
Broadcasts update and deprecation events after successful operations and tests best-effort delivery.
Gateway event consumption
gateway/gateway-controller/pkg/controlplane/client.go, gateway/gateway-controller/pkg/controlplane/sync_secrets_test.go
Preserves large revisions, dispatches lifecycle events, applies updates, and removes deprecated secrets while rejecting stale revisions.

Deployment authentication

Layer / File(s) Summary
Upstream authentication serialization
platform-api/internal/dto/api.go, platform-api/internal/utils/api.go, platform-api/internal/utils/api_test.go
Preserves optional upstream authentication, including secret placeholders, in deployment YAML.

Secret management portal

Layer / File(s) Summary
Secret management portal
portals/ai-workspace/src/App.tsx, portals/ai-workspace/src/apis/secretApis.ts, portals/ai-workspace/src/hooks/useIsMounted.ts, portals/ai-workspace/src/pages/appShell/appShellPages/secret/*, portals/ai-workspace/src/pages/appShell/appShellPages/settings/Main.tsx
Adds permission-gated routes and pages for listing, creating, viewing, rotating, and soft-deleting secrets.

Integration coverage

Layer / File(s) Summary
Secret lifecycle end-to-end coverage
tests/integration-e2e/README.md, tests/integration-e2e/features/secret_lifecycle.feature, tests/integration-e2e/secret_helpers_test.go, tests/integration-e2e/secret_lifecycle_steps_test.go, tests/integration-e2e/steps_test.go, portals/ai-workspace/cypress/e2e/001-providers/*
Adds live rotation and deprecation scenarios, bounded response helpers, polling steps, lifecycle documentation, and compact secret handles in Cypress tests.

Persistence compatibility

Layer / File(s) Summary
SQL Server secret deletion query
platform-api/internal/repository/secret.go
Uses SELECT TOP (1) for SQL Server row-lock queries while preserving the PostgreSQL and generic query paths.

Estimated code review effort: 5 (Critical) | ~120 minutes

Suggested reviewers: lasanthas, krishanx92, renuka-fernando

Sequence Diagram(s)

sequenceDiagram
  participant Portal
  participant PlatformAPI
  participant GatewayEventsService
  participant GatewayController
  participant SecretStore
  Portal->>PlatformAPI: Rotate or delete secret
  PlatformAPI->>GatewayEventsService: Broadcast lifecycle event
  GatewayEventsService->>GatewayController: Publish WebSocket event
  GatewayController->>PlatformAPI: Fetch rotated value
  GatewayController->>SecretStore: Upsert or delete local secret
  Portal->>PlatformAPI: Read secret state
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary user-facing change: adding secret management to the UI.
Description check ✅ Passed The description covers purpose, goals, approach, UI evidence, user stories, documentation, tests, related PRs, and test environment, but omits security checks and samples details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@platform-api/internal/model/secret.go`:
- Around line 72-90: Add a revision or generation field to SecretUpdatedEvent
and SecretDeprecatedEvent, then update gateway lifecycle handling to ignore
events older than the locally recorded revision while preserving existing
idempotency and delivery coverage. Ensure deletion followed by reactivation
cannot be undone by a stale event, and add a test covering that sequence.

In `@portals/ai-workspace/src/App.tsx`:
- Around line 591-622: Update portals/ai-workspace/src/App.tsx lines 591-622 to
guard the entire secrets route branch, including nested routes, with
SCOPES.SECRET_READ and replace the hard-coded settings index redirect with a
scope-aware destination. In
portals/ai-workspace/src/pages/appShell/appShellPages/settings/Main.tsx lines
79-84, authorize the matched settings route using its requiredScope rather than
visibleNavItems, preserving access only for users with the route’s required
scope.

In
`@portals/ai-workspace/src/pages/appShell/appShellPages/secret/SecretOverview.tsx`:
- Around line 59-76: Bind secret fetch results to the active organization and
handle across SecretOverview.tsx lines 59-76, RotateSecret.tsx lines 68-89, and
SecretsList.tsx lines 77-94. Update the request flows using request IDs or
cancellation, and reject responses that are stale after the organization or
handle changes; ensure SecretOverview cannot replace the current secret
metadata, RotateSecret cannot submit stale metadata, and SecretsList cannot
replace the current organization’s list.

In
`@portals/ai-workspace/src/pages/appShell/appShellPages/secret/SecretsList.tsx`:
- Around line 252-257: Update the row keyboard handler in SecretsList so
keyboard events originating from child controls such as the delete IconButton
are ignored, while Enter and Space pressed directly on the row still prevent
default behavior and navigate to the secret. Use the event target/currentTarget
relationship to distinguish the row from its descendants.

In `@tests/integration-e2e/ingress_helpers_test.go`:
- Around line 68-78: Introduce one shared delay helper that validates a positive
interval and a non-zero interval/2 before adding bounded random jitter, then use
it before every polling fetch. Update
tests/integration-e2e/ingress_helpers_test.go:68-78 in waitIngressWithHeaders,
tests/integration-e2e/secret_helpers_test.go:213-240 before each secret-value
fetch, and tests/integration-e2e/secret_helpers_test.go:246-270 before each
deletion-status fetch; replace the fixed two-second sleeps while preserving the
existing polling behavior.

In `@tests/integration-e2e/README.md`:
- Around line 255-257: Update the “Deletion” scenario in the README to document
the explicit deleteSecret operation: state that DELETE /secrets/:handle triggers
the original secret’s deprecation event, rather than attributing deprecation to
cleanupRotatedSecret. Preserve the existing description of redeployment and
gateway cache eviction.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 600a8b72-f6f9-4d74-b6e9-34bdeb670754

📥 Commits

Reviewing files that changed from the base of the PR and between 4bca0ae and d00f44d.

📒 Files selected for processing (31)
  • gateway/gateway-controller/pkg/controlplane/client.go
  • gateway/gateway-controller/pkg/controlplane/events.go
  • gateway/gateway-controller/pkg/controlplane/sync_secrets_test.go
  • platform-api/internal/constants/constants.go
  • platform-api/internal/dto/api.go
  • platform-api/internal/model/secret.go
  • platform-api/internal/server/server.go
  • platform-api/internal/service/gateway_events.go
  • platform-api/internal/service/secret_service.go
  • platform-api/internal/service/secret_service_broadcast_test.go
  • platform-api/internal/service/secret_service_test.go
  • platform-api/internal/utils/api.go
  • platform-api/internal/utils/api_test.go
  • portals/ai-workspace/src/App.tsx
  • portals/ai-workspace/src/apis/secretApis.ts
  • portals/ai-workspace/src/clients/choreoApiClient.ts
  • portals/ai-workspace/src/hooks/useIsMounted.ts
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/CreateSecret.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/DeleteSecretDialog.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/RotateSecret.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/SecretOverview.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/SecretsList.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/settings/Main.tsx
  • tests/integration-e2e/README.md
  • tests/integration-e2e/features/secret_lifecycle.feature
  • tests/integration-e2e/features/secured-api-invocation.feature
  • tests/integration-e2e/ingress_helpers_test.go
  • tests/integration-e2e/secret_helpers_test.go
  • tests/integration-e2e/secret_lifecycle_steps_test.go
  • tests/integration-e2e/steps_secured_test.go
  • tests/integration-e2e/steps_test.go
💤 Files with no reviewable changes (2)
  • tests/integration-e2e/features/secured-api-invocation.feature
  • tests/integration-e2e/steps_secured_test.go

Comment thread platform-api/internal/model/secret.go
Comment thread portals/ai-workspace/src/App.tsx
Comment thread tests/integration-e2e/ingress_helpers_test.go Outdated
Comment thread tests/integration-e2e/README.md Outdated
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/integration-e2e/secret_helpers_test.go`:
- Around line 217-236: Add randomized positive pre-request jitter to both
polling loops around the visible HTTP fetches, using a non-zero half-interval
rather than a fixed two-second retry cadence. Apply the same jittered delay
before every request in the loops containing httpClient.Do, while preserving the
existing deadline and retry behavior.
- Line 162: Update the response-body reads in the relevant secret helper test
paths around the existing io.ReadAll calls to wrap resp.Body with io.LimitReader
before reading. Use the configured response-size limit when available, with a
safe default fallback, and apply the same bounded-reader pattern to all three
occurrences.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3402839c-59e4-48ab-9753-061df24b30f4

📥 Commits

Reviewing files that changed from the base of the PR and between 9f7d4bd and b6cbfc3.

📒 Files selected for processing (28)
  • gateway/gateway-controller/pkg/controlplane/client.go
  • gateway/gateway-controller/pkg/controlplane/events.go
  • gateway/gateway-controller/pkg/controlplane/sync_secrets_test.go
  • platform-api/internal/constants/constants.go
  • platform-api/internal/dto/api.go
  • platform-api/internal/model/secret.go
  • platform-api/internal/server/server.go
  • platform-api/internal/service/gateway_events.go
  • platform-api/internal/service/secret_service.go
  • platform-api/internal/service/secret_service_broadcast_test.go
  • platform-api/internal/service/secret_service_test.go
  • platform-api/internal/utils/api.go
  • platform-api/internal/utils/api_test.go
  • portals/ai-workspace/src/App.tsx
  • portals/ai-workspace/src/apis/secretApis.ts
  • portals/ai-workspace/src/clients/choreoApiClient.ts
  • portals/ai-workspace/src/hooks/useIsMounted.ts
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/CreateSecret.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/DeleteSecretDialog.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/RotateSecret.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/SecretOverview.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/SecretsList.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/settings/Main.tsx
  • tests/integration-e2e/README.md
  • tests/integration-e2e/features/secret_lifecycle.feature
  • tests/integration-e2e/secret_helpers_test.go
  • tests/integration-e2e/secret_lifecycle_steps_test.go
  • tests/integration-e2e/steps_test.go
🚧 Files skipped from review as they are similar to previous changes (21)
  • portals/ai-workspace/src/hooks/useIsMounted.ts
  • portals/ai-workspace/src/apis/secretApis.ts
  • platform-api/internal/model/secret.go
  • tests/integration-e2e/features/secret_lifecycle.feature
  • platform-api/internal/server/server.go
  • gateway/gateway-controller/pkg/controlplane/sync_secrets_test.go
  • platform-api/internal/service/secret_service_test.go
  • platform-api/internal/utils/api_test.go
  • platform-api/internal/dto/api.go
  • platform-api/internal/utils/api.go
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/CreateSecret.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/RotateSecret.tsx
  • gateway/gateway-controller/pkg/controlplane/events.go
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/SecretOverview.tsx
  • tests/integration-e2e/secret_lifecycle_steps_test.go
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/DeleteSecretDialog.tsx
  • platform-api/internal/service/secret_service_broadcast_test.go
  • platform-api/internal/service/secret_service.go
  • portals/ai-workspace/src/App.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/SecretsList.tsx
  • gateway/gateway-controller/pkg/controlplane/client.go

Comment thread tests/integration-e2e/secret_helpers_test.go Outdated
Comment thread tests/integration-e2e/secret_helpers_test.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@gateway/gateway-controller/pkg/controlplane/client.go`:
- Around line 3810-3827: Update handleMessage and the revision-bearing event
decode path to preserve revision values as full int64 numbers instead of default
float64 values before isStaleSecretEvent compares them. Ensure equal revisions
remain idempotent while adjacent epoch-nanosecond revisions remain
distinguishable, and add a regression test covering adjacent revision values and
reordered events.

In `@platform-api/internal/model/secret.go`:
- Around line 79-85: Replace the time-based revision described in the Secret
lifecycle event flow with a database-backed per-secret version. Add an atomic
data_version/revision increment to both SecretService.Update and
SecretService.Delete, ensure the version is read or returned only after the
corresponding row write commits, and use that committed value in emitted events
so concurrent update and soft-delete operations preserve commit order.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 28faceb6-1ae3-4e64-b38c-13f7f0827ddd

📥 Commits

Reviewing files that changed from the base of the PR and between b6cbfc3 and cf89180.

📒 Files selected for processing (13)
  • gateway/gateway-controller/pkg/controlplane/client.go
  • gateway/gateway-controller/pkg/controlplane/events.go
  • gateway/gateway-controller/pkg/controlplane/sync_secrets_test.go
  • platform-api/internal/model/secret.go
  • platform-api/internal/service/secret_service.go
  • portals/ai-workspace/cypress/e2e/001-providers/002-provider-secret-management.cy.js
  • portals/ai-workspace/cypress/e2e/001-providers/003-llm-proxy-secret-management.cy.js
  • portals/ai-workspace/src/App.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/RotateSecret.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/SecretOverview.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/SecretsList.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/settings/Main.tsx
  • tests/integration-e2e/secret_helpers_test.go
🚧 Files skipped from review as they are similar to previous changes (5)
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/RotateSecret.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/SecretOverview.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/secret/SecretsList.tsx
  • gateway/gateway-controller/pkg/controlplane/events.go
  • platform-api/internal/service/secret_service.go

Comment thread gateway/gateway-controller/pkg/controlplane/client.go
Comment thread platform-api/internal/model/secret.go
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 5, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@platform-api/internal/repository/secret.go`:
- Around line 247-251: Update the SQL Server branch in FindRefsAndSoftDelete so
the secret lookup acquires the same blocking lock semantics as the PostgreSQL
path instead of only switching to SELECT TOP (1). Apply a SQL Server row-locking
equivalent on the secrets read, and make sure the later refsQuery and UPDATE
still run under that contract so concurrent artifact_secret_refs writes cannot
slip past the empty-reference check. If needed, align the reference write path
with the same locking behavior, and add a SQL Server concurrency test that
exercises secret deprecation against concurrent reference insertion or update.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f8c2da6-333e-4a66-9f64-b4f231e49064

📥 Commits

Reviewing files that changed from the base of the PR and between cf89180 and f2bfd50.

📒 Files selected for processing (2)
  • gateway/gateway-controller/pkg/controlplane/client.go
  • platform-api/internal/repository/secret.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • gateway/gateway-controller/pkg/controlplane/client.go

Comment thread platform-api/internal/repository/secret.go Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants