Skip to content

fix(codemod): Map the regular font weight to system.fontWeight.normal - #4227

Open
akshita317 wants to merge 1 commit into
Workday:supportfrom
akshita317:fix-codemod-font-weight-normal
Open

akshita317 wants to merge 1 commit into
Workday:supportfrom
akshita317:fix-codemod-font-weight-normal

Conversation

@akshita317

@akshita317 akshita317 commented Oct 28, 2026 •

Copy link
Copy Markdown

Summary

Fixes: #3688

The v13.2 type token codemod migrates the regular font weight to a token that does not exist. @workday/canvas-tokens-web defines system.fontWeight.light, normal, medium and bold, but the codemod writes system.fontWeight.regular in two places:

  • type.properties.fontWeights.regular (the fontWeights mapping)
  • the fontWeight of every body and subtext type level (generateLevelTokens)
// before: running the v13.2 codemod on
const fontWeight = type.properties.fontWeights.regular;
// produced
const fontWeight = cssVar(system.fontWeight.regular); // TS2339, and cssVar(undefined) at runtime

This maps regular to normal, which is what the System mapping table already documents. It also fixes the same token in TokenMigrationOverview.mdx and in the v13.2 and v14 LLM migration guides, which still showed regular.

It adds modules/codemod/lib/v13.2/spec/mapping.spec.ts, which resolves every font weight and type level token the mapping produces against @workday/canvas-tokens-web, so a token name that does not exist fails a test rather than reaching migrated code.

Release Category

Codemods


Checklist

For the Reviewer

  • PR title is short and descriptive
  • PR summary describes the change (Fixes/Resolves linked correctly)
  • PR Release Notes describes additional information useful to call out in a release message or removed if not applicable
  • Breaking Changes provides useful information to upgrade to this code or removed if not applicable

Where Should the Reviewer Start?

modules/codemod/lib/v13.2/utils/generateLevelTokens.ts and modules/codemod/lib/v13.2/mapping/index.ts

Areas for Feedback? (optional)

  • Code
  • Documentation
  • Testing
  • Codemods

Targets support, like other patches.

Testing Manually

yarn vitest run modules/codemod/lib/v13.2 passes (43 tests). Without the fix, the two new mapping specs and five existing type token specs fail.

Summary by CodeRabbit

  • Bug Fixes
    • Font-weight migrations now map regular text to system.fontWeight.normal, while headings and titles remain bold.
  • Documentation
    • Updated migration guidance and examples to recommend system.fontWeight.normal for regular text.
  • Tests
    • Added checks that configured font-weight and typography token paths exist in the published token system.

The v13.2 type token codemod rewrote type.properties.fontWeights.regular,
and the font weight of every body and subtext type level, to
system.fontWeight.regular. @workday/canvas-tokens-web has no such token:
its font weights are light, normal, medium and bold. Migrated code
failed to type-check, and cssVar received undefined.

Map regular to normal, as the System mapping table already documents,
and fix the same token in the migration overview and LLM migration
guides. Add a spec that resolves the mapped type tokens against
@workday/canvas-tokens-web.

Fixes Workday#3688
@akshita317
akshita317 requested a review from a team as a code owner October 28, 2026 19:34
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 1c3b393 and cbc7a0d.

Files selected for processing: 7
  • modules/codemod/lib/v13.2/mapping/index.ts
  • modules/codemod/lib/v13.2/spec/mapping.spec.ts
  • modules/codemod/lib/v13.2/spec/migrateTypeTokens.spec.ts
  • modules/codemod/lib/v13.2/utils/generateLevelTokens.ts
  • modules/docs/llm/llm-token-migration-13.2.txt
  • modules/docs/llm/llm-token-migration-14.txt
  • modules/docs/mdx/tokens/TokenMigrationOverview.mdx

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The v13.2 codemod now maps regular font weight to system.fontWeight.normal. Tests and migration documentation use the same token path.

Changes: Font weight token correction

Layer / File(s) Summary
Update mapping and migration references
modules/codemod/lib/v13.2/mapping/index.ts, modules/codemod/lib/v13.2/utils/generateLevelTokens.ts, modules/codemod/lib/v13.2/spec/*, modules/docs/llm/llm-token-migration-13.2.txt, modules/docs/llm/llm-token-migration-14.txt, modules/docs/mdx/tokens/TokenMigrationOverview.mdx
The regular font-weight mapping and generated non-heading type-level tokens now use normal. Tests and migration examples use system.fontWeight.normal. Added tests that check configured font-weight and type-level paths against the token system.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested labels: documentation

Suggested reviewers: rayredgoose

Merge Risk: Minimal · up to cbc7a

The PR consistently corrects the regular font-weight token without an identified merge-blocking risk.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title states the main change: the regular font weight is now mapped to system.fontWeight.normal in the v13.2 codemod. The raw summary confirms the mapping, generated level tokens, spec updates, an…
Linked Issues check Passed Issue #3688 requires correction of the regular font-weight token name. The PR maps fontWeights.regular and non-heading type levels to system.fontWeight.normal. It updates the related migration doc…
Out of Scope Changes check Passed The changes stay within issue #3688. The implementation fixes the font-weight mapping, the tests verify configured token paths, and the documentation updates remove the same incorrect token name. No u…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check

Explanation

The title states the main change: the regular font weight is now mapped to system.fontWeight.normal in the v13.2 codemod. The raw summary confirms the mapping, generated level tokens, spec updates, and docs all change from regular to normal, matching the title. The linked issue #3688 describes the same naming mismatch. The title uses the fix(codemod) prefix and stays within one sentence.

Full details: Linked Issues check

Explanation

Issue #3688 requires correction of the regular font-weight token name. The PR maps fontWeights.regular and non-heading type levels to system.fontWeight.normal. It updates the related migration documentation and adds token-resolution tests. These changes satisfy the linked issue coding requirement.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #3688. The implementation fixes the font-weight mapping, the tests verify configured token paths, and the documentation updates remove the same incorrect token name. No unrelated behavior or feature change is shown.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 4 files. (3 skipped: 3 unsupported.)

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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