Skip to content

fix(components): reach every typographic component with the cascade - #266

Merged
LeadcodeDev merged 1 commit into
chantier/audit-2026-09from
fix/cascade-all-typographic
Sep 22, 2026
Merged

LeadcodeDev merged 1 commit into
chantier/audit-2026-09from
fix/cascade-all-typographic

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

Severity Medium, category correctness. Location: crates/rustmotion-components/src/lib.rs:727

Impact

The first pass at making cascade::inherit_from reach painters special-cased Component::Text inside LegacyPaintDispatcher::dispatch. That left the other seventeen components that read color/font-* off their own un-cascaded self.style still blind to inherited typography — gradient_text, caption, rich_text, badge, callout, counter, divider, icon, kbd, list, marquee, notification, number_wheel, pill_nav, table, terminal, tooltip. Worse than the missing coverage, a per-variant match arm means the cascade applies to exactly the variants someone remembered to list: the next component added would silently miss it. That is the same defect class the audit reported elsewhere in this crate, reintroduced by the fix for it.

Fix

Replace the special case with Component::with_cascaded_style, an exhaustive match over all sixty variants with no wildcard arm, so adding a variant without classifying it is a compile error. dispatch and component_intrinsic call it uniformly with no per-variant knowledge. The clone goes through a serde round-trip rather than Clone, because Caption's inner types are not Clone and live in another crate. A membership test pins the classification so an existing variant cannot be silently reclassified either.

Evidence the audit read

let is_typographic = match self {
    Component::Text(_)
    | Component::GradientText(_)
    | Component::Caption(_)
    ...
    | Component::Tooltip(_) => true,

Stacked on fix/table-column-widths, which carries the previous finding of this workstream. GitHub shows only this finding's diff; merge in order.

Part of the September 2026 audit remediation chantier. Refs #220 (RM-07B).

@LeadcodeDev LeadcodeDev added the bug Something isn't working label Sep 21, 2026
@LeadcodeDev LeadcodeDev self-assigned this Sep 21, 2026
@LeadcodeDev
LeadcodeDev force-pushed the fix/table-column-widths branch from 14fbbe3 to 5b62def Compare September 22, 2026 06:12
@LeadcodeDev
LeadcodeDev force-pushed the fix/cascade-all-typographic branch from e17149b to 2fecd21 Compare September 22, 2026 06:12
@LeadcodeDev
LeadcodeDev force-pushed the fix/table-column-widths branch from 5b62def to 19e4361 Compare September 22, 2026 08:36
@LeadcodeDev
LeadcodeDev force-pushed the fix/cascade-all-typographic branch from 2fecd21 to ce65750 Compare September 22, 2026 08:36
@LeadcodeDev
LeadcodeDev force-pushed the fix/table-column-widths branch from 19e4361 to 575be98 Compare September 22, 2026 08:46
@LeadcodeDev
LeadcodeDev force-pushed the fix/cascade-all-typographic branch from ce65750 to 2216be2 Compare September 22, 2026 08:46
@LeadcodeDev
LeadcodeDev changed the base branch from fix/table-column-widths to chantier/audit-2026-09 September 22, 2026 08:54
The first pass at making `cascade::inherit_from` reach painters special-cased `Component::Text` inside `LegacyPaintDispatcher::dispatch`. That left the other seventeen components that read `color`/`font-*` off their own un-cascaded `self.style` still blind to inherited typography — `gradient_text`, `caption`, `rich_text`, `badge`, `callout`, `counter`, `divider`, `icon`, `kbd`, `list`, `marquee`, `notification`, `number_wheel`, `pill_nav`, `table`, `terminal`, `tooltip`. Worse than the missing coverage, a per-variant `match` arm means the cascade applies to exactly the variants someone remembered to list: the next component added would silently miss it. That is the same defect class the audit reported elsewhere in this crate, reintroduced by the fix for it.

Refs #220
@LeadcodeDev
LeadcodeDev force-pushed the fix/cascade-all-typographic branch from 2216be2 to b4ede56 Compare September 22, 2026 09:09
@LeadcodeDev
LeadcodeDev merged commit fbaf997 into chantier/audit-2026-09 Sep 22, 2026
LeadcodeDev added a commit that referenced this pull request Sep 22, 2026
…266)

The first pass at making `cascade::inherit_from` reach painters special-cased `Component::Text` inside `LegacyPaintDispatcher::dispatch`. That left the other seventeen components that read `color`/`font-*` off their own un-cascaded `self.style` still blind to inherited typography — `gradient_text`, `caption`, `rich_text`, `badge`, `callout`, `counter`, `divider`, `icon`, `kbd`, `list`, `marquee`, `notification`, `number_wheel`, `pill_nav`, `table`, `terminal`, `tooltip`. Worse than the missing coverage, a per-variant `match` arm means the cascade applies to exactly the variants someone remembered to list: the next component added would silently miss it. That is the same defect class the audit reported elsewhere in this crate, reintroduced by the fix for it.

Refs #220
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