Skip to content

WCSS Change Request Logic Hardening#281

Merged
jordanjones243 merged 3 commits into
jjones/wcssChangeRequest/#269from
cfriedberg/jjones/wcssChangeRequest/269
May 1, 2026
Merged

WCSS Change Request Logic Hardening#281
jordanjones243 merged 3 commits into
jjones/wcssChangeRequest/#269from
cfriedberg/jjones/wcssChangeRequest/269

Conversation

@jordanjones243
Copy link
Copy Markdown
Contributor

@jordanjones243 jordanjones243 commented May 1, 2026

Alaska Airlines Pull Request

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Resolves: # (issue, if applicable)

Summary:

Please summarize the scope of the changes you have submitted, what the intent of the work is and anything that describes the before/after state of the project.

Type of change:

Please delete options that are not relevant.

  • New capability
  • Revision of an existing capability
  • Infrastructure change (automation, etc.)
  • Other (please elaborate)

Checklist:

  • My update follows the CONTRIBUTING guidelines of this project
  • I have performed a self-review of my own update

By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Pull Requests will be evaluated by their quality of update and whether it is consistent with the goals and values of this project. Any submission is to be considered a conversation between the submitter and the maintainers of this project and may require changes to your submission.

Thank you for your submission!

-- Auro Design System Team

Summary by Sourcery

Make type theme generation more explicit and robust around accent letter-spacing behavior.

Bug Fixes:

  • Prevent incorrect inference of accent letter-spacing behavior by allowing it to be passed explicitly into theme generation.

Enhancements:

  • Always generate letter-spacing CSS variables for type sizes instead of conditionally, and rename the accent letter-spacing control parameter for clarity.
  • Update the Hawaiian type theme to explicitly disable accent letter-spacing via the new theme-generation parameter.

…rameter

Surface accent letter-spacing intent at the theme call site instead of
inferring it from the accent-config 2xl entry. The inference was brittle:
a future theme defining letter-spacing on some sizes but not 2xl would
have been miscategorized for the entire accent group.
The per-size guard on var emission and the theme-level $use-letter-spacing
flag on class emission were two independent gates that could disagree. A
mixed config could produce a class referencing an undefined var, causing
letter-spacing to resolve to unset rather than inherit. Make the theme
flag the single source of truth.
…cope

The mixin name suggests it covers all four type categories, but the
$use-letter-spacing parameter only ever flowed to generate-accent-classes.
Rename to $accent-use-letter-spacing so the scope is visible at the call
site without stepping into the mixin body.
@jordanjones243 jordanjones243 requested a review from a team as a code owner May 1, 2026 15:59
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 1, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors the typography theme generation SCSS mixins to take an explicit accent letter-spacing flag, consistently propagate it through type class generation, and always emit letter-spacing CSS variables, while disabling accent letter-spacing for the Hawaiian theme.

Class diagram for updated SCSS type mixins

classDiagram
  direction LR

  class generate_theme {
    +mixin generate_theme($theme-name, $body-config, $display-config, $heading-config, $accent-config, $accent-uses-letter-spacing)
  }

  class generate_theme_type_css_vars {
    +mixin generate_theme_type_css_vars($theme-configs)
  }

  class generate_theme_type_classes {
    +mixin generate_theme_type_classes($use-fallback, $fallback-configs, $accent-use-letter-spacing)
  }

  class generate_body_classes {
    +mixin generate_body_classes($use-fallback, $fallback-config)
  }

  class generate_display_classes {
    +mixin generate_display_classes($use-fallback, $fallback-config)
  }

  class generate_heading_classes {
    +mixin generate_heading_classes($use-fallback, $fallback-config)
  }

  class generate_accent_classes {
    +mixin generate_accent_classes($use-fallback, $fallback-config, $accent-use-letter-spacing)
  }

  class fluid_type_vars {
    +mixin generate_fluid_type_vars($css-ns, $type, $size, $theme-config)
    --type-family
    --type-family-fallback
    --type-letter-spacing
    --type-weight
    --type-line-height
  }

  generate_theme --> generate_theme_type_css_vars : passes $theme-configs
  generate_theme --> generate_theme_type_classes : passes $accent-uses-letter-spacing as $accent-use-letter-spacing

  generate_theme_type_classes --> generate_body_classes : body fallback config
  generate_theme_type_classes --> generate_display_classes : display fallback config
  generate_theme_type_classes --> generate_heading_classes : heading fallback config
  generate_theme_type_classes --> generate_accent_classes : accent fallback + $accent-use-letter-spacing

  fluid_type_vars ..> generate_theme_type_css_vars : uses type-property-check values as CSS vars
