Skip to content

fix(cli): handle empty-value tag edits in interactive tag prompt#539

Merged
Phil-Browne merged 1 commit into
mainfrom
esd-1648-tag-editing
Jul 13, 2026
Merged

fix(cli): handle empty-value tag edits in interactive tag prompt#539
Phil-Browne merged 1 commit into
mainfrom
esd-1648-tag-editing

Conversation

@Phil-Browne

Copy link
Copy Markdown
Contributor

Extracted from #535 (ESD-1648) as a standalone fix, orthogonal to the validator-parity work in that PR.

The interactive tag editor keyed removal on value == "" && tags[key] != "", which had two bugs:

  • It refused to remove a tag whose current value was already empty.
  • Entering an empty value for a key that did not exist silently dropped the key with no feedback.

Now key existence is checked explicitly: an empty value removes the tag if present, otherwise reports "nothing to remove". Fixed in both the native (prompts.go) and WASM (prompts_wasm.go) paths, which had drifted out of sync.

The interactive tag editor keyed removal on `value == "" && tags[key] != ""`,
so it refused to remove a tag whose current value was already empty and
stayed silent when a newly entered key didn't exist (the key just vanished).

Check key existence explicitly: an empty value removes the tag if present,
otherwise reports "nothing to remove". Applied to both the native and WASM
prompt paths, which had drifted out of sync.
Copilot AI review requested due to automatic review settings July 11, 2026 15:20
@Phil-Browne Phil-Browne requested review from a team and penzeliz-megaport as code owners July 11, 2026 15:20
@Phil-Browne Phil-Browne requested a review from megasergeyd July 11, 2026 15:20
Phil-Browne added a commit that referenced this pull request Jul 11, 2026
The GetIntFromInterface int-width bound fix and the interactive
tag-editing empty-value fix are orthogonal to the prompt/validator
parity work here, so they were pulled into their own PRs:

- GetIntFromInterface overflow bound -> #538
- interactive tag-edit empty-value handling -> #539

Restores those six files to the main baseline; this PR now stays
focused on partner-config and prefix-filter validation parity.
@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.58%. Comparing base (9ba6a3b) to head (842e4de).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #539      +/-   ##
==========================================
+ Coverage   78.57%   78.58%   +0.01%     
==========================================
  Files         192      192              
  Lines       18522    18525       +3     
==========================================
+ Hits        14553    14558       +5     
+ Misses       2904     2902       -2     
  Partials     1065     1065              
Files with missing lines Coverage Δ
internal/utils/prompts.go 77.49% <100.00%> (+0.25%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Fixes edge cases in the interactive tag editor so that entering an empty value removes an existing tag regardless of its current value (including already-empty values), and produces deterministic feedback when attempting to remove a non-existent key. The change is applied consistently across both native and WASM prompt implementations to prevent behavior drift.

Changes:

  • Update tag-edit removal logic to check key existence explicitly (instead of tags[key] != "").
  • Add regression tests for the native prompt behavior (empty-existing-value removal and no-op removal attempt).
  • Add a WASM regression test for the “remove non-existent key” no-op case.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
internal/utils/prompts.go Fix native interactive tag-removal semantics by checking key existence.
internal/utils/prompts_wasm.go Mirror the native fix in the WASM prompt path to eliminate drift.
internal/utils/prompts_wasm_test.go Add a regression test for the WASM “empty value for missing key” no-op behavior.
internal/utils/prompts_test.go Add native regression tests for removing empty-valued tags and handling empty values for new keys.

Comment thread internal/utils/prompts_wasm_test.go

@penzeliz-megaport penzeliz-megaport left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed for correctness; no findings. LGTM.

@Phil-Browne Phil-Browne merged commit 99644b5 into main Jul 13, 2026
11 checks passed
@Phil-Browne Phil-Browne deleted the esd-1648-tag-editing branch July 13, 2026 13:52
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.

3 participants