Skip to content

fix(scanner): harvest ICON* constants assigned with .freeze - #4

Merged
mhenrixon merged 1 commit into
mainfrom
fix/scanner-harvest-frozen-icon-constants
Jul 17, 2026
Merged

fix(scanner): harvest ICON* constants assigned with .freeze#4
mhenrixon merged 1 commit into
mainfrom
fix/scanner-harvest-frozen-icon-constants

Conversation

@mhenrixon

Copy link
Copy Markdown
Collaborator

Summary

  • Declaration harvest now unwraps trailing zero-arg .freeze (and parentheses) so ICONS = { … }.freeze and %i[a b].freeze still contribute icon names.
  • Prism models the assignment value as a CallNode; without unwrapping, hash/array values were never collected.
  • That broke cross-file dynamics: names only in a frozen ICONS map + PhosphorIcon(@icon) in a shared component → Docker glyphs:prune_icons deleted the SVGs → production Icons::IconNotFound (e.g. Zazu AppSignal ma-production #888 for car / identification-badge).
  • Adds regression fixtures (FrozenIconsMap + SelectableRow) and a scanner example; documents the behavior in README/CHANGELOG.

No version bump — release workflow handles that.

Test plan

  • bundle exec rspec — 133 examples, 0 failures
  • RuboCop clean on touched scanner file
  • After release: bump glyphs in Zazu; can revert the app-side Style/MutableConstant workaround on KycDocumentTypeOptions::ICONS if desired

Prism models `ICONS = { … }.freeze` as a CallNode, so declaration
harvest skipped hash/array values and cross-file dynamics
(`PhosphorIcon(@ICON)` + frozen ICONS map) lost names at prune.

Unwrap zero-arg `.freeze` (and parentheses) before walking the
declaration value. Regression fixtures cover frozen hash + array
maps rendered from another file.
@mhenrixon mhenrixon self-assigned this Jul 17, 2026
@mhenrixon mhenrixon added the bug Something isn't working label Jul 17, 2026
@mhenrixon
mhenrixon merged commit f199aeb into main Jul 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant