2 Commits

Author SHA1 Message Date
Kabiru Mwenja d3734a7485 Rename work_packages_identifier setting values to "classic" and "semantic"
The setting previously used "numeric" and "alphanumeric" as its allowed
values. Rename them to "classic" and "semantic" to better align with the
product terminology for the work package identifier modes.

Includes a migration to update any stored setting values in the database,
updated constants and helper methods on Setting::WorkPackageIdentifier,
and all corresponding references across models, components, forms,
frontend controllers, locales, and specs.
2026-03-28 10:01:57 +03:00
Kabiru Mwenja f02ef008db Fix WorkPackageIdentifier encapsulation and lazy-load guard
Three issues corrected:

1. Bug fix: ALLOWED_VALUES is an Array; ALLOWED_VALUES[:alphanumeric] raises
   TypeError at runtime (symbols are not valid Array indices). Extract named
   string constants NUMERIC and ALPHANUMERIC so comparisons are explicit.

2. Lazy-load guard: ProjectHandleSuggestionGenerator ran a DB query on every
   component render, even in numeric mode where the result is never used.
   Now the query only runs when alphanumeric? is true; numeric mode gets [].

3. show_autofix_section? simplified: the alphanumeric? guard moved into the
   initializer, so the private method is now just projects_data.any?.

Also: wrap definition.rb's `allowed:` in a lambda to defer constant
resolution past Rails autoload (fixes a load-order error in specs), and
add a spec for Setting::WorkPackageIdentifier covering the bug scenario.
2026-02-25 23:34:01 +03:00