refactor(WhereUI): resolve trait-driven appearance in stylesheet slices - #323
Conversation
Move component layouts, welcome copy, icon ink, launch motion, and scaled launcher geometry into resolved styles. Resolve launch appearance beneath the Broadway root and synchronize scoped SwiftUI/Broadway overrides. Validation: WhereUI unit suite, 19 affected snapshot suites, focused final regression rerun, SwiftFormat lint, and development simulator build passed. Snapshot differences were reproduced from baseline source; references remain unchanged.
Clarify component policy resolution, ScaledMetric and runtime exceptions, and synchronized scoped traits. Add an audit procedure to building-ui and record the pre-existing maximum-size welcome-label truncation. Validation: skill validator, instruction mirror sync, attribution check, and diff checks passed. No CI guard added.
| import BroadwayCore | ||
| import UIKit | ||
|
|
||
| /// Scales authored geometry against the slice's category, never ambient UIKit traits. |
There was a problem hiding this comment.
Should this be in Broadway itself?
There was a problem hiding this comment.
Posted by an AI agent on the user's behalf.
Yes. Moved this into BroadwayCore as BScaledDimension in 8d5793c and removed the WhereUI helper. The stylesheet consumes the shared API. Focused Broadway/WhereUI tests, all 12 hosted ScaledMetric comparisons, developer-overlay snapshots, and formatting pass.
| ) | ||
| } | ||
|
|
||
| private static func uiCategory(_ category: BContentSizeCategory) -> UIContentSizeCategory { |
There was a problem hiding this comment.
Do we not have this somewhere already?
There was a problem hiding this comment.
Posted by an AI agent on the user's behalf.
Broadway already has BContentSizeCategory.from(UIContentSizeCategory) for the opposite direction; the reverse was missing. SnapshotKit also maps SwiftUI DynamicTypeSize to UIKit, but does not accept Broadway categories. In 8d5793c I moved the reverse conversion onto BContentSizeCategory.uiContentSizeCategory, beside the existing bridge, and added round-trip tests for all 12 categories. The shared scaling helper uses that conversion.
Summary
Resolve Dynamic Type layouts, welcome copy length, Settings icon ink, and launch/focus motion in component stylesheet slices. Views render the resolved policies while keeping content-fit measurement and semantic fonts intact. The developer launcher uses BroadwayCore's shared
BScaledDimensionwith the slice's explicit content-size category.BContentSizeCategoryowns both directions of the UIKit category bridge.Resolve launch tokens below RootView's own Broadway root. Keep scoped SwiftUI and Broadway overrides aligned for the developer HUD, widget examples, and appearance previews.
Update the repository rules, WhereUI design-system guide, and building-ui skill with the slicing boundary and documented exceptions. Prevention uses documentation and skill guidance, with no new CI rule.
Why
Direct view-level trait checks bypassed the established design-system boundary. Generic ScaledMetric guidance and a non-Equatable transition exception also encouraged decisions outside the slice, even when a resolved policy could represent them.
Review focus
Testing
./test WhereUITestspassed: Swift Testing reports 518 tests in 101 suites, including two existing known localization issues. The new scaling comparison passed at all 12 Dynamic Type sizes../test --snapshots --reviewwith the 19 affected WhereUI suites passed (215 reference images). No repository reference was re-recorded.A targeted rerun of EstimatedTimeFeaturesView and PlannedStayEditor passed. Original-source captures reproduce the localized differences. The forecast image is pixel-identical before/after this refactor. Plan-editor differences are confined to its spinning progress indicator.
./swiftformat --lint,./attribution --check,./sync-agents, and the building-ui skill validator passed. Both test commands also passed architecture checks.The Where Development simulator build passed.
Live launch/ranking interaction was not completed: this session's computer-use tools cannot access Simulator. The snapshot and unit checks do not substitute for that manual review.
Review follow-up: focused BroadwayCore and WhereUI stylesheet tests passed (45 Swift Testing tests, including all 12 category round trips and hosted scaling comparisons).
./swiftformat --lintand./sync-agentspassed.DeveloperOverlaySnapshotTestspassed with unchanged references.Follow-up
The maximum-size welcome recovery title is already truncated in the existing reference. It is filed in
Where/TODOs.mdfor a separate layout/copy fix. Existing calendar overflow is already tracked there.