Loading

Flow diagram for accent letter-spacing flag propagation

flowchart LR
  subgraph ThemeConfigInputs
    TName[$theme-name]
    Body[$body-config]
    Display[$display-config]
    Heading[$heading-config]
    Accent[$accent-config]
    AccentFlag[$accent-uses-letter-spacing]
  end

  TName --> GenTheme
  Body --> GenTheme
  Display --> GenTheme
  Heading --> GenTheme
  Accent --> GenTheme
  AccentFlag --> GenTheme

  GenTheme[generate-theme mixin] --> ThemeConfigs[(theme-configs map)]
  GenTheme --> GenTypeCssVars[generate-theme-type-css-vars]
  GenTheme --> GenTypeClasses[generate-theme-type-classes]

  ThemeConfigs --> GenTypeCssVars

  GenTypeCssVars --> FluidVars[CSS custom properties
--type-family
--type-family-fallback
--type-letter-spacing
--type-weight
--type-line-height]

  GenTypeClasses --> BodyClasses[body classes]
  GenTypeClasses --> DisplayClasses[display classes]
  GenTypeClasses --> HeadingClasses[heading classes]
  GenTypeClasses --> AccentClasses[accent classes]

  AccentFlag --> GenTypeClasses
  GenTypeClasses --> AccentClasses

  subgraph HawaiianThemeOverride
    HawaiianTheme[hawaian/index.scss generate-theme call]
    HawaiianAccentFlag[$accent-uses-letter-spacing: false]
  end

  HawaiianTheme --> HawaiianAccentFlag
  HawaiianAccentFlag --> GenTheme
Loading

File-Level Changes

Change Details Files
Make accent letter-spacing usage an explicit, configurable parameter in the theme generator pipeline.
  • Update the generate-theme mixin signature to accept an $accent-uses-letter-spacing parameter with a default of true
  • Remove the implicit derivation of accent letter-spacing behavior from the accent config map
  • Pass the new accent letter-spacing flag through to the theme type class generator using a renamed parameter that clearly scopes it to accent styles
src/type/mixins/_theme-generator.scss
src/type/mixins/_type-generator.scss
Always emit letter-spacing CSS variables for each type size instead of guarding on null values.
  • Set the --*-letter-spacing CSS custom property unconditionally using type-property-check for each size
  • Remove the conditional @if block that only defined the letter-spacing variable when non-null
src/type/mixins/_fluid-type.scss
Disable accent letter-spacing specifically for the Hawaiian typography theme.
  • Extend the Hawaiian theme generate-theme call to pass $accent-uses-letter-spacing: false so accent styles do not use letter-spacing in that theme
src/type/themes/hawaiian/index.scss

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@jordanjones243 jordanjones243 merged commit 13d00b1 into jjones/wcssChangeRequest/#269 May 1, 2026
3 checks passed
@jordanjones243 jordanjones243 deleted the cfriedberg/jjones/wcssChangeRequest/269 branch May 1, 2026 15:59
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 2 issues, and left some high level feedback:

  • The change in _fluid-type.scss to always set --*-letter-spacing removes the null guard; if type-property-check can return null, this will emit an invalid CSS variable value, so consider keeping a conditional or providing a safe default.
  • The new parameter naming around letter-spacing ($accent-uses-letter-spacing in generate-theme vs $accent-use-letter-spacing in generate-theme-type-classes) is very similar but not identical; aligning these names would reduce the likelihood of future misconfiguration.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The change in `_fluid-type.scss` to always set `--*-letter-spacing` removes the null guard; if `type-property-check` can return `null`, this will emit an invalid CSS variable value, so consider keeping a conditional or providing a safe default.
- The new parameter naming around letter-spacing (`$accent-uses-letter-spacing` in `generate-theme` vs `$accent-use-letter-spacing` in `generate-theme-type-classes`) is very similar but not identical; aligning these names would reduce the likelihood of future misconfiguration.

## Individual Comments

### Comment 1
<location path="src/type/mixins/_fluid-type.scss" line_range="12" />
<code_context>
     // Set base properties
     --#{$css-ns}-#{$type}-#{$size}-family: #{type-property-check($theme-config, $size, 'family')};
     --#{$css-ns}-#{$type}-#{$size}-family-fallback: #{type-property-check($theme-config, $size, 'familyFallback')};
