Skip to content

Round calculated colours to protect against floating point precision errors; options defaults consistency#103

Merged
argium merged 5 commits into
mainfrom
cleanup
Jun 11, 2026
Merged

Round calculated colours to protect against floating point precision errors; options defaults consistency#103
argium merged 5 commits into
mainfrom
cleanup

Conversation

@argium

@argium argium commented May 23, 2026

Copy link
Copy Markdown
Owner

Resolves LUA error when creating a new profile. #105
Resolves inconsistencies with profile defaults.
Moved IsDeathKnight into ClassUtil.
Removed unused ColorUtil.AreEqual

…errors.

Moved IsDeathKnight into ClassUtil.
Removed unused ColorUtil.AreEqual
Copilot AI review requested due to automatic review settings May 23, 2026 09:29
@github-actions

github-actions Bot commented May 23, 2026

Copy link
Copy Markdown

Test Results

910 tests  +17   910 ✅ +17   2s ⏱️ -1s
  5 suites ± 0     0 💤 ± 0 
  5 files   ± 0     0 ❌ ± 0 

Results for commit 3ef343d. ± Comparison against base commit d91a04b.

This pull request removes 236 and adds 253 tests. Note that renamed tests count towards both.
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:119 ‑ LibSettingsBuilder Builder uses the section category for an unnamed page in a multi-page section
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:152 ‑ LibSettingsBuilder Builder registers root-bound composite rows from an empty path
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:190 ‑ LibSettingsBuilder Builder falls back to a dropdown for fontOverride without a registered font row
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:233 ‑ LibSettingsBuilder Builder uses fontFallback as the default fontOverride dropdown value source
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:268 ‑ LibSettingsBuilder Builder keeps registered font rows for fontOverride when available
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:305 ‑ LibSettingsBuilder Builder rejects deprecated desc fields at registration time
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:329 ‑ LibSettingsBuilder Builder rejects removed condition fields at registration time
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:360 ‑ LibSettingsBuilder Builder keeps page handles limited to the v2 public surface
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:387 ‑ LibSettingsBuilder Builder returns an lsb instance with only the public API on its prototype
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:421 ‑ LibSettingsBuilder Builder returns plain page handles with methods directly on the table
…
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:127 ‑ LibSettingsBuilder Builder registers root and section pages through LSB.New
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:161 ‑ LibSettingsBuilder Builder binds a hideDefaults page into the lifecycle callbacks
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:188 ‑ LibSettingsBuilder Builder binds custom page defaults into lifecycle callbacks
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:241 ‑ LibSettingsBuilder Builder resets current page settings through a custom Defaults confirmation
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:276 ‑ LibSettingsBuilder Builder uses per-page defaultsConfirmText when provided
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:307 ‑ LibSettingsBuilder Builder runs custom page defaults instead of generic setting resets
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:341 ‑ LibSettingsBuilder Builder disables custom page defaults when the page predicate returns false
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:382 ‑ LibSettingsBuilder Builder returns nil for missing section-page lookups
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:405 ‑ LibSettingsBuilder Builder uses the section category for an unnamed page in a multi-page section
Libs/LibSettingsBuilder/Tests.Builder_spec_lua:438 ‑ LibSettingsBuilder Builder registers root-bound composite rows from an empty path
…

♻️ This comment has been updated with latest results.

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

Pull request overview

This PR refactors class detection and constant definitions while tightening color/float-related comparisons by removing an unused color equality helper and updating affected tests/call sites.

Changes:

  • Moved IsDeathKnight from ECM.lua into ClassUtil.lua and updated all consumers (UI + module + tests).
  • Removed unused ColorUtil.AreEqual and adjusted tests that previously validated or stubbed it.
  • Refactored Constants.lua to directly expose several constant tables (and split module load order from chain order), updating runtime enable logic to use MODULE_LOAD_ORDER.

Reviewed changes

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

Show a summary per file
File Description
UI/RuneBarOptions.lua Switches DK gating to ns.ClassUtil.IsDeathKnight() for RuneBar options visibility/disable logic.
UI/ResourceBarOptions.lua Updates ResourceBar options disable predicate to ns.ClassUtil.IsDeathKnight.
Tests/TestHelpers.lua Updates options test environment to provide ns.ClassUtil.IsDeathKnight (instead of ns.IsDeathKnight).
Tests/Modules/RuneBar_spec.lua Updates RuneBar tests to stub ClassUtil.IsDeathKnight.
Tests/FrameUtil_spec.lua Removes now-unneeded ns.ColorUtil.AreEqual stub from FrameUtil tests.
Tests/ColorUtil_spec.lua Removes AreEqual test and updates test harness setup (nit noted in review comment).
Tests/ClassUtil_spec.lua Adds unit tests for ClassUtil.IsDeathKnight.
Runtime.lua Switches module enable iteration to C.MODULE_LOAD_ORDER.
Modules/RuneBar.lua Updates DK checks to ns.ClassUtil.IsDeathKnight().
EnhancedCooldownManager.code-workspace Adjusts Lua diagnostics globals list.
ECM.lua Removes ns.IsDeathKnight implementation from root namespace.
Constants.lua Exposes constant tables directly on constants and introduces MODULE_LOAD_ORDER.
ColorUtil.lua Removes unused ColorUtil.AreEqual.
ClassUtil.lua Adds ClassUtil.IsDeathKnight and keeps class/resource utilities centralized.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Tests/ColorUtil_spec.lua Outdated
argium and others added 3 commits May 24, 2026 13:01
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…tBox).

Moves export and import profile buttons to the pageActions section.
@argium

argium commented Jun 11, 2026

Copy link
Copy Markdown
Owner Author

@codex

@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: c095da4899

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +384 to +386
local function getDefaultsConfirmation(builder)
local confirmation = builder._config.defaultsConfirmation
assert(type(confirmation) == "table", "LibSettingsBuilder: defaultsConfirmation is required when page defaults are enabled")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the prior defaultsConfirmation contract

Existing LibSettingsBuilder consumers can pass the previously supported defaultsConfirmation(pageName, onAccept) callback, but any page with onDefault or collected default settings now reaches this assertion and aborts registration because only a table is accepted. Since the library remains LibSettingsBuilder-1.0, support the callback form or introduce this as a versioned breaking API change.

Useful? React with 👍 / 👎.

Comment thread Libs/LibSettingsBuilder/Registry/CoreState.lua
@argium argium changed the title Round calculated colours to protect against floating point precision errors. Round calculated colours to protect against floating point precision errors; options defaults consistency Jun 11, 2026
@argium argium merged commit cc68411 into main Jun 11, 2026
2 checks passed
@argium argium deleted the cleanup branch June 11, 2026 12:19
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