Skip to content

fix(upgrade): token rename codemod corrupts .toString() and .toLocaleString() calls #910

Closed

Description

@cixzhang

Bug

The migrate-token-renames codemod in xds upgrade --apply --from 0.0.7 --to 0.0.8 incorrectly transforms .toString() and .toLocaleString() method calls into their native code string representations.

Before (correct)

const qs = params.toString();
const formatted = lineCount.toLocaleString();

After (broken)

const qs = params.function toString() { [native code] }();
const formatted = lineCount.function toLocaleString() { [native code] }();

Repro

xds upgrade --apply --from 0.0.7 --to 0.0.8

on any .tsx file containing .toString() or .toLocaleString() calls.

Root cause

Likely the token rename map has an overly broad string matcher that catches toString / toLocaleString as token names, and the replacement logic calls .toString() on a function reference instead of using the replacement string.

Impact

Silently corrupts source files. The 4 files hit in XDS Common were:

  • src/Diff/internal component.tsx
  • src/Diff/internal component.tsx
  • src/Employee/internal component.tsx
  • src/Task/internal component.tsx

Found during v0.0.8 Nest sync.

Activity

  1. added 3 commits that reference this issue on Mar 27, 2026
    57b95cc
    eef12f9
    3e8e03d
  2. added a commit that references this issue on Mar 27, 2026
    8fee2ec
  3. added a commit that references this issue on Apr 26, 2026
    0ddf041
  4. added 2 commits that reference this issue on Jun 21, 2026
    3121adb
    ee0bc71
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions