Skip to content

Commit ae8e9ba

Browse files
committed
[Telemetry] Cleanup unnecessary comments
1 parent 42fde86 commit ae8e9ba

6 files changed

Lines changed: 1 addition & 24 deletions

File tree

src/telemetry/clearcut-logger.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ export class ClearcutLogger {
9696
},
9797
});
9898

99-
// Update persistence
10099
state.lastActive = new Date().toISOString();
101100
await this.#persistence.saveState(state);
102101
}

src/telemetry/watchdog-client.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@ export class WatchdogClient {
4141
const spawner = options?.spawn ?? spawn;
4242
this.#childProcess = spawner(process.execPath, args, {
4343
stdio: ['pipe', 'ignore', 'ignore'],
44-
detached: false, // Keep attached to parent lifecycle generally, but unref to not block exit
44+
detached: false,
4545
});
4646

47-
// Don't let the watchdog keep the main process alive
4847
this.#childProcess.unref();
4948

5049
this.#childProcess.on('error', (err) => {

src/telemetry/watchdog/clearcut-sender.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ export class ClearcutSender {
3030
this.transport(enrichedEvent);
3131
}
3232

33-
// Public for stubbing in tests
3433
transport(event: ChromeDevToolsMcpExtension): void {
3534
logger('Telemetry event', JSON.stringify(event, null, 2));
3635
}
3736

3837
async sendShutdownEvent(): Promise<void> {
39-
// CRITICAL: Do not include flag_usage
4038
const shutdownEvent: ChromeDevToolsMcpExtension = {
4139
server_shutdown: {},
4240
};
@@ -56,8 +54,6 @@ export class ClearcutSender {
5654
session_id: this.#sessionId,
5755
app_version: this.#appVersion,
5856
os_type: this.#osType,
59-
// client_info.client_type could be added here if we passed it in constructor or knew it
60-
// but strictly following plan, we populate these specific fields.
6157
};
6258
}
6359
}

src/telemetry/watchdog/main.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
/**
8-
* See IMPLEMENTATION_PLAN.md for details
9-
*/
107

118
import process from 'node:process';
129
import readline from 'node:readline';
@@ -54,12 +51,8 @@ async function main() {
5451

5552
const sender = new ClearcutSender(argv.appVersion, argv.osType as OsType);
5653

57-
// === Death Detection ===
58-
// We rely on Stdin pipe closing to detect parent death.
59-
// This works even with `kill -9` on the parent.
6054
function onParentDeath(reason: string) {
6155
logger(`Parent death detected (${reason}). Sending shutdown event...`);
62-
// We can't await here effectively in all cases, but we try our best.
6356
sender
6457
.sendShutdownEvent()
6558
.then(() => {
@@ -75,10 +68,8 @@ async function main() {
7568
process.stdin.on('end', () => onParentDeath('stdin end'));
7669
process.stdin.on('close', () => onParentDeath('stdin close'));
7770

78-
// Double check disconnection if spawned with IPC channel (not strictly required by plan but good practice)
7971
process.on('disconnect', () => onParentDeath('ipc disconnect'));
8072

81-
// === IPC Handling ===
8273
const rl = readline.createInterface({
8374
input: process.stdin,
8475
terminal: false,

tests/telemetry/watchdog-client.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ describe('WatchdogClient', () => {
1919
let mockChildProcess: ChildProcess & {stdin: Writable; kill: sinon.SinonStub};
2020

2121
beforeEach(() => {
22-
// Mock child process
2322
const eventEmitter = new EventEmitter();
2423
const stdin = new Writable({
2524
write(_chunk, _encoding, callback) {
2625
callback();
2726
}
2827
});
29-
// Use stub instead of spy to allow throws()
3028
sinon.stub(stdin, 'write');
3129

3230
mockChildProcess = Object.assign(eventEmitter, {
@@ -55,11 +53,8 @@ describe('WatchdogClient', () => {
5553

5654
assert.strictEqual(spawnStub.calledOnce, true);
5755
const args = spawnStub.firstCall.args;
58-
// args[0] is process.execPath
59-
// args[1] is arguments array
6056
const cmdArgs = args[1];
6157

62-
// Check main arg structure - we expect path to main.js as first arg
6358
assert.match(cmdArgs[0], /watchdog\/main\.js$/);
6459
assert.strictEqual(cmdArgs.includes('--parent-pid=100'), true);
6560
assert.strictEqual(cmdArgs.includes('--app-version=1.2.3'), true);

tests/telemetry/watchdog/clearcut-sender.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,13 @@ describe('ClearcutSender', () => {
4747
const sender = new ClearcutSender('1.0.0', OsType.OS_TYPE_MACOS);
4848
const transportStub = sinon.stub(sender, 'transport');
4949

50-
// First call -> session uuid-1
5150
await sender.send({});
5251
assert.strictEqual(transportStub.lastCall.args[0].session_id, 'uuid-1');
5352

54-
// Advance time by 23 hours -> should NOT rotate
5553
clock.tick(23 * 60 * 60 * 1000);
5654
await sender.send({});
5755
assert.strictEqual(transportStub.lastCall.args[0].session_id, 'uuid-1');
5856

59-
// Advance time by 2 hours (total 25h) -> SHOULD rotate
6057
clock.tick(2 * 60 * 60 * 1000);
6158
await sender.send({});
6259
assert.strictEqual(transportStub.lastCall.args[0].session_id, 'uuid-2');

0 commit comments

Comments
 (0)