Skip to content

refactor(badge): sizing table duplicated between components and the validator #115

Description

@LeadcodeDev

Surfaced while implementing #110 (wave 2 of #102).

The legibility check added in wave 2 needs each component's effective font size. For badge, that meant duplicating the size→font-size table (sm 12 / md 14 / lg 18) inside crates/rustmotion-cli/src/commands/geometry.rs, because BadgeSize::params() is private to crates/rustmotion-components/src/badge.rs.

Two copies of one table, in different crates, with nothing tying them together. When badge's table changes, the validator will keep measuring against the old numbers and no test will notice.

Note the audit that started this chantier found the documentation had drifted from the code for exactly this reason — a fact duplicated in two places where only one is maintained. This is the same shape, in code.

Fix: expose the badge sizing table (make params() public, or move the mapping somewhere both crates can read) and delete the copy in geometry.rs.

Acceptance: one definition of the table, referenced by both. A test that would fail if they diverged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions