Skip to content

Commit 64946f8

Browse files
bmiddhaCopilot
andcommitted
refactor(playwright-browser-tunnel): eliminate TS-private status setter
Replace the mixed-visibility 'public get status() / private set status()' accessor pair with a public 'get status()' plus a native private method '#setStatus(newStatus)'. Native ECMAScript private accessors require the getter and setter to share one name with uniform visibility, so the private setter could not be converted to a same-named '#status' accessor without colliding with the existing '#status' backing field. Renaming the mutator to a private method sidesteps that restriction while keeping the public read-only getter contract unchanged. Updated all 5 internal 'this.status = <value>' assignments to 'this.#setStatus(<value>)'. This removes the last remaining TS 'private' class member across the requested conversion scopes; only the two previously-documented unsafe members (rush-buildxl-graph-plugin's declare-only '_configHash' and AmazonS3Client's reflection-accessed '_writeWarningLine') remain TS-private by design. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8ebd5bf2-c44b-42d5-be25-e7936d4b0a14
1 parent f2ebc7c commit 64946f8

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

apps/playwright-browser-tunnel/src/PlaywrightBrowserTunnel.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ export class PlaywrightTunnel {
136136
return this.#status;
137137
}
138138

139-
// eslint-disable-next-line @typescript-eslint/naming-convention
140-
private set status(newStatus: TunnelStatus) {
139+
#setStatus(newStatus: TunnelStatus): void {
141140
this.#status = newStatus;
142141
this.#onStatusChange(newStatus);
143142
}
@@ -524,7 +523,7 @@ export class PlaywrightTunnel {
524523
let client: WebSocket | undefined = undefined;
525524
let browserServer: BrowserServer | undefined = undefined;
526525

527-
this.status = 'waiting-for-connection';
526+
this.#setStatus('waiting-for-connection');
528527
const ws: WebSocket =
529528
this.#mode === 'poll-connection'
530529
? await this.#pollConnectionAsync()
@@ -543,7 +542,7 @@ export class PlaywrightTunnel {
543542
const reasonStr: string = reason.toString() || 'no reason provided';
544543
const codeDescription: string = getWebSocketCloseReason(code);
545544
this.#initWsPromise = undefined;
546-
this.status = 'stopped';
545+
this.#setStatus('stopped');
547546
this.#terminal.writeLine(
548547
`WebSocket connection closed - code: ${code} (${codeDescription}), reason: ${reasonStr}`
549548
);
@@ -580,7 +579,7 @@ export class PlaywrightTunnel {
580579
terminal.writeLine('User approved browser server launch.');
581580
}
582581

583-
this.status = 'setting-up-browser-server';
582+
this.#setStatus('setting-up-browser-server');
584583
const browserServerProxy: IBrowserServerProxy =
585584
await this.#getPlaywrightBrowserServerProxyAsync(handshake);
586585
client = browserServerProxy.client;
@@ -600,7 +599,7 @@ export class PlaywrightTunnel {
600599
terminal.writeDebugLine('Warning: Browser server process handle not available for monitoring');
601600
}
602601

603-
this.status = 'browser-server-running';
602+
this.#setStatus('browser-server-running');
604603

605604
// Send ack so that the counterpart also knows to start forwarding messages.
606605
// NOTE: The 1-second delay is an intentional workaround. In the current
@@ -623,7 +622,7 @@ export class PlaywrightTunnel {
623622
resolve(ws);
624623
} catch (error) {
625624
terminal.writeLine(`Error processing handshake: ${error}`);
626-
this.status = 'error';
625+
this.#setStatus('error');
627626

628627
// Cleanup and close connection on error
629628
ws.off('message', onMessageHandler);

0 commit comments

Comments
 (0)