Skip to content

fix: show secret type changes in the deploy preview - #1042

Open
nimish-ks wants to merge 1 commit into
mainfrom
fix/deploy-preview-secret-type
Open

nimish-ks wants to merge 1 commit into
mainfrom
fix/deploy-preview-secret-type

Conversation

@nimish-ks

Copy link
Copy Markdown
Member

🔍 Overview

Changing only a secret's type in an environment's secrets view (for example Secret → Config, or → Sealed) enables Deploy, but the banner reads "0 undeployed changes. Click to preview" and the preview is empty. getChanges() in DeployPreview.tsx compared key, value, comment and tags, but never the type, so changeCount() returned 0. The page's unsavedChanges check and the deploy mutation already include the type.

💡 Proposed Changes

  • getChanges() now compares the secret's type and counts a type change like any other field edit.
  • The preview shows a TYPE: line with the old type struck through and the new type, placed after KEY:, in the same order as the secret history view. The change is stored as secretType, because SecretChange.type already holds the kind of change (Added or Modified).
  • The type labels come from SECRET_TYPES in TypeSelector.tsx, which is now exported, so the preview uses the same words as the selector.
  • Value changes, including on Sealed secrets, are handled as before.

🖼️ Screenshots or Demo

A type-only edit now shows "1 undeployed change. Click to preview", and the preview lists Updated API_URL with TYPE: ~~Secret~~ Config.

📝 Release Notes

  • Fixed the deploy banner and preview ignoring secret type changes. A type-only edit now counts as an undeployed change and the preview shows the old and new type.

🧪 Testing

  • New tests/components/environments/secrets/DeployPreview.test.tsx covers a type-only edit, a type change combined with a value change, and a value change on a saved Sealed secret. The first two fail on main with "0 undeployed changes. Click to preview".
  • yarn test and yarn lint pass.

Changing only a secret's type enabled Deploy, but the banner read
"0 undeployed changes" and the preview listed nothing, because
getChanges() never compared the type. Type changes are now counted and
shown as a TYPE line with the old and new type.
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.

1 participant