feat: secret referencing ux and autocompletion#786
feat: secret referencing ux and autocompletion#786rohan-chaturvedi wants to merge 8 commits intomainfrom
Conversation
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
There was a problem hiding this comment.
Pull request overview
This PR implements comprehensive UX improvements for secret referencing, adding autocomplete, syntax highlighting, and validation for the ${...} reference syntax. The implementation addresses issue #267 by providing contextual suggestions when typing secret references, visual feedback through color-coded syntax highlighting, and save-time validation to catch broken references before deployment.
Changes:
- Adds inline autocomplete for secret references with progressive suggestions (local keys, cross-environment
${env.KEY}, cross-app${app::env.KEY}) - Implements syntax highlighting for secret reference tokens with color-coded segments
- Adds save-time validation for all references with a warning dialog for broken references
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
frontend/utils/secretReferences.ts |
Core utility module for parsing, validating, and generating suggestions for secret references |
frontend/hooks/useOrgSecretKeys.ts |
Fetches and caches decrypted secret keys across all org apps for cross-app autocomplete |
frontend/hooks/useSecretReferenceAutocomplete.ts |
State machine hook managing autocomplete lifecycle and keyboard interactions |
frontend/contexts/secretReferenceContext.tsx |
React context for sharing reference data without prop drilling |
frontend/components/secrets/ReferenceAutocompleteDropdown.tsx |
Presentational dropdown component with keyboard navigation and type icons |
frontend/components/secrets/SecretReferenceHighlight.tsx |
Renders color-coded syntax highlighting for reference tokens |
frontend/components/secrets/BrokenReferencesDialog.tsx |
Warning dialog for broken references with "Go back" / "Deploy anyway" options |
frontend/components/common/MaskedTextarea.tsx |
Converted to forwardRef, added highlight overlay support with synchronized scrolling |
frontend/components/environments/secrets/SecretRow.tsx |
Integrated autocomplete and syntax highlighting in single-environment editor |
frontend/app/[team]/apps/[app]/_components/AppSecretRow.tsx |
Integrated autocomplete and syntax highlighting in cross-environment editor |
frontend/app/[team]/apps/[app]/_components/AppSecrets.tsx |
Provides context, runs validation on save, renders broken references dialog |
frontend/app/[team]/apps/[app]/environments/[environment]/[[...path]]/page.tsx |
Provides context, runs validation on save, renders broken references dialog |
frontend/components/environments/folders/SecretFolderRow.tsx |
Changed folder icon color from emerald to amber for consistency with syntax highlighting |
frontend/app/[team]/apps/[app]/_components/EnvFolder.tsx |
Changed folder icon color from emerald to amber |
frontend/app/[team]/apps/[app]/_components/AppFolderRow.tsx |
Changed folder icon color from emerald to amber |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
|
@rohan-chaturvedi A lot of folks jump to docs to quickly checkout secret referencing syntax. I wonder if will be helpful to places a mini guide somewhere in the product itself. A markdown one pager. Alternatively we should show a hint when setting values to push the user to hit $ and get shown the secret referencing suggestions. So there is no need to view the guide, just construct the reference as you go. |
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
Summary
${in secret value inputs, with progressive suggestions for local keys, cross-environment references (${env.KEY}), and cross-app references (${app::env.KEY})${}) with color-coded segments for apps, environments, folders, and keys🖼️ Screenshots or Demo
Screencast.From.2026-02-26.16-04-58.mp4
Details
Secret values in Phase can reference other secrets using
${...}syntax, but until now users had to type these manually with no assistance or validation until the backend resolved them at read time. This made broken references hard to discover and debug.Autocomplete
Typing
${in a revealed secret value input opens a dropdown with contextual suggestions:${: local secret keys, environment names (with.suffix), app names (with::suffix), folder paths (with/suffix)${env.: keys available in that environment${app::: environments in that app${folder/: keys within that folderSuggestions filter as you type and support keyboard navigation (Arrow keys, Enter/Tab to accept, Escape to dismiss).
Ctrl+Enteropens the referenced secret in a new tab.Syntax highlighting
Revealed secret values containing
${...}references get color-coded highlighting:${/}delimitersSave-time validation
When saving secrets, all
${...}references are validated against the current app's known keys, environments, and org apps. If broken references are found, a warning dialog lists them and gives the user the choice to go back and fix them or save anyway.New files
frontend/utils/secretReferences.tsfrontend/contexts/secretReferenceContext.tsxfrontend/hooks/useOrgSecretKeys.tsfrontend/hooks/useSecretReferenceAutocomplete.tsfrontend/components/secrets/ReferenceAutocompleteDropdown.tsxfrontend/components/secrets/SecretReferenceHighlight.tsxfrontend/components/secrets/BrokenReferencesDialog.tsxModified files
MaskedTextarea.tsxforwardRef, addedonKeyDown/onSelect/onBlurprops, added highlight overlay support with synchronized scrollingAppSecretRow.tsxEnvSecretComponentAppSecrets.tsxSecretReferenceContext, runs reference validation on save, rendersBrokenReferencesDialogpage.tsx(environment page)AppSecrets.tsxfor the single-environment editorSecretRow.tsxTest plan
${in a revealed secret value — dropdown appears with local keys + env names + app namesstaging.) — dropdown updates to show keys in that environment${KEY_NAME}inserted with closing brace, cursor positioned after}Ctrl+Enteron a suggestion opens the referenced secret in a new browser tab${...}show syntax highlighting (color-coded segments)${{RAILWAY_VAR}}double-brace syntax does not trigger autocomplete or validation errorsAppSecrets) and single-environment editor (page.tsx/SecretRow)