Skip to content

fix(commands): accept hexadecimal colors across release lines #69

Description

@zoeyrose

Problem

The shared maps/python/Common.py::obj_assign_attribs() helper performs generic numeric coercion with int(value), which accepts decimal input only. The same helper is present on both maintained content lines:

On 1.x, this makes the natural DM command fail:

/create torch light_color ff0000

ff0000 remains a Python string, then the typed light_color setter rejects it with TypeError: Illegal value for light_color field. The decimal workaround (16711680) is inconsistent with archetypes, maps, the authored schema, and editor-facing syntax. The same helper is also used by /patch.

This is a command-adapter gap, not a colored-light renderer defect. The engine and authored loader intentionally use an integer internally and exact six-digit, unprefixed hexadecimal at the authored boundary; the command helper needs to bridge those representations deliberately.

Outcome

Make user-facing object-attribute commands accept canonical color input consistently on both release lines, while preserving each line's ownership and runtime contracts.

  • On 1.x, /create torch light_color ff0000 assigns integer 0xff0000; lighting/applying the torch emits red light.
  • On 1.x, /patch follows the same light_color parsing behavior.
  • Apply the equivalent command/helper correction and focused regression coverage to main, so the forward line does not retain the known decimal-only coercion defect.
  • Accept exactly six unprefixed hexadecimal digits, case-insensitively, consistent with the authored RRGGBB contract.
  • Reject malformed color input cleanly without an uncaught Python traceback or a leaked/partially created object.
  • Preserve existing decimal, floating-point, quoted-string, flag, and fallback Load() behavior for unrelated attributes.

main does not currently carry Classic's complete colored-light runtime contract. Do not use this issue to merge 1.x wholesale, import Classic implementation, or relax the replacement/provenance boundary; make a branch-appropriate helper/test change.

Delivery and validation

Use separate, linked pull requests targeting 1.x and main, as required for post-fork cross-line work. For each line:

  • add focused coverage for valid lower/uppercase RGB and malformed values;
  • run python3 tools/validate.py;
  • run git diff --check.

Related implementation: #64 and atrinik/classic#77. The broader authored-source color audit in #65 is separate from this command parsing bug.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Fields

Priority

None yet

Effort

None yet

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions