Skip to content

Commit f9bfd58

Browse files
authored
refactor: drop db migration patch (#5519)
* refactor: remove database migration patch & test Drop migration code since it's been 6 months since 4.0.2 and we no longer need this. See: #5482 (comment) * chore: refresh patches
1 parent ef3f4e8 commit f9bfd58

File tree

4 files changed

+9
-116
lines changed

4 files changed

+9
-116
lines changed

patches/disable-builtin-ext-update.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
1818
if (!this.local.preRelease && this.gallery.properties.isPreReleaseVersion) {
1919
return false;
2020
}
21-
@@ -1122,6 +1126,10 @@ export class ExtensionsWorkbenchService
21+
@@ -1122,6 +1126,10 @@ export class ExtensionsWorkbenchService
2222
// Skip if check updates only for builtin extensions and current extension is not builtin.
2323
continue;
2424
}

patches/telemetry.diff

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ Index: code-server/lib/vscode/src/vs/workbench/services/telemetry/browser/teleme
104104
- sendErrorTelemetry: this.sendErrorTelemetry,
105105
- };
106106
- this.impl = this._register(new BaseTelemetryService(config, configurationService, productService));
107+
-
108+
- if (getTelemetryLevel(configurationService) !== TelemetryLevel.NONE) {
109+
- // If we cannot fetch the endpoint it means it is down and we should not send any telemetry.
110+
- // This is most likely due to ad blockers
111+
- fetch(telemetryEndpointUrl, { method: 'POST' }).catch(err => {
112+
- this.impl = NullTelemetryService;
113+
- });
107114
+ const telemetryProvider: ITelemetryAppender | undefined = remoteAgentService.getConnection() !== null ? { log: remoteAgentService.logTelemetry.bind(remoteAgentService), flush: remoteAgentService.flushTelemetry.bind(remoteAgentService) } : productService.aiConfig?.ariaKey ? new OneDataSystemWebAppender(isInternal, 'monacoworkbench', null, productService.aiConfig?.ariaKey) : undefined;
108115
+ if (telemetryProvider) {
109116
+ appenders.push(telemetryProvider);
@@ -114,13 +121,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/telemetry/browser/teleme
114121
+ sendErrorTelemetry: this.sendErrorTelemetry,
115122
+ };
116123
+ this.impl = this._register(new BaseTelemetryService(config, configurationService, productService));
117-
118-
- if (getTelemetryLevel(configurationService) !== TelemetryLevel.NONE) {
119-
- // If we cannot fetch the endpoint it means it is down and we should not send any telemetry.
120-
- // This is most likely due to ad blockers
121-
- fetch(telemetryEndpointUrl, { method: 'POST' }).catch(err => {
122-
- this.impl = NullTelemetryService;
123-
- });
124+
+
124125
+ if (remoteAgentService.getConnection() === null && getTelemetryLevel(configurationService) !== TelemetryLevel.NONE) {
125126
+ // If we cannot fetch the endpoint it means it is down and we should not send any telemetry.
126127
+ // This is most likely due to ad blockers

patches/unique-db.diff

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ ensures that different browser paths will be unique (for example /workspace1 and
99
The easiest way to test is to open files in the same workspace using both / and
1010
/vscode and make sure they are not interacting with each other.
1111

12-
It should also migrate old databases which can be tested by opening in an old
13-
code-server.
14-
15-
This has e2e tests.
16-
1712
Index: code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
1813
===================================================================
1914
--- code-server.orig/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
@@ -39,29 +34,3 @@ Index: code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageS
3934
}
4035
}
4136

42-
@@ -141,6 +146,25 @@ export class BrowserStorageService exten
43-
44-
await this.workspaceStorage.init();
45-
46-
+ const firstWorkspaceOpen = this.workspaceStorage.getBoolean(IS_NEW_KEY);
47-
+ if (firstWorkspaceOpen === undefined) {
48-
+ // Migrate the old database.
49-
+ let db: IIndexedDBStorageDatabase | undefined
50-
+ try {
51-
+ db = await IndexedDBStorageDatabase.create({ id: this.payload.id }, this.logService)
52-
+ const items = await db.getItems()
53-
+ for (const [key, value] of items) {
54-
+ this.workspaceStorage.set(key, value);
55-
+ }
56-
+ } catch (error) {
57-
+ this.logService.error(`[IndexedDB Storage ${this.payload.id}] migrate error: ${toErrorMessage(error)}`);
58-
+ } finally {
59-
+ if (db) {
60-
+ db.close()
61-
+ }
62-
+ }
63-
+ }
64-
+
65-
this.updateIsNew(this.workspaceStorage);
66-
}
67-

test/e2e/codeServer.test.ts

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import * as cp from "child_process"
21
import { promises as fs } from "fs"
3-
import * as os from "os"
42
import * as path from "path"
5-
import * as util from "util"
63
import { getMaybeProxiedCodeServer } from "../utils/helpers"
74
import { describe, test, expect } from "./baseFixture"
85
import { CodeServer } from "./models/CodeServer"
@@ -17,30 +14,6 @@ describe("code-server", [], {}, () => {
1714
await Promise.all(procs.map((cs) => cs.close()))
1815
})
1916

20-
/**
21-
* Spawn a specific version of code-server using the install script.
22-
*/
23-
const spawn = async (version: string, dir?: string): Promise<CodeServer> => {
24-
let instance = instances.get(version)
25-
if (!instance) {
26-
await util.promisify(cp.exec)(`./install.sh --method standalone --version ${version}`, {
27-
cwd: path.join(__dirname, "../.."),
28-
})
29-
30-
instance = new CodeServer(
31-
"code-server@" + version,
32-
["--auth=none"],
33-
{ VSCODE_DEV: "" },
34-
dir,
35-
`${os.homedir()}/.local/lib/code-server-${version}`,
36-
)
37-
38-
instances.set(version, instance)
39-
}
40-
41-
return instance
42-
}
43-
4417
test("should navigate to home page", async ({ codeServerPage }) => {
4518
// We navigate codeServer before each test
4619
// and we start the test with a storage state
@@ -68,54 +41,4 @@ describe("code-server", [], {}, () => {
6841
await fs.writeFile(file, "bar")
6942
await codeServerPage.openFile(file)
7043
})
71-
72-
test("should migrate state to avoid collisions", async ({ codeServerPage }) => {
73-
// This can take a very long time in development because of how long pages
74-
// take to load and we are doing a lot of that here.
75-
if (process.env.VSCODE_DEV === "1") {
76-
test.slow()
77-
}
78-
79-
const dir = await codeServerPage.workspaceDir
80-
const files = [path.join(dir, "foo"), path.join(dir, "bar")]
81-
await Promise.all(
82-
files.map((file) => {
83-
return fs.writeFile(file, path.basename(file))
84-
}),
85-
)
86-
87-
// Open a file in the latest instance.
88-
await codeServerPage.openFile(files[0])
89-
await codeServerPage.stateFlush()
90-
91-
// Open a file in an older version of code-server. It should not see the
92-
// file opened in the new instance since the database has a different
93-
// name. This must be accessed through the proxy so it shares the same
94-
// domain and can write to the same database.
95-
const cs = await spawn("4.0.2", dir)
96-
const address = new URL(await cs.address())
97-
98-
await codeServerPage.navigate("/proxy/" + address.port + "/")
99-
await codeServerPage.openFile(files[1])
100-
expect(await codeServerPage.tabIsVisible(files[0])).toBe(false)
101-
await codeServerPage.stateFlush()
102-
103-
// Move back to latest code-server. We should see the file we previously
104-
// opened with it but not the old code-server file because the new instance
105-
// already created its own database on this path and will avoid migrating.
106-
await codeServerPage.navigate()
107-
await codeServerPage.waitForTab(files[0])
108-
expect(await codeServerPage.tabIsVisible(files[1])).toBe(false)
109-
110-
// Open a new path in latest code-server. This one should migrate the
111-
// database from old code-server but see nothing from the new database
112-
// created on the root.
113-
await codeServerPage.navigate("/vscode")
114-
await codeServerPage.waitForTab(files[1])
115-
expect(await codeServerPage.tabIsVisible(files[0])).toBe(false)
116-
// Should still be open after a reload.
117-
await codeServerPage.navigate("/vscode")
118-
await codeServerPage.waitForTab(files[1])
119-
expect(await codeServerPage.tabIsVisible(files[0])).toBe(false)
120-
})
12144
})

0 commit comments

Comments
 (0)