refactor(compiler): remove unused runScript backupPath fallback#11312
Merged
Conversation
timotheeguerin
added a commit
that referenced
this pull request
Jul 20, 2026
commit: |
Contributor
|
All changed packages have been documented.
Show changes
|
timotheeguerin
marked this pull request as ready for review
July 20, 2026 18:03
timotheeguerin
requested review from
bterlson,
catalinaperalta,
iscai-msft,
markcowl and
witemple-msft
as code owners
July 20, 2026 18:03
|
You can try these changes here
|
iscai-msft
approved these changes
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the unused
backupPathfallback argument from the internalrunScripthelper (packages/compiler/src/runner.ts) and its two callers.runScript(relativePath, backupPath)used to fall back tobackupPathwhenrelativePathdid not exist under the resolved package root. Both call sites (cmd/tsp.js,cmd/tsp-server.js) always pass arelativePaththat exists, so the fallback (and itscheckFileExistshelper +accessimport) is dead code.This is a pure, self-contained cleanup extracted out of #11299 (standalone SEA rewrite) so that PR stays focused on the feature. The standalone CLI does not use
runScript.History / why it is safe to remove
The
backupPathfallback was added in #1410 and shipped in@cadl-lang/compiler0.38.2 (Dec 2022) as a patch: "Revert breaking change to global cli usage."That PR introduced the stable indirection entrypoints
entrypoints/cli.jsandentrypoints/server.js. Before 0.38.2 the global CLI booted the compiler directly atdist/core/cli/cli.js(anddist/server/server.js). Because a globally-installed CLI resolves and runs the locally-installed compiler, a global 0.38.2 CLI could hit an older local compiler that did not yet have theentrypoints/files. ThebackupPath(dist/core/cli/cli.js/dist/server/server.js) was the fallback so the global CLI could still boot those pre-0.38.2 local installs.Every supported compiler version has shipped
entrypoints/cli.js/entrypoints/server.jssince 0.38.2, so the fallback branch is now unreachable dead code.Changes
runner.ts:runScript(relativePath)— droppedbackupPathparam,checkFileExists, and the now-unusedaccessimport.cmd/tsp.js/cmd/tsp-server.js: drop the second argument.Validation
tsc -p packages/compiler/tsconfig.build.jsonpasses.