Repository navigation
Fall back to the built-in diff when @vscode/diff fails - #346266
Merged
Merged
Conversation
Only applies to the package backends (`advanced-external`, `advanced-wasm`), which users only get through the setting or an experiment. The default `advanced` is unchanged. - If the package throws, the worker reports the error and computes the diff with the built-in algorithm instead. - If a sampled verification (`diffEditor.experimental.verifyDiffSampleRate`) finds the package's diff invalid, the built-in diff is shown instead. Unsampled diffs are not checked, so there is no extra cost per diff. - `diffEditor.computeDiff` telemetry gets `fallback` (none, error, invalid), so the failure rate of the package can be measured per arm. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Line snapshots taken before backend initialization can become stale during model updates, causing returned diffs to disagree with live-model identity checks.
1 open issue
What changed in this PR
Adds built-in diff fallback for the experimental @vscode/diff backends, reducing rollout risk while leaving the default algorithm unchanged.
Changes:
- Falls back when package initialization or computation throws, or sampled verification detects an invalid diff.
- Propagates fallback reasons through worker results into diff telemetry.
- Adds tests for error fallback, sampled invalidity, and built-in algorithm behavior.
| File | Description |
|---|---|
src/vs/editor/test/common/services/editorWebWorker.test.ts |
Tests fallback behavior and error reporting. |
src/vs/editor/common/services/editorWorker.ts |
Adds fallback metadata to the worker result contract. |
src/vs/editor/common/services/editorWebWorker.ts |
Implements package-backend fallback and verification. |
src/vs/editor/common/diff/documentDiffProvider.ts |
Defines fallback reasons and document diff metadata. |
src/vs/editor/browser/widget/diffEditor/diffProviderFactoryService.ts |
Records fallback reasons in telemetry. |
src/vs/editor/browser/services/editorWorkerService.ts |
Carries fallback metadata into document diff results. |
Review effort: Balanced
Christof Marti (chrmarti)
previously approved these changes
Nov 5, 2026
`editorWebWorker.ts` is included as a whole into `monaco.d.ts` (`#includeAll`), so the new fallback helper and its result type became Monaco API and failed `monacodts-check`. They now live in `common/diff/linesDiffWithFallback.ts`; the worker passes its algorithm resolver in. Co-authored-by: Copilot <[email protected]>
Federico Brancasi (federicobrancasi)
previously approved these changes
Nov 5, 2026
Loading `@vscode/diff` awaits, and model updates can arrive meanwhile. The lines were snapshotted before that await, but `identical` is computed from the live models afterwards, so an edit during the first load could produce a diff without changes that is not marked identical. `resolveLinesDiffComputerWithFallback` now only resolves the backend (falling back on load errors) and returns a synchronous compute function; the worker reads the models after the await, as before #346266. A test edits a model while the backend is still loading. Co-authored-by: Copilot <[email protected]>
roblourens
approved these changes
Nov 5, 2026
Federico Brancasi (federicobrancasi)
approved these changes
Nov 5, 2026
Henning Dieterichs (hediet)
added a commit
that referenced
this pull request
Nov 10, 2026
<!-- Thank you for submitting a Pull Request. Please: * Read our Pull Request guidelines: https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests * Associate an issue with the Pull Request. * Ensure that the code is up-to-date with the `main` branch. * Include a description of the proposed changes and how to test them. --> The diff editor loads `@vscode/diff` at runtime from `node_modules` (`externalLinesDiffComputer.ts`, via `resolveAmdNodeModulePath`), like `@vscode/tree-sitter-wasm` and `vscode-oniguruma`, so the bundler leaves it alone and the package can load its `.wasm` next to itself. Desktop ships the root `node_modules`, but web and server builds only ship the dependencies of `remote/web/package.json` and `remote/package.json`, and `@vscode/diff` was only in the root `package.json`. So with `diffEditor.diffAlgorithm` set to `advanced-external` or `advanced-wasm`, the package fails to load on vscode.dev, Codespaces and the server, and the built-in algorithm is used instead (reported as `fallback: error` in `diffEditor.computeDiff`, added in #346266). This adds `@vscode/diff` at the root's version to both manifests and the `remote` lockfile. The hygiene check (`checkPackageJSON` in `build/gulpfile.hygiene.ts`) keeps the versions equal to the root's. Validation: - `pnpm install --lockfile-only --frozen-lockfile` in `remote`: passed (lockfile up to date, supply-chain policies pass). The lockfile entry has the same integrity as the root lockfile's. - Not run locally: a web or server build. To test, set `diffEditor.diffAlgorithm` to `advanced-wasm` in a vscode.dev or server build of this PR and open a diff; it should no longer log a fallback.
1 task
Matt Van Horn (mvanhorn)
pushed a commit
to mvanhorn/camunda
that referenced
this pull request
Nov 26, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [monaco-editor](https://redirect.github.com/microsoft/monaco-editor) | [`0.55.1` → `0.58.0`](https://renovatebot.com/diffs/npm/monaco-editor/0.55.1/0.58.0) |  |  | --- > [!WARNING] > Some dependencies could not be looked up. Check the [Dependency Dashboard](..camunda/issues/12605) for more information. --- ### Release Notes <details> <summary>microsoft/monaco-editor (monaco-editor)</summary> ### [`v0.58.0`](https://redirect.github.com/microsoft/monaco-editor/blob/HEAD/CHANGELOG.md#0580) [Compare Source](https://redirect.github.com/microsoft/monaco-editor/compare/v0.57.0...v0.58.0) ##### Breaking Changes - Markdown rendered by the editor (hovers, suggestion details, parameter hints, inline completion warnings, editor messages) no longer loads remote images by default. `data:` images are still shown. Use the new `markdownImages.allowedOrigins` editor option to allow images from specific origins (for example `['https://img.shields.io']`), or set it to `true` to allow all remote images as before. ##### Fixes - Fires configuration change events when tab focus mode is toggled, and keeps per-editor `tabFocusMode` overrides ([#&camunda#8203;4740](https://redirect.github.com/microsoft/monaco-editor/issues/4740), [microsoft/vscode#345251](https://redirect.github.com/microsoft/vscode/pull/345251), [microsoft/vscode#349316](https://redirect.github.com/microsoft/vscode/pull/349316)). - Bundles the `@vscode/diff` backend in the editor worker, so the `advanced-external` diff algorithm works in bundled applications (`advanced-wasm` uses the same TypeScript backend in the standalone editor), and falls back to the built-in diff when it fails ([microsoft/vscode#348527](https://redirect.github.com/microsoft/vscode/pull/348527), [microsoft/vscode#346266](https://redirect.github.com/microsoft/vscode/pull/346266)). - Fixes memory leaks in the word highlighter and color picker, and reduces idle CPU usage by disabling the native caret blink in EditContext. - Fixes `findWithArgs` ignoring empty search strings, UTF-16 column counts in text lengths, stale format-on-type requests, and auto-closed pair tracking for suggestion edits. - Fixes several minimap rendering issues (slider behavior with view zones, section headers, background, sizing on high-DPI screens). ##### Updates - Updates the editor core to VS Code commit `c132f72ae9f5ff80093e7d722c36f03755865b20`, validated in `0.58.0-rc.2`. - Adds `@vscode/diff` 0.0.2-145 as a dependency. - Updates bundled DOMPurify from 3.4.15 to 3.4.17. ### [`v0.57.0`](https://redirect.github.com/microsoft/monaco-editor/blob/HEAD/CHANGELOG.md#0570) [Compare Source](https://redirect.github.com/microsoft/monaco-editor/compare/v0.56.0...v0.57.0) ##### New Features and APIs - Adds `editor.wordWrapIndicator` to display an indicator at the wrapping column of soft-wrapped lines. - Adds `editor.fullwidthCharacterWidth`, with `font` and `twoCells` modes for rendering full-width characters. - Adds `languages.score` to score a language selector against a URI and language. - Exports the `editor.DiffEditorViewMode` type. - Adds `isForAnotherDocument` to the inline completion `languages.LifetimeSummary` type. ##### Updates - Updates the editor core to VS Code commit `6a598d4a13031703d483d103c1d934a36ad27971`, validated in `0.57.0-rc.2`. - Updates bundled DOMPurify from 3.4.8 to 3.4.15. ### [`v0.56.0`](https://redirect.github.com/microsoft/monaco-editor/blob/HEAD/CHANGELOG.md#0560) [Compare Source](https://redirect.github.com/microsoft/monaco-editor/compare/v0.55.1...v0.56.0) ##### Breaking Changes - Reorganizes the exported ESM modules to provide supported, tree-shakeable entry points ([#&camunda#8203;5155](https://redirect.github.com/microsoft/monaco-editor/pull/5155)). The `monaco-editor` entry point continues to load all features and languages. Custom bundles can now import `monaco-editor/editor` and opt into: - all editor features with `monaco-editor/features/register.all`, or individual features with `monaco-editor/features/<feature>/register`; - all language definitions with `monaco-editor/languages/definitions/register.all`, or individual definitions with `monaco-editor/languages/definitions/<language>/register`; - the CSS, HTML, JSON, and TypeScript language features with `monaco-editor/languages/features/register.all`, or their individual `register` entry points. - Renames the misspelled `IOverlayWidgetPosition.stackOridinal` property to `stackOrdinal`. - Removes the deprecated `IMirrorModel` and `IWorkerContext` worker API types. ##### New Features and APIs - Adds `editor.doubleClickSelectsBlock`. - Adds `editor.find.closeOnResult` and `editor.inlayHints.showLongLineWarning`. - Adds `offWhenInlineCompletions` to `QuickSuggestionsValue`. - Adds model and provider option support to inline completion providers. - Adds `ICodeEditor.revealAllCursors`, `ICodeEditor.getWidthOfLine`, and `ICodeEditor.renderAsync`. - Adds `advanced-external` and `advanced-wasm` diff algorithms. - Exposes typed native LSP client and transport APIs. ##### Fixes - Treats Markdown returned by language servers as untrusted ([#&camunda#8203;5280](https://redirect.github.com/microsoft/monaco-editor/pull/5280)). - Updates the editor core to the version used by `0.56.0-dev-20260625`. </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At 08:00 PM through 11:59 PM and 12:00 AM through 08:59 AM, Monday through Friday (`* 20-23,0-8 * * 1-5`) - Only on Sunday and Saturday (`* * * * 0,6`) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/camunda/camunda). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yNjIuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjI2Mi4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhcmVhL2Zyb250ZW5kIiwiYXV0b21lcmdlIiwiZGVwZW5kZW5jaWVzIl19-->
renovate Bot
added a commit
to Arbeidstilsynet/brevgen2
that referenced
this pull request
Nov 27, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [monaco-editor](https://redirect.github.com/microsoft/monaco-editor) | [`0.57.0` → `0.58.0`](https://renovatebot.com/diffs/npm/monaco-editor/0.57.0/0.58.0) |  |  | --- > [!WARNING] > Some dependencies could not be looked up. Check the [Dependency Dashboard](../issues/24) for more information. --- ### Release Notes <details> <summary>microsoft/monaco-editor (monaco-editor)</summary> ### [`v0.58.0`](https://redirect.github.com/microsoft/monaco-editor/blob/HEAD/CHANGELOG.md#0580) [Compare Source](https://redirect.github.com/microsoft/monaco-editor/compare/v0.57.0...v0.58.0) ##### Breaking Changes - Markdown rendered by the editor (hovers, suggestion details, parameter hints, inline completion warnings, editor messages) no longer loads remote images by default. `data:` images are still shown. Use the new `markdownImages.allowedOrigins` editor option to allow images from specific origins (for example `['https://img.shields.io']`), or set it to `true` to allow all remote images as before. ##### Fixes - Fires configuration change events when tab focus mode is toggled, and keeps per-editor `tabFocusMode` overrides ([#​4740](https://redirect.github.com/microsoft/monaco-editor/issues/4740), [microsoft/vscode#345251](https://redirect.github.com/microsoft/vscode/pull/345251), [microsoft/vscode#349316](https://redirect.github.com/microsoft/vscode/pull/349316)). - Bundles the `@vscode/diff` backend in the editor worker, so the `advanced-external` diff algorithm works in bundled applications (`advanced-wasm` uses the same TypeScript backend in the standalone editor), and falls back to the built-in diff when it fails ([microsoft/vscode#348527](https://redirect.github.com/microsoft/vscode/pull/348527), [microsoft/vscode#346266](https://redirect.github.com/microsoft/vscode/pull/346266)). - Fixes memory leaks in the word highlighter and color picker, and reduces idle CPU usage by disabling the native caret blink in EditContext. - Fixes `findWithArgs` ignoring empty search strings, UTF-16 column counts in text lengths, stale format-on-type requests, and auto-closed pair tracking for suggestion edits. - Fixes several minimap rendering issues (slider behavior with view zones, section headers, background, sizing on high-DPI screens). ##### Updates - Updates the editor core to VS Code commit `c132f72ae9f5ff80093e7d722c36f03755865b20`, validated in `0.58.0-rc.2`. - Adds `@vscode/diff` 0.0.2-145 as a dependency. - Updates bundled DOMPurify from 3.4.15 to 3.4.17. </details> --- ### Configuration 📅 **Schedule**: (in timezone Europe/Oslo) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/Arbeidstilsynet/brevgen2). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yNjIuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjI2Mi4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

Makes the
@vscode/diffbackends unable to show a worse diff than the built-in algorithm would, so they can be rolled out through an experiment with less risk. This is goal G3 of the diff migration.Only the package backends (
advanced-external,advanced-wasm) are affected. Users only get them throughdiffEditor.diffAlgorithmor an experiment; the defaultadvancedpath is unchanged and does no extra work.Changes
onUnexpectedError) and computes the diff with the built-in algorithm instead. No cost when nothing fails.diffEditor.experimental.verifyDiffSampleRate, default 0, set by the experiment) finds the package's diff invalid, the built-in diff is shown instead. Unsampled diffs are not checked, so there is no extra cost per diff.diffEditor.computeDiffgetsfallback(none,error,invalid), so the failure rate of the package can be measured per experiment arm. After a fallback,validitydescribes the built-in diff andtimeMsincludes the fallback computation.resolveLinesDiffComputerWithFallback(common/diff/linesDiffWithFallback.ts, not ineditorWebWorker.ts, whose declarations are all part ofmonaco.d.ts). It resolves the backend asynchronously and returns a synchronous compute function, so the worker reads the models only after the backend has loaded, as before.IDocumentDiffand the worker result carry the new optionalfallbackfield.Validation
scripts\test.bat --run src/vs/editor/test/common/services/editorWebWorker.test.ts --run src/vs/editor/test/node/diffing/fixtures.test.ts: 147 passing, including new tests: fallback when the package fails to load or throws (the error is reported), fallback on an invalid diff only when verifying, never for the built-in algorithms, and an edit that arrives while the backend is still loading (fails if the lines are read before the backend has loaded).npx tsc --noEmit -p src/tsconfig.json: no errors.pnpm run gulp monacodts-check: passes.pnpm run eslinton the changed files: clean.node build/checker/layersChecker.ts: passes.