Remove labels.nais.io prefix handling from labels flow#487
Merged
Conversation
Accept slash in label keys and stop auto-adding or stripping a labels.nais.io prefix in label conversion helpers. Update label UI copy and headings to remove prefix references, and drop the key-field prefix decoration in the editor rows. Adjust tests to match raw key behavior and new key validation rules.
Contributor
There was a problem hiding this comment.
Pull request overview
Removes labels.nais.io prefix-specific behavior from the labels UX and label conversion helpers, and updates validation to allow / in label keys (supporting fully-qualified prefix/name keys).
Changes:
- Updates labels-related UI headings/copy to remove
labels.nais.ioprefix references. - Removes automatic prefix add/strip behavior from label conversion helpers and updates tests accordingly.
- Relaxes label key character validation to allow
/.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/domain/workload/WorkloadListFilters.svelte | Updates labels filter section heading to remove prefix reference. |
| src/lib/domain/labels/LabelsEditorModal.svelte | Simplifies modal copy to no longer mention automatic prefix handling; removes now-unused <code> styling. |
| src/lib/domain/labels/labels.ts | Removes prefix helpers; updates key/value conversion; relaxes charset to permit /. |
| src/lib/domain/labels/labels.test.ts | Drops prefix-helper tests and updates expectations for raw keys and slash acceptance. |
| src/lib/domain/labels/LabelRows.svelte | Removes prefix decoration/padding from label key input rows. |
| src/lib/domain/labels/LabelFacets.svelte | Updates labels facet heading to remove prefix reference. |
Comments suppressed due to low confidence (1)
src/lib/domain/labels/labels.ts:7
- The new CHARSET allows '/', and since labelValueError uses the same CHARSET this change also permits slashes in label values (likely invalid for Kubernetes-style labels). It also makes key validation reuse the value-oriented error message. Consider keeping the value charset unchanged and introducing a key-specific charset/message that allows '/'.
const CHARSET = /^[a-zA-Z0-9._/-]+$/;
const CHARSET_MESSAGE = 'Must consist of letters, numbers, hyphens, underscores, or dots';
export interface Label {
key: string;
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/lib/domain/labels/labels.ts:22
labelKeyErrorno longer deals with a “suffix” now that prefix handling has been removed; the parameter name is misleading in editor/tooling hints. Rename it tokey(and adjust the local variable) to reflect the current behavior.
export function labelKeyError(suffix: string): string {
const key = suffix.trim();
if (key.length === 0) {
return 'Key is required';
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Accept slash in label keys and stop auto-adding or stripping a labels.nais.io prefix in label conversion helpers.
Update label UI copy and headings to remove prefix references, and drop the key-field prefix decoration in the editor rows.
Adjust tests to match raw key behavior and new key validation rules.
Requires nais/api#463