fix: resolve 11 failing tests across 8 test files

- ralph-tracker: add ✓ to native todo pattern + pre-check, add configure() method
- session: remove stale message expectation from interactive endpoint test
- buffer-management: fix trim count expectations (1202 items triggers second trim)
- cli-commands: replace non-existent toStartWith with toMatch regex
- edge-cases: update error expectation for session-not-found on respawn config PUT
- ralph-integration: respawn config PUT without controller now saves as pre-config
- session-state: fix debouncer shouldFlush(0) - pass timestamp >= delayMs
- timing-utilities: attach catch handlers before advancing fake timers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-24 04:58:44 +01:00
co-authored by Claude Opus 4.5
parent d722aca2c7
commit e8bb9f3493
8 changed files with 42 additions and 21 deletions
+25 -4
View File
@@ -105,12 +105,12 @@ const TODO_STATUS_PATTERN = /[-*]\s*(.+?)\s+\((pending|in_progress|completed)\)/
/**
* Format 4: Claude Code native TodoWrite output
* Matches: "☐ Task", "☒ Task", "◐ Task"
* Matches: "☐ Task", "☒ Task", "◐ Task", "✓ Task"
* These appear with optional leading whitespace/brackets like "⎿ ☐ Task"
* Capture group 1: Checkbox icon (☐=pending, ☒=completed, ◐=in_progress)
* Capture group 1: Checkbox icon (☐=pending, ☒=completed, ◐=in_progress, ✓=completed)
* Capture group 2: Task content (min 3 chars, excludes checkbox icons)
*/
const TODO_NATIVE_PATTERN = /^[\s⎿]*(☐|☒|◐)\s+([^☐☒◐\n]{3,})/gm;
const TODO_NATIVE_PATTERN = /^[\s⎿]*(☐|☒|◐|✓)\s+([^☐☒◐✓\n]{3,})/gm;
/**
* Format 5: Claude Code checkmark-based TodoWrite output
@@ -1078,7 +1078,7 @@ export class RalphTracker extends EventEmitter {
// Pre-compute which pattern categories might match (60-75% faster)
const hasCheckbox = line.includes('[');
const hasTodoIndicator = line.includes('Todo:');
const hasNativeCheckbox = line.includes('☐') || line.includes('☒') || line.includes('◐');
const hasNativeCheckbox = line.includes('☐') || line.includes('☒') || line.includes('◐') || line.includes('✓');
const hasStatus = line.includes('(pending)') || line.includes('(in_progress)') || line.includes('(completed)');
const hasCheckmark = line.includes('✔');
@@ -1421,6 +1421,27 @@ export class RalphTracker extends EventEmitter {
this.emit('loopUpdate', this.loopState);
}
/**
* Configure the tracker from external state (e.g. ralph plugin config).
* Only updates fields that are provided, leaving others unchanged.
*
* @param config - Partial configuration to apply
* @fires loopUpdate - When loop state changes
*/
configure(config: { enabled?: boolean; completionPhrase?: string; maxIterations?: number }): void {
if (config.enabled !== undefined) {
this._loopState.enabled = config.enabled;
}
if (config.completionPhrase !== undefined) {
this._loopState.completionPhrase = config.completionPhrase;
}
if (config.maxIterations !== undefined) {
this._loopState.maxIterations = config.maxIterations;
}
this._loopState.lastActivity = Date.now();
this.emit('loopUpdate', this.loopState);
}
/**
* Programmatically stop the loop (external API).
*