Skip to content

refactor(WhereUI): resolve trait-driven appearance in stylesheet slices - #323

Merged
kyleve merged 3 commits into
mainfrom
codex/stylesheet-trait-slicing
Sep 23, 2026
Merged

kyleve merged 3 commits into
mainfrom
codex/stylesheet-trait-slicing

Conversation

@kyleve

@kyleve kyleve commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Prepared by an AI agent.

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 BScaledDimension with the slice's explicit content-size category. BContentSizeCategory owns 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

  • Preserve standard/accessibility layout thresholds, compact welcome copy and full accessibility labels, colors, timings, and title2-relative scaling.
  • Keep ViewThatFits and measured geometry at layout time. Remaining raw trait reads serve runtime preview inputs, the centralized static-motion helper, or trait/capture infrastructure.
  • RootView retains its model and launch runner ownership; only stylesheet resolution moves into a descendant of its Broadway root.

Testing

  • ./test WhereUITests passed: 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 --review with 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 --lint and ./sync-agents passed. DeveloperOverlaySnapshotTests passed with unchanged references.

Follow-up

The maximum-size welcome recovery title is already truncated in the existing reference. It is filed in Where/TODOs.md for a separate layout/copy fix. Existing calendar overflow is already tracked there.

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.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be in Broadway itself?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not have this somewhere already?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kyleve
kyleve enabled auto-merge (squash) September 23, 2026 19:22
@kyleve
kyleve merged commit 0f462eb into main Sep 23, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant