Skip to content

Commit 537a6b0

Browse files
author
nedtwigg
committed
Claude Code simplify: remove dead promoteTodo method and hoist duplicated clearRecoveryTimer in toggleTodo
1 parent 27261e2 commit 537a6b0

9 files changed

Lines changed: 4 additions & 29 deletions

File tree

lib/src/lib/alarm-manager.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,15 @@ describe('AlarmManager in isolation', () => {
266266
expect(manager.getState(id).todo).toBeCloseTo(0.5);
267267
});
268268

269-
it('promoting a partially-struck soft-TODO resets to hard', () => {
269+
it('marking a partially-struck soft-TODO as hard resets to hard', () => {
270270
const id = 'bucket-promote';
271271
createSoftTodo(id);
272272

273273
manager.drainTodoBucket(id);
274274
manager.drainTodoBucket(id);
275275
expect(manager.getState(id).todo).toBeCloseTo(0.5);
276276

277-
manager.promoteTodo(id);
277+
manager.markTodo(id);
278278
expect(manager.getState(id).todo).toBe(TODO_HARD);
279279
});
280280

@@ -347,7 +347,7 @@ describe('AlarmManager in isolation', () => {
347347
createSoftTodo(id);
348348

349349
// Promote to hard
350-
manager.promoteTodo(id);
350+
manager.markTodo(id);
351351
expect(manager.getState(id).todo).toBe(TODO_HARD);
352352

353353
// Drive to ALARM_RINGING again

lib/src/lib/alarm-manager.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,11 @@ export class AlarmManager {
237237
/** Toggle: off → hard, soft → hard, hard → off */
238238
toggleTodo(id: string): void {
239239
const entry = this.getOrCreateEntry(id);
240+
this.clearRecoveryTimer(entry);
240241
if (entry.todo === TODO_HARD) {
241-
this.clearRecoveryTimer(entry);
242242
entry.todo = TODO_OFF;
243243
this.notify(id);
244244
} else {
245-
this.clearRecoveryTimer(entry);
246245
entry.todo = TODO_HARD;
247246
if (entry.monitor?.getStatus() === 'ALARM_RINGING') {
248247
entry.monitor.attend();
@@ -266,15 +265,6 @@ export class AlarmManager {
266265
this.notify(id);
267266
}
268267

269-
/** Promote soft TODO to hard */
270-
promoteTodo(id: string): void {
271-
const entry = this.getOrCreateEntry(id);
272-
if (!isSoftTodo(entry.todo)) return;
273-
this.clearRecoveryTimer(entry);
274-
entry.todo = TODO_HARD;
275-
this.notify(id);
276-
}
277-
278268
/** Clear any TODO state */
279269
clearTodo(id: string): void {
280270
const entry = this.getOrCreateEntry(id);

lib/src/lib/platform/fake-adapter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ export class FakePtyAdapter implements PlatformAdapter {
147147
alarmClearAttention(id?: string): void { this.alarmManager.clearAttention(id); }
148148
alarmToggleTodo(id: string): void { this.alarmManager.toggleTodo(id); }
149149
alarmMarkTodo(id: string): void { this.alarmManager.markTodo(id); }
150-
alarmPromoteTodo(id: string): void { this.alarmManager.promoteTodo(id); }
151150
alarmClearTodo(id: string): void { this.alarmManager.clearTodo(id); }
152151
alarmDrainTodoBucket(id: string): void { this.alarmManager.drainTodoBucket(id); }
153152
onAlarmState(handler: (detail: AlarmStateDetail) => void): void { this.alarmStateHandlers.add(handler); }

lib/src/lib/platform/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export interface PlatformAdapter {
5555
alarmClearAttention(id?: string): void;
5656
alarmToggleTodo(id: string): void;
5757
alarmMarkTodo(id: string): void;
58-
alarmPromoteTodo(id: string): void;
5958
alarmClearTodo(id: string): void;
6059
alarmDrainTodoBucket(id: string): void;
6160
onAlarmState(handler: (detail: AlarmStateDetail) => void): void;

lib/src/lib/platform/vscode-adapter.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,6 @@ export class VSCodeAdapter implements PlatformAdapter {
203203
this.vscode.postMessage({ type: 'alarm:markTodo', id });
204204
}
205205

206-
alarmPromoteTodo(id: string): void {
207-
this.vscode.postMessage({ type: 'alarm:promoteTodo', id });
208-
}
209-
210206
alarmClearTodo(id: string): void {
211207
this.vscode.postMessage({ type: 'alarm:clearTodo', id });
212208
}

lib/src/lib/session-save.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ function createPlatform(savedState: PersistedSession | null): PlatformAdapter {
5050
alarmClearAttention: () => {},
5151
alarmToggleTodo: () => {},
5252
alarmMarkTodo: () => {},
53-
alarmPromoteTodo: () => {},
5453
alarmClearTodo: () => {},
5554
alarmDrainTodoBucket: () => {},
5655
onAlarmState: () => {},

standalone/src/tauri-adapter.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,6 @@ export class TauriAdapter implements PlatformAdapter {
205205
this.alarmManager.markTodo(id);
206206
}
207207

208-
alarmPromoteTodo(id: string): void {
209-
this.alarmManager.promoteTodo(id);
210-
}
211-
212208
alarmClearTodo(id: string): void {
213209
this.alarmManager.clearTodo(id);
214210
}

vscode-ext/src/message-router.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,6 @@ export function attachRouter(
298298
case 'alarm:markTodo':
299299
alarmManager.markTodo(msg.id);
300300
break;
301-
case 'alarm:promoteTodo':
302-
alarmManager.promoteTodo(msg.id);
303-
break;
304301
case 'alarm:clearTodo':
305302
alarmManager.clearTodo(msg.id);
306303
break;

vscode-ext/src/message-types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export type WebviewMessage =
2323
| { type: 'alarm:clearAttention'; id?: string }
2424
| { type: 'alarm:toggleTodo'; id: string }
2525
| { type: 'alarm:markTodo'; id: string }
26-
| { type: 'alarm:promoteTodo'; id: string }
2726
| { type: 'alarm:clearTodo'; id: string }
2827
| { type: 'alarm:drainTodoBucket'; id: string };
2928

0 commit comments

Comments
 (0)