Skip to content

Commit 2305e7b

Browse files
author
catlog22
committed
feat(tests): add verification script for execution ID with output analysis
1 parent 48871f0 commit 2305e7b

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/**
2+
* Quick verification script for a specific execution ID
3+
*/
4+
5+
import { getHistoryStore } from '../src/tools/cli-history-store.js';
6+
7+
const executionId = process.argv[2];
8+
if (!executionId) {
9+
console.error('Usage: tsx verify-single-execution.ts <execution-id>');
10+
process.exit(1);
11+
}
12+
13+
const projectPath = 'D:\\Claude_dms3';
14+
const store = getHistoryStore(projectPath);
15+
const conversation = store.getConversationWithNativeInfo(executionId);
16+
17+
if (!conversation) {
18+
console.log(`❌ Execution not found: ${executionId}`);
19+
process.exit(1);
20+
}
21+
22+
console.log(`\n✅ Execution found: ${executionId}`);
23+
console.log(` Tool: ${conversation.tool}`);
24+
console.log(` Mode: ${conversation.mode}`);
25+
console.log(` Turns: ${conversation.turns.length}\n`);
26+
27+
if (conversation.turns.length > 0) {
28+
const turn = conversation.turns[0];
29+
const stdout = turn.output.stdout || '';
30+
const parsedOutput = turn.output.parsed_output || '';
31+
32+
console.log('📊 Output Analysis:');
33+
console.log(` stdout length: ${stdout.length}`);
34+
console.log(` parsed_output length: ${parsedOutput.length}\n`);
35+
36+
// Check if stdout is JSON lines
37+
const stdoutFirstLine = stdout.split('\n')[0]?.trim();
38+
let stdoutIsJson = false;
39+
if (stdoutFirstLine) {
40+
try {
41+
JSON.parse(stdoutFirstLine);
42+
stdoutIsJson = true;
43+
} catch {}
44+
}
45+
46+
// Check if parsed_output is JSON lines
47+
const parsedFirstLine = parsedOutput.split('\n')[0]?.trim();
48+
let parsedIsJson = false;
49+
if (parsedFirstLine) {
50+
try {
51+
JSON.parse(parsedFirstLine);
52+
parsedIsJson = true;
53+
} catch {}
54+
}
55+
56+
console.log('📝 Content Format:');
57+
console.log(` stdout: ${stdoutIsJson ? '⚠️ JSON lines' : '✅ Plain text'}`);
58+
console.log(` parsed_output: ${parsedIsJson ? '❌ JSON lines (BUG!)' : '✅ Plain text (CORRECT)'}\n`);
59+
60+
console.log('📄 First 150 chars of parsed_output:');
61+
console.log(` "${parsedOutput.substring(0, 150)}${parsedOutput.length > 150 ? '...' : ''}"\n`);
62+
63+
if (parsedIsJson) {
64+
console.log('❌ ISSUE: parsed_output still contains JSON lines!');
65+
} else {
66+
console.log('✅ SUCCESS: parsed_output contains plain text');
67+
}
68+
}

0 commit comments

Comments
 (0)