Skip to content

Remove labels.nais.io prefix handling from labels flow#487

Merged
thokra-nav merged 6 commits into
mainfrom
flip_labels
Jun 12, 2026
Merged

Remove labels.nais.io prefix handling from labels flow#487
thokra-nav merged 6 commits into
mainfrom
flip_labels

Conversation

@thokra-nav

Copy link
Copy Markdown
Contributor

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

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.
Copilot AI review requested due to automatic review settings June 12, 2026 09:58

Copilot AI 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.

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.io prefix 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;

Comment thread src/lib/domain/workload/WorkloadListFilters.svelte Outdated
Comment thread src/lib/domain/labels/LabelFacets.svelte Outdated
Comment thread src/lib/domain/labels/labels.test.ts
Comment thread src/lib/domain/labels/labels.test.ts Outdated
Copilot AI review requested due to automatic review settings June 12, 2026 10:12

Copilot AI 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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Comment thread src/lib/domain/labels/labels.ts
Comment thread src/lib/domain/labels/labels.test.ts
Comment thread src/lib/domain/workload/WorkloadListFilters.svelte Outdated
Copilot AI review requested due to automatic review settings June 12, 2026 10:54

Copilot AI 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.

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

  • labelKeyError no longer deals with a “suffix” now that prefix handling has been removed; the parameter name is misleading in editor/tooling hints. Rename it to key (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';
	}

Comment thread src/lib/domain/labels/labels.ts
@thokra-nav thokra-nav merged commit 066b079 into main Jun 12, 2026
5 checks passed
@thokra-nav thokra-nav deleted the flip_labels branch June 12, 2026 11:20
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