Skip to content

Commit cea1a5b

Browse files
nedtwiggclaude
andcommitted
Drop the endpoint test the derived name no longer reaches
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c9baad3 commit cea1a5b

1 file changed

Lines changed: 3 additions & 25 deletions

File tree

‎vscode-ext/test/peer-endpoint.test.ts‎

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@
99
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
1010
import { spawn } from 'node:child_process';
1111
import { createHmac } from 'node:crypto';
12-
import { mkdir, mkdtemp, readFile, stat, writeFile } from 'node:fs/promises';
12+
import { mkdtemp, readFile, stat, writeFile } from 'node:fs/promises';
1313
import { createServer, type Server, type Socket } from 'node:net';
14-
import { dirname, join } from 'node:path';
14+
import { join } from 'node:path';
1515

1616
import {
1717
FrameDecoder,
1818
PEER_SERVER_PROOF_DOMAIN,
1919
encodeFrame,
2020
} from '../src/peer-link-protocol';
2121
import {
22-
derivedSocketPath,
2322
fakeContext,
2423
fakeWindow,
2524
freshModule,
@@ -149,13 +148,12 @@ describe('published endpoint', () => {
149148
for (const name of names) expect(name).toMatch(/^\\\\\.\\pipe\\dormouse-peer-[0-9a-f]{32}$/);
150149
});
151150

152-
it('binds a fresh name for every broker, never the derived one, and retracts it on close', async () => {
151+
it('binds a fresh name for every broker and retracts it on close', async () => {
153152
const first = await openWindow();
154153
await first.ensurePeerNet(() => {});
155154
expect(first.isPeerBroker()).toBe(true);
156155
const firstName = await published();
157156
expect(firstName).toBeTruthy();
158-
expect(firstName).not.toBe(derivedSocketPath(dir));
159157

160158
// Windows that need the broker find it through the file.
161159
const peer = await openWindow(fakeWindow({ entries: [{ surfaceId: 'far-1' }] }));
@@ -172,7 +170,6 @@ describe('published endpoint', () => {
172170
const secondName = await published();
173171
expect(secondName).toBeTruthy();
174172
expect(secondName).not.toBe(firstName);
175-
expect(secondName).not.toBe(derivedSocketPath(dir));
176173
}, 15_000);
177174

178175
it.skipIf(process.platform === 'win32')('publishes the name in a file only this user can read', async () => {
@@ -181,25 +178,6 @@ describe('published endpoint', () => {
181178
expect((await stat(endpointFile())).mode & 0o777).toBe(0o600);
182179
});
183180

184-
it('is not held off by another account that took the derived name first', async () => {
185-
// The squat this design closes: anything can sit on the derived name, and
186-
// a new build brokers on its own fresh name regardless.
187-
const squatted: Socket[] = [];
188-
const squatter = createServer((socket) => void squatted.push(socket));
189-
const legacy = derivedSocketPath(dir);
190-
if (process.platform !== 'win32') await mkdir(dirname(legacy), { recursive: true, mode: 0o700 });
191-
await listen(squatter, legacy);
192-
193-
const broker = await openWindow();
194-
const peer = await openWindow(fakeWindow({ entries: [{ surfaceId: 'far-1' }] }));
195-
await broker.ensurePeerNet(() => {});
196-
await peer.ensurePeerNet(() => {});
197-
expect(broker.isPeerBroker()).toBe(true);
198-
expect(reachesBroker(peer)).toBe(true);
199-
expect(await broker.remoteRequest('directory', {})).toEqual([{ surfaceId: 'far-1' }]);
200-
for (const socket of squatted) socket.destroy();
201-
}, 15_000);
202-
203181
it('retires a stale file naming a broker that is gone', async () => {
204182
const dead = spareName();
205183
await publish(dead, await deadPid());

0 commit comments

Comments
 (0)