Skip to content

Closed #119 - #123

Closed
bernalalexis-try wants to merge 1 commit into
KubeOrch:mainfrom
bernalalexis-try:main
Closed

bernalalexis-try wants to merge 1 commit into
KubeOrch:mainfrom
bernalalexis-try:main

Conversation

@bernalalexis-try

Copy link
Copy Markdown

Channel types now carry an explicit secret flag, and the service returns a redacted DTO exposing configuredSecrets rather than values, with a safety net that strips secrets should Core ever return them.

Form logic moves into channel-form.ts, and a new accessible SecretInput renders empty with a "Configured" state plus Replace and Remove actions.

Metadata-only edits no longer send secret keys.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

Notification channel editing now uses write-only secret state, redacted channel responses, centralized form utilities, and explicit update payloads. The page supports secret replacement or removal and custom headers. The store applies returned redacted channels directly to local state.

Changes

Notification secret handling

Layer / File(s) Summary
Secret contracts and response redaction
lib/types/notification.ts, lib/services/notifications.ts, lib/services/__tests__/notifications.test.ts
Channel metadata marks secret fields and custom-header support. Service requests separate secrets from configuration. Service responses remove secret values and expose configured secret names and header names.
Form state and payload construction
lib/notifications/channel-form.ts, lib/notifications/__tests__/channel-form.test.ts
Form helpers reconstruct non-secret values and configured indicators, validate names and headers, and build create or update payloads with replacements and removals.
Secret input state machine
components/notification/SecretInput.tsx, components/notification/__tests__/SecretInput.test.tsx
SecretInput hides stored values and supports replace, cancel, remove, and undo actions with accessible status text.
Notification page integration
app/dashboard/integrations/notifications/page.tsx
The page uses unified ChannelFormState, centralized builders, redacted subtitles, SecretInput, and ID-based custom-header rows.
Store update synchronization
stores/NotificationChannelStore.ts, stores/__tests__/NotificationChannelStore.test.ts
Store updates accept UpdateChannelRequest, apply the returned channel to local state, and test update, fetch, create, delete, and error paths.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant NotificationPage
  participant NotificationChannelStore
  participant NotificationService
  participant API
  NotificationPage->>NotificationChannelStore: Submit update payload
  NotificationChannelStore->>NotificationService: updateChannel(id, data)
  NotificationService->>API: PUT /notifications/channels
  API-->>NotificationService: Updated channel
  NotificationService-->>NotificationChannelStore: Redacted channel
  NotificationChannelStore-->>NotificationPage: Update local channel
Loading

Merge Risk: 🔵 Low · up to 8d378

A response missing configured-secret metadata can prevent metadata-only edits to existing channels, and assistive-technology users are not told when a secret is required. These are bounded issues that should be addressed before relying on the affected flows.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title indicates that issue #119 was closed, but it does not describe the secret-handling and notification-form changes in this pull request. Replace the title with a concise summary of the main change, such as "Redact notification secrets and refactor channel forms".
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description directly explains the secret redaction, SecretInput behavior, form refactor, and metadata-only update behavior covered by the changeset.
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.
  • Fix all pre-merge checks with AI
✨ 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

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: caf70d9c-88e7-4597-bef7-cf66440ffa86

📥 Commits

Reviewing files that changed from the base of the PR and between 0208a32 and 8d378b0.

📒 Files selected for processing (10)
  • app/dashboard/integrations/notifications/page.tsx
  • components/notification/SecretInput.tsx
  • components/notification/__tests__/SecretInput.test.tsx
  • lib/notifications/__tests__/channel-form.test.ts
  • lib/notifications/channel-form.ts
  • lib/services/__tests__/notifications.test.ts
  • lib/services/notifications.ts
  • lib/types/notification.ts
  • stores/NotificationChannelStore.ts
  • stores/__tests__/NotificationChannelStore.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment on lines +150 to +159
<Input
id={id}
type="password"
value={state.value}
onChange={e => onChange({ ...state, value: e.target.value })}
placeholder={placeholder}
aria-describedby={describedBy}
autoComplete="new-password"
ref={inputRef}
/>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Expose the required state to assistive technology.

When required is true, the component shows only an aria-hidden asterisk. Add the native required attribute so screen readers report the constraint.

Proposed fix
         <Input
           id={id}
           type="password"
+          required={required}
           value={state.value}

Based on learnings, required fields should set aria-required="true" or use the native required attribute.

📝 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.

Suggested change
<Input
id={id}
type="password"
value={state.value}
onChange={e => onChange({ ...state, value: e.target.value })}
placeholder={placeholder}
aria-describedby={describedBy}
autoComplete="new-password"
ref={inputRef}
/>
<Input
id={id}
type="password"
required={required}
value={state.value}
onChange={e => onChange({ ...state, value: e.target.value })}
placeholder={placeholder}
aria-describedby={describedBy}
autoComplete="new-password"
ref={inputRef}
/>

Source: Learnings

return {
...channel,
config,
configuredSecrets: channel.configuredSecrets ?? [],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,145p' lib/services/notifications.ts
sed -n '67,180p' lib/notifications/channel-form.ts
rg -n 'configuredSecrets|webhook_url|bot_token|routing_key|notifications/channels' . --glob '!node_modules' --glob '!coverage'

Repository: KubeOrch/ui

Length of output: 13065


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- candidate files ---'
git ls-files | rg -i '(^|/)(notification|channel|core|api|openapi|schema|contract|integration)|README|docs' | head -200
printf '%s\n' '--- response and endpoint references ---'
rg -n -i 'configuredSecrets|notifications/channels|NotificationChannel|notification channel|rawConfig|secret.*config|config.*secret' . --glob '!node_modules' --glob '!coverage' --glob '!dist' --glob '!build' | head -300

Repository: KubeOrch/ui

Length of output: 17528


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- notification type helpers ---'
sed -n '1,215p' lib/types/notification.ts
printf '%s\n' '--- form update path ---'
sed -n '180,285p' lib/notifications/channel-form.ts

Repository: KubeOrch/ui

Length of output: 8155


Preserve configured status when configuredSecrets is absent.

If a channel response contains secret keys in config but omits configuredSecrets, redactChannel removes those values and replaces the status with []. buildEditFormState then marks required secrets as unconfigured, so validateChannelForm rejects metadata-only updates. Derive configured keys from the raw config, including headers.<name> entries, before redaction and merge them with channel.configuredSecrets.

@mohit-nagaraj

mohit-nagaraj commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Hey @bernalalexis-try Thanks for your contributions - could you please sign your commits? else its looks good to me

@bernalalexis-try bernalalexis-try closed this by deleting the head repository Sep 24, 2026
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