C6 [CRIT]: unwind A13 over-fit on label create 422#3
Merged
Conversation
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.
Summary
A13 ("friendly 409 on pre-seeded labels") taught
label createto render a 422 aslabel "<name>" already exists; pass --force to overwrite. The audit caught the over-fit: every 422 — length, charset, color shape — is now reported as already-exists. Real validation failures are silently rewritten as uniqueness conflicts, pushing users toward--forcefor problems--forcecannot fix.C-audit reproducer (pre-fix):
Fix
pkg/cmd/label/create/create.go:isAlreadyExists:Server's actual uniqueness message (from
shithub/.docsand direct API probing) islabel name already taken on this repo; the substring check is robust to phrasing tweaks.Test plan
TestCreate409TreatedAsConflict— 409 maps to friendly error.TestCreateUniquenessConflictNoForce— 422 with "already taken" maps to friendly error.TestCreate422LengthErrorNotMisclassified— regression test for C6: 422 with "length 1-50" propagates the raw message; never mentions--force.TestCreateForceFallsBackToEdit—--forcePATCH path still works on uniqueness conflicts.make cigreen locally.