refactor(geometry): reuse the canonical component_kind helper - #233
Merged
LeadcodeDev merged 1 commit intoSep 22, 2026
Merged
Conversation
LeadcodeDev
force-pushed
the
fix/geometry-autoscroll-box
branch
from
September 21, 2026 23:39
2e3c60c to
6bc338b
Compare
LeadcodeDev
force-pushed
the
refactor/component-kind-dedup
branch
from
September 21, 2026 23:39
bbccc33 to
b97b212
Compare
53 tasks
LeadcodeDev
force-pushed
the
fix/geometry-autoscroll-box
branch
from
September 22, 2026 06:09
e689845 to
d9e3be1
Compare
LeadcodeDev
force-pushed
the
refactor/component-kind-dedup
branch
from
September 22, 2026 06:09
20d4bb8 to
5ea58df
Compare
LeadcodeDev
force-pushed
the
fix/geometry-autoscroll-box
branch
from
September 22, 2026 08:34
d9e3be1 to
9af265d
Compare
LeadcodeDev
force-pushed
the
refactor/component-kind-dedup
branch
from
September 22, 2026 08:34
5ea58df to
face008
Compare
LeadcodeDev
force-pushed
the
fix/geometry-autoscroll-box
branch
from
September 22, 2026 08:43
9af265d to
2793eea
Compare
LeadcodeDev
force-pushed
the
refactor/component-kind-dedup
branch
from
September 22, 2026 08:43
face008 to
cbeb67a
Compare
LeadcodeDev
changed the base branch from
fix/geometry-autoscroll-box
to
chantier/audit-2026-09
September 22, 2026 08:52
`rustmotion_components::box_builder::component_kind` (box_builder.rs:2090-2154) is public and already imported elsewhere in the same crate (`crates/rustmotion/src/engine/render/scene.rs:744`). geometry.rs re-implements it as a private 60-arm copy. Both must be edited for every new component, and both already carry the same two label bugs: `QrCode(_) => "qrcode"` while the serde tag is `qr_code`, and `Container(_) => "container"` while the serde tag is `div`. Those strings are user-facing — they are the `component:` field of every `GeometryViolation` and drive the hint branches at geometry.rs:686 and :1591 — so a violation on a `qr_code` reports a type name that does not exist in the schema. Exhaustiveness protects against a *missing* arm but not against the two copies drifting on a rename, which is exactly how the labels got out of sync with serde in the first place. Refs #220
LeadcodeDev
force-pushed
the
refactor/component-kind-dedup
branch
from
September 22, 2026 08:59
cbeb67a to
1d56385
Compare
LeadcodeDev
added a commit
that referenced
this pull request
Sep 22, 2026
`rustmotion_components::box_builder::component_kind` (box_builder.rs:2090-2154) is public and already imported elsewhere in the same crate (`crates/rustmotion/src/engine/render/scene.rs:744`). geometry.rs re-implements it as a private 60-arm copy. Both must be edited for every new component, and both already carry the same two label bugs: `QrCode(_) => "qrcode"` while the serde tag is `qr_code`, and `Container(_) => "container"` while the serde tag is `div`. Those strings are user-facing — they are the `component:` field of every `GeometryViolation` and drive the hint branches at geometry.rs:686 and :1591 — so a violation on a `qr_code` reports a type name that does not exist in the schema. Exhaustiveness protects against a *missing* arm but not against the two copies drifting on a rename, which is exactly how the labels got out of sync with serde in the first place. Refs #220
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Severity Low, category quality. Location:
crates/rustmotion/src/cli/commands/geometry.rs:1158Impact
rustmotion_components::box_builder::component_kind(box_builder.rs:2090-2154) is public and already imported elsewhere in the same crate (crates/rustmotion/src/engine/render/scene.rs:744). geometry.rs re-implements it as a private 60-arm copy. Both must be edited for every new component, and both already carry the same two label bugs:QrCode(_) => "qrcode"while the serde tag isqr_code, andContainer(_) => "container"while the serde tag isdiv. Those strings are user-facing — they are thecomponent:field of everyGeometryViolationand drive the hint branches at geometry.rs:686 and :1591 — so a violation on aqr_codereports a type name that does not exist in the schema. Exhaustiveness protects against a missing arm but not against the two copies drifting on a rename, which is exactly how the labels got out of sync with serde in the first place.Fix
Delete the geometry.rs copy and
use rustmotion::components::box_builder::component_kind;. In the surviving copy, return the actual serde tags ("qr_code","div") — or better, derive the label from the schema so it cannot drift from#[serde(tag = "type", rename_all = "snake_case")]at all.Evidence the audit read
Part of the September 2026 audit remediation chantier. Refs #220 (RM-40).