Skip to content

fix(staged): improve badge validation UX and show unique name conflicts - #630

Merged
matt2e merged 10 commits into
mainfrom
unique-name
Apr 15, 2026
Merged

fix(staged): improve badge validation UX and show unique name conflicts#630
matt2e merged 10 commits into
mainfrom
unique-name

Conversation

@matt2e

@matt2e matt2e commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Show which repo owns a short name on unique constraint conflict
  • Show toast when badge short name update fails
  • Show orphan repo badges in settings
  • Show badge errors inline instead of as toasts with per-keystroke validation
  • Move badge preview to the right of editor fields with improved positioning
  • Fix variable declaration ordering to resolve type check error

Test plan

  • Verify badge short name validation errors appear inline on each keystroke
  • Verify unique constraint conflicts show which repo owns the name
  • Verify orphan repo badges appear in settings panel
  • Verify badge preview renders correctly to the right of editor fields

🤖 Generated with Claude Code

matt2e and others added 10 commits April 15, 2026 11:16
…onflict

When updating a repo badge's short name, the raw SQLite unique constraint
error was unhelpful. Now we look up the conflicting badge first and return
a clear error message identifying which repo already uses that name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The saveBadge handler silently swallowed errors. Now it shows an error
toast with the backend message (e.g. which repo owns the conflicting
short name) and reverts the edit fields to their last saved values.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The repo settings sidebar only iterated over action_contexts, so badges
that existed in repo_badges without a matching action_context were
invisible. Merge both tables into a unified entry list so orphan badges
appear in the sidebar and can be edited or deleted.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the error toast on badge save failures with an inline error
message below the short name input. The input also gets a red border
to draw attention. The error clears on new input or repo switch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Swap the DOM order so the name/hue fields come first and the live badge
preview sits to their right, matching the expected visual layout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove flex: 1 from badge-editor-fields so the preview sits snugly to
the right of the fields instead of being pushed to the far edge. Use
flex-basis: 100% on badge-error so it breaks onto its own line below
the input.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Call saveBadge on every input event so the error appears/disappears as
the user types. Fix --danger → --ui-danger to match the actual CSS
variable, making the error text and input border red.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Restructure the badge editor so the controls (name, hue, preview) live
in one row and the error message sits on a separate row below. This
prevents the error from pushing the hue slider out of position.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Stop reverting badgeEditName/badgeEditHue to saved values on error. This
lets the user keep typing through a conflicting prefix (e.g. "ge" is
taken but "ges" would be valid). The $effect already resets fields when
switching repos.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@matt2e
matt2e requested review from baxen and wesbillman as code owners April 15, 2026 05:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2cd1537324

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 106 to +108
} catch (e) {
console.error('Failed to update badge:', e);
const msg = typeof e === 'string' ? e : e instanceof Error ? e.message : String(e);
badgeError = msg;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Ignore stale badge-save failures before setting UI error

saveBadge is now triggered on every oninput, so multiple async repoBadgeStore.update calls can overlap; when an older request rejects after a newer request succeeds (or after the user switches repos), this catch block still writes badgeError for the current selection. That produces incorrect inline errors that do not correspond to the currently edited repo/value. Capture the selected repo key (or a request generation counter) and only set badgeError if the response still matches the latest in-flight edit.

Useful? React with 👍 / 👎.

@matt2e
matt2e merged commit 5ccde56 into main Apr 15, 2026
5 checks passed
@matt2e
matt2e deleted the unique-name branch April 15, 2026 05:55
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.

1 participant