+    --#{$css-ns}-#{$type}-#{$size}-letter-spacing: #{type-property-check($theme-config, $size, 'letter-spacing')};
     --#{$css-ns}-#{$type}-#{$size}-weight: #{type-property-check($theme-config, $size, 'weight')};
     --#{$css-ns}-#{$type}-#{$size}-line-height: #{type-property-check($theme-config, $size, 'line-height')};
</code_context>
<issue_to_address>
**issue (bug_risk):** Unconditionally setting the letter-spacing CSS variable may produce empty values when the config is missing that property.

Previously this variable was only emitted when `letter-spacing` existed in the config. Now, when `type-property-check` returns `null`, `#{null}` becomes an empty string, yielding:
```css
--foo-bar-letter-spacing: ;
```
This can change how other code distinguishes between “not set” and “intentionally empty” (e.g., via `var(--..., <fallback>)` or computed style checks).

If the variable should only exist when configured, keep the conditional:
```scss
$letter-spacing: type-property-check($theme-config, $size, 'letter-spacing');
@if $letter-spacing != null {
  --#{$css-ns}-#{$type}-#{$size}-letter-spacing: #{$letter-spacing};
}
```
If it must always exist, consider a clear sentinel value (e.g., `initial` or `normal`) instead of an empty value, depending on consumers’ expectations.
</issue_to_address>

### Comment 2
<location path="src/type/mixins/_type-generator.scss" line_range="17-21" />
<code_context>

 // Generate theme type classes
-@mixin generate-theme-type-classes($use-fallback: false, $fallback-configs: null, $use-letter-spacing: true) {
+@mixin generate-theme-type-classes($use-fallback: false, $fallback-configs: null, $accent-use-letter-spacing: true) {
   @include generate-body-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'body'), null));
   @include generate-display-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'display'), null));
   @include generate-heading-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'heading'), null));
-  @include generate-accent-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'accent'), null), $use-letter-spacing);
+  @include generate-accent-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'accent'), null), $accent-use-letter-spacing);
 }
</code_context>
<issue_to_address>
**nitpick:** Align naming between `$accent-use-letter-spacing` and `$accent-uses-letter-spacing` to reduce confusion.

`generate-theme` uses `$accent-uses-letter-spacing` while this mixin uses `$accent-use-letter-spacing`. This small difference (`use` vs `uses`) can cause mistakes with named arguments and code search. Please standardize on one name across both mixins (e.g., `$accent-use-letter-spacing`).
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

// Set base properties
--#{$css-ns}-#{$type}-#{$size}-family: #{type-property-check($theme-config, $size, 'family')};
--#{$css-ns}-#{$type}-#{$size}-family-fallback: #{type-property-check($theme-config, $size, 'familyFallback')};
--#{$css-ns}-#{$type}-#{$size}-letter-spacing: #{type-property-check($theme-config, $size, 'letter-spacing')};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): Unconditionally setting the letter-spacing CSS variable may produce empty values when the config is missing that property.

Previously this variable was only emitted when letter-spacing existed in the config. Now, when type-property-check returns null, #{null} becomes an empty string, yielding:

--foo-bar-letter-spacing: ;

This can change how other code distinguishes between “not set” and “intentionally empty” (e.g., via var(--..., <fallback>) or computed style checks).

If the variable should only exist when configured, keep the conditional:

$letter-spacing: type-property-check($theme-config, $size, 'letter-spacing');
@if $letter-spacing != null {
  --#{$css-ns}-#{$type}-#{$size}-letter-spacing: #{$letter-spacing};
}

If it must always exist, consider a clear sentinel value (e.g., initial or normal) instead of an empty value, depending on consumers’ expectations.

Comment on lines +17 to +21
@mixin generate-theme-type-classes($use-fallback: false, $fallback-configs: null, $accent-use-letter-spacing: true) {
@include generate-body-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'body'), null));
@include generate-display-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'display'), null));
@include generate-heading-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'heading'), null));
@include generate-accent-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'accent'), null), $use-letter-spacing);
@include generate-accent-classes($use-fallback, if($fallback-configs != null, map-get($fallback-configs, 'accent'), null), $accent-use-letter-spacing);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nitpick: Align naming between $accent-use-letter-spacing and $accent-uses-letter-spacing to reduce confusion.

generate-theme uses $accent-uses-letter-spacing while this mixin uses $accent-use-letter-spacing. This small difference (use vs uses) can cause mistakes with named arguments and code search. Please standardize on one name across both mixins (e.g., $accent-use-letter-spacing).

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.

2 participants