Backtestsvuerun-20261005-155915#15217

Issue #15217 Merged fix PR #15219 Run 5 Oct 2026 · run-20261005-155915 vuejs/core

The Playground's TS version is set to 7 by default.

Better

Our patch was judged better than the merged fix.

In this judgment, Patch B = our agent, Patch A = the merged fix.

Both patches fix the core problem the same way: they pass an explicit `typescriptVersion` ref to `useStore`, so the playground no longer defaults to npm's `latest` tag, which now resolves to TS 7. Both are correct for the reported scenario.

Correctness / maintainability. Patch A hardcodes `'6.0.3'`. That works today but drifts silently. Patch B derives the default from the repo's own `typescript/package.json`, so the playground always defaults to the version Vue is actually built and type-checked against. B also covers the issue's other ask, telling users that a version isn't supported: the version dropdown marks TypeScript majors newer than the supported one as "(unsupported)". A minor risk in B is the reliance on importing `typescript/package.json`. Vite handles JSON imports fine, and TypeScript's package does not block that subpath, so the risk is low.

Tests. Patch A adds none. Patch B adds a spec that checks the default is not `latest` and matches the repo TS version, and that newer majors are flagged unsupported. The first test would fail against the original code's implicit `latest` behavior only in spirit, since the module is new. Even so, the tests meaningfully pin the intended behavior. The `filterVersions` tests cover logic that was moved, not new behavior.

Scope / craft. B extracts the existing version-filtering logic into `versions.ts`. That is a pure move with no behavior change, done to make it testable, and the change stays clean and well commented. It is more churn than A but low risk.

Overall, B fixes the root issue more robustly, addresses the request to inform users, and adds tests, so it is the better patch.

The judge saw only the two patches, labelled A and B in random order, with issue links and version numbers removed. The reasoning above is shown verbatim.

Solve

7m 27s

Wall-clock time in the container

Full test suite

No new failures

3,678 passed · 6 skipped · 3,684 total

Contamination audit

Clean

No sign the agent saw the real fix

Patch size

141vs 3 merged

Changed lines, ours vs merged

Vue version

commit(d2c458b)

Link to minimal reproduction

https://play.vuejs.org/

Steps to reproduce

  1. open Playground: https://play.vuejs.org/
  2. TS version has been set latest and it's over 7.

What is expected?

It's not friendly for someone new to Vue and they don't know that Vue doesn't support TS7 at this time.
I think this is temporary issue, but until Vue supports TS7, It is helpful to tell that.

Or rather, the TS version should default to TS6, not the latest.

What is actually happening?

Broken type support if TS version is not changed.

<img width="470" height="265" alt="Image" src="https://github.com/user-attachments/assets/a5f13371-1180-4c6f-8714-06f32f7c11c8" />

System Info

Any additional comments?

_No response_

The two patches

Our patch+114 −27
packages-private/sfc-playground/__tests__/versions.spec.tsnew file mode 100644index 000000000..b93bc074b@@ -0,0 +1,50 @@+import { version as repoTypeScriptVersion } from 'typescript/package.json'+import {+  DEFAULT_TYPESCRIPT_VERSION,+  filterVersions,+  isTypeScriptVersionSupported,+} from '../src/versions'++describe('sfc-playground versions', () => {+  test('defaults TypeScript to the version Vue is built against, not latest', () => {+    expect(DEFAULT_TYPESCRIPT_VERSION).not.toBe('latest')+    expect(DEFAULT_TYPESCRIPT_VERSION).toBe(repoTypeScriptVersion)+    expect(isTypeScriptVersionSupported(DEFAULT_TYPESCRIPT_VERSION)).toBe(true)+  })++  test('flags TypeScript majors newer than the supported one', () => {+    const major = parseInt(DEFAULT_TYPESCRIPT_VERSION, 10)+    expect(isTypeScriptVersionSupported(`${major + 1}.0.0`)).toBe(false)+    expect(isTypeScriptVersionSupported(`${major + 1}.0.0-beta`)).toBe(false)+    expect(isTypeScriptVersionSupported(`${major}.0.0`)).toBe(true)+    expect(isTypeScriptVersionSupported('5.9.3')).toBe(true)+    expect(isTypeScriptVersionSupported('4.9.5')).toBe(true)+  })++  test('filters dev and insiders TypeScript builds', () => {+    expect(+      filterVersions('typescript', [+        '7.0.0',+        '6.1.0-dev.20260101',+        '6.0.3',+        '5.0.0-insiders.20230101',+        '5.9.3',+      ]),+    ).toEqual(['7.0.0', '6.0.3', '5.9.3'])+  })++  test('limits Vue pre-releases and total versions', () => {+    const versions = [+      ...Array.from({ length: 12 }, (_, i) => `3.6.0-beta.${12 - i}`),+      '3.5.1',+      '3.5.0',+      '3.5.0-rc.1',+      ...Array.from({ length: 40 }, (_, i) => `3.4.${40 - i}`),+    ]+    const filtered = filterVersions('vue', versions)+    expect(filtered.length).toBe(30)+    expect(filtered.filter(v => v.includes('-')).length).toBe(10)+    expect(filtered).not.toContain('3.5.0-rc.1')+    expect(filtered.slice(10, 12)).toEqual(['3.5.1', '3.5.0'])+  })+})packages-private/sfc-playground/src/App.vueindex 7020211f4..24a90f9f4 100644@@ -2,6 +2,7 @@ import Header from './Header.vue' import { Repl, useStore, SFCOptions, useVueImportMap } from '@vue/repl' import Monaco from '@vue/repl/monaco-editor'+import { DEFAULT_TYPESCRIPT_VERSION } from './versions' import { ref, watchEffect, onMounted, computed, watch } from 'vue'  const replRef = ref<InstanceType<typeof Repl>>()@@ -70,6 +71,8 @@ const store = useStore(     builtinImportMap: importMap,     vueVersion,     sfcOptions,+    // npm's `latest` TypeScript may be a major Vue doesn't support yet (TS 7)+    typescriptVersion: ref(DEFAULT_TYPESCRIPT_VERSION),   },   hash, )packages-private/sfc-playground/src/VersionSelect.vueindex 57efdb5f6..02c007158 100644@@ -1,6 +1,7 @@ <script setup lang="ts"> import { onMounted, ref } from 'vue' import Copy from './icons/Copy.vue'+import { filterVersions, isTypeScriptVersionSupported } from './versions'  const expanded = ref(false) const versions = ref<string[]>()@@ -24,32 +25,7 @@ async function fetchVersions(): Promise<string[]> {   )   const { versions } = (await res.json()) as { versions: string[] } -  if (props.pkg === 'vue') {-    // If the latest Vue version is a pre-release, include up to 10 of the-    // current pre-releases so stable releases still have room in the list.-    // Once a stable release is reached, skip all older pre-releases.-    let isInPreRelease = versions[0].includes('-')-    let preReleaseCount = 0-    const filteredVersions: string[] = []-    for (const v of versions) {-      if (v.includes('-')) {-        if (isInPreRelease && preReleaseCount < 10) {-          filteredVersions.push(v)-          preReleaseCount++-        }-      } else {-        filteredVersions.push(v)-        isInPreRelease = false-      }-      if (filteredVersions.length >= 30) {-        break-      }-    }-    return filteredVersions-  } else if (props.pkg === 'typescript') {-    return versions.filter(v => !v.includes('dev') && !v.includes('insiders'))-  }-  return versions+  return filterVersions(props.pkg, versions) }  function setVersion(v: string) {@@ -93,7 +69,15 @@ onMounted(() => {           active: ver === version || (version === 'latest' && index === 0),         }"       >-        <a @click="setVersion(ver)">v{{ ver }}</a>+        <a @click="setVersion(ver)">+          v{{ ver }}+          <span+            v-if="pkg === 'typescript' && !isTypeScriptVersionSupported(ver)"+            class="version-unsupported"+            title="This TypeScript version is not yet supported by Vue"+            >(unsupported)</span+          >+        </a>         <button           title="Copy Version"           class="version-copy"@@ -147,6 +131,10 @@ onMounted(() => {   justify-content: space-between; } +.versions .version-unsupported {+  color: #aaa;+}+ .versions .versions-item .version-copy {   display: none; }packages-private/sfc-playground/src/versions.tsnew file mode 100644index 000000000..2f0aa3055@@ -0,0 +1,46 @@+// The TypeScript version this repo is developed and type-checked against.+// Newer major versions (e.g. TS 7) are not yet supported by Vue's language+// tools, so the playground must not default to npm's `latest` tag.+import { version as repoTypeScriptVersion } from 'typescript/package.json'++export const DEFAULT_TYPESCRIPT_VERSION: string = repoTypeScriptVersion++const parseMajor = (v: string): number => parseInt(v, 10)++const SUPPORTED_TYPESCRIPT_MAJOR = parseMajor(DEFAULT_TYPESCRIPT_VERSION)++// Non-numeric specifiers (e.g. dist-tags) can't be judged and are treated as+// supported.+export function isTypeScriptVersionSupported(version: string): boolean {+  const major = parseMajor(version)+  return Number.isNaN(major) || major <= SUPPORTED_TYPESCRIPT_MAJOR+}++export function filterVersions(pkg: string, versions: string[]): string[] {+  if (pkg === 'vue') {+    // If the latest Vue version is a pre-release, include up to 10 of the+    // current pre-releases so stable releases still have room in the list.+    // Once a stable release is reached, skip all older pre-releases.+    let isInPreRelease = versions[0].includes('-')+    let preReleaseCount = 0+    const filteredVersions: string[] = []+    for (const v of versions) {+      if (v.includes('-')) {+        if (isInPreRelease && preReleaseCount < 10) {+          filteredVersions.push(v)+          preReleaseCount+++        }+      } else {+        filteredVersions.push(v)+        isInPreRelease = false+      }+      if (filteredVersions.length >= 30) {+        break+      }+    }+    return filteredVersions+  } else if (pkg === 'typescript') {+    return versions.filter(v => !v.includes('dev') && !v.includes('insiders'))+  }+  return versions+} 
Merged fix · PR #15219+3 −0
packages-private/sfc-playground/src/App.vueindex 7020211f4..5a87a1d1d 100644@@ -14,6 +14,8 @@ setVH()  const useSSRMode = ref(false) +const DEFAULT_TYPESCRIPT_VERSION = '6.0.3'+ const AUTO_SAVE_STORAGE_KEY = 'vue-sfc-playground-auto-save' const initAutoSave: boolean = JSON.parse(   localStorage.getItem(AUTO_SAVE_STORAGE_KEY) ?? 'true',@@ -69,6 +71,7 @@ const store = useStore(   {     builtinImportMap: importMap,     vueVersion,+    typescriptVersion: ref(DEFAULT_TYPESCRIPT_VERSION),     sfcOptions,   },   hash,