Skip to content

fix(conf): resolve globals:default and improve settings menu UX#214

Merged
RedStar071 merged 3 commits into
mainfrom
claude/wonderful-planck-t2gxoa
Jun 23, 2026
Merged

fix(conf): resolve globals:default and improve settings menu UX#214
RedStar071 merged 3 commits into
mainfrom
claude/wonderful-planck-t2gxoa

Conversation

@RedStar071

Copy link
Copy Markdown
Member
  • Add missing settingNotSet key to en-US conf.json so unset values show
    "Not Set" instead of the literal globals:default i18next fallback
  • Render channel/role/category values as clickable mentions in "Current Value"
  • Replace leftover text-command labels/prompts with component-appropriate ones
    (clean "Undo" button, select placeholders, input prompt)
  • Drop redundant folder/key text list when the navigation select already lists
    every entry (kept only as a >25 fallback)
  • Show "Reset" only when the value actually differs from its default
    (content-aware comparison for arrays)
  • Add a visual separator before action buttons and remove a debug console.log

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01HJg2wjArdSnPYww9SJjNhm

- Add missing `settingNotSet` key to en-US conf.json so unset values show
  "Not Set" instead of the literal `globals:default` i18next fallback
- Render channel/role/category values as clickable mentions in "Current Value"
- Replace leftover text-command labels/prompts with component-appropriate ones
  (clean "Undo" button, select placeholders, input prompt)
- Drop redundant folder/key text list when the navigation select already lists
  every entry (kept only as a >25 fallback)
- Show "Reset" only when the value actually differs from its default
  (content-aware comparison for arrays)
- Add a visual separator before action buttons and remove a debug console.log

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HJg2wjArdSnPYww9SJjNhm
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@RedStar071, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 51 minutes and 50 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 4501e47c-cd22-423f-8569-1e8b5f7c270e

📥 Commits

Reviewing files that changed from the base of the PR and between 11e77e7 and 24bacd1.

📒 Files selected for processing (1)
  • src/lib/structures/SettingsMenu.ts
📝 Walkthrough

Walkthrough

This PR refactors the SettingsMenu to use a new custom ID serialisation system based on Brotli-compressed metadata. It introduces schema path resolution utilities, adds action-based routing with serialised state payloads, rewrites value rendering to support clickable mentions via mention factories, and updates group descriptions with dynamic sizing logic. New i18n strings cover menu interactions and custom ID errors.

Changes

SettingsMenu custom ID serialisation and refactoring

Layer / File(s) Summary
Custom ID metadata compression and decompression
package.json, src/lib/util/customIdMetadata.ts
Adds binarytf as a runtime dependency. Introduces compressCustomIdMetadata which serialises arbitrary data with binarytf, compresses via Brotli, encodes as a binary string, and enforces an 80-character limit with a user-facing error including custom message context. Implements decompressCustomIdMetadata which reverses the process, emitting errors to the Discord client and throwing a user-facing error on deserialisation failure.
SettingsMenu action/update type enums and prefix mappings
src/lib/types/SettingsMenuCustomId.ts, src/lib/types/index.ts
Defines SettingsMenuAction enum covering select, back, stop, set, remove, reset, undo, cancel, and eight input-mode actions. Adds SettingsMenuUpdateType enum for set, remove, reset, and replace operations. Introduces SettingsMenuCustomIdData interface with required fields (user, action, path) and optional fields (inputMode, inputType, selectedCategory). Exports SettingsMenuPrefixes record mapping each action to a prefix string and prefixToSettingsMenuAction map for inverse lookup.
Custom ID construction and parsing
src/lib/util/settingsMenuCustomId.ts
Implements buildSettingsMenuCustomId which combines an action prefix with Brotli-compressed metadata that embeds the action value. Implements parseSettingsMenuCustomId which validates the |-separated format, maps the prefix back to an action, decompresses the metadata, verifies the embedded action matches the resolved action, and returns null on structural or deserialisation failures.
Schema path resolution helpers
src/lib/database/settings/Utils.ts
Adds getSchemaPath which builds a dot-separated path string by traversing SchemaGroup/SchemaKey parent relationships until reaching a root sentinel, excluding the root key itself. Implements resolveSchemaPath which returns all configurable groups for empty input or resolves a specific path via getConfigurableGroups().getPathString() with fallback to the root group.
New i18n strings and error/global key constants
src/languages/en-US/commands/conf.json, src/languages/en-US/globals.json, src/languages/en-US/errors.json, src/lib/i18n/languageKeys/keys/Globals.ts, src/lib/i18n/languageKeys/keys/commands/Conf.ts, src/lib/i18n/languageKeys/keys/Errors.ts
Adds menuInputPrompt, menuSelectPlaceholder, and settingNotSet strings to the conf menu block; adds undo to globals; adds queryCausedTooLongCustomId and settingsMenuCustomIdDeserializeFailed error messages. Simplifies menuRenderCvalue formatting. Exports corresponding TypeScript key constants: MenuInputPrompt and MenuSelectPlaceholder from Conf.ts, Undo from Globals.ts, and parameterised error keys from Errors.ts.
SettingsMenu action-based routing and state helpers
src/lib/structures/SettingsMenu.ts
Updates imports to include writeSettingsTransaction, mention helpers, and isNullish. Removes old CustomIds/UpdateType constants in favour of SettingsMenuAction/SettingsMenuUpdateType. Adds differsFromDefault helper which compares current values against schema defaults, including element-wise array comparison and special handling where both current and default are nullish. Introduces getCustomIdContext and buildCustomId to embed the schema path, input-mode state, and selected category in generated custom IDs.
SettingsMenu UI rendering with mention factories and group logic
src/lib/structures/SettingsMenu.ts
Rewrites renderKey to delegate to displayValue, which formats channel/role/category values (including arrays) as clickable mentions via a centralised getMentionFactory and formats other values as inline code via entry.display(), with a "Not Set" fallback. Refactors group descriptions to vary by entry count: empty groups show MenuRenderNokeys, groups over 25 show the select prompt plus an emoji-prefixed textual list, and smaller groups show only the select prompt. Replaces all select-menu placeholders with MenuSelectPlaceholder, switches the input-mode prompt to MenuInputPrompt with the key path, moves the undo button label to Globals.Undo, updates reset-button visibility to use differsFromDefault, and inserts a separator before action buttons.
SettingsMenu interaction dispatch and state updates
src/lib/structures/SettingsMenu.ts
Refactors onInteraction to switch on SettingsMenuAction values, validating interaction types (select menu/button/modal) before calling processUpdate or showInputModal. Updates showInputModal to use buildCustomId for deterministic modal custom IDs and titles based on SettingsMenuUpdateType. Changes the modal submit filter to use parseSettingsMenuCustomId for validation. Updates processUpdate to route via tryUpdate(type, args) then exit input-mode and re-render. Refactors tryUpdate to operate on SettingsMenuUpdateType, perform all writes through writeSettingsTransaction, store oldValue from transactional settings, and apply set/remove/reset actions before audit submission. Updates tryUndo to use tryUpdate(SettingsMenuUpdateType.Replace) with the stored oldValue. Removes console logging from fetchCommands and returns the sorted filtered collection directly.

Sequence Diagram

sequenceDiagram
  participant User
  participant SettingsMenu
  participant CustomIdBuilder as CustomID<br/>Builder
  participant CustomIdParser as CustomID<br/>Parser
  participant Transaction as Settings<br/>Transaction
  User->>SettingsMenu: Click button or select value
  SettingsMenu->>CustomIdParser: parseSettingsMenuCustomId(customId)
  CustomIdParser->>CustomIdParser: Decompress metadata
  CustomIdParser->>SettingsMenu: {action, data}
  SettingsMenu->>SettingsMenu: Switch on SettingsMenuAction
  SettingsMenu->>SettingsMenu: Route to input or update
  alt Input mode (category/command/value)
    SettingsMenu->>SettingsMenu: Update state (selectedCategory/inputMode/inputType)
    SettingsMenu->>CustomIdBuilder: buildCustomId(InputModal)
    CustomIdBuilder->>SettingsMenu: Serialised customId
    SettingsMenu->>User: Show input modal with state
  else Direct update (Set/Remove/Reset)
    SettingsMenu->>Transaction: tryUpdate(updateType, value)
    Transaction->>Transaction: Serialise value
    Transaction->>User: Confirm and re-render menu
  end
Loading

Suggested reviewers

  • lorypelli
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the main changes: addressing the globals:default i18next fallback issue and improving the settings menu user experience with better value rendering and UI refinements.
Description check ✅ Passed The description directly relates to the changeset, providing specific details about the internationalization fix, UI improvements to component labels, value rendering as mentions, conditional reset button display, and visual enhancements.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/wonderful-planck-t2gxoa

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.39%. Comparing base (94af8b5) to head (24bacd1).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/lib/util/customIdMetadata.ts 53.84% 5 Missing and 1 partial ⚠️
src/lib/util/settingsMenuCustomId.ts 85.71% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #214      +/-   ##
==========================================
- Coverage   78.44%   78.39%   -0.05%     
==========================================
  Files          81       83       +2     
  Lines        2176     2208      +32     
  Branches      214      248      +34     
==========================================
+ Hits         1707     1731      +24     
- Misses        443      449       +6     
- Partials       26       28       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

@RedStar071 RedStar071 merged commit 9aaf507 into main Jun 23, 2026
6 of 8 checks passed
@RedStar071 RedStar071 deleted the claude/wonderful-planck-t2gxoa branch June 23, 2026 12:11
@github-project-automation github-project-automation Bot moved this from Todo to Done in Wolfstar Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants