OpenWriterControle/evals/framework/scripts/test/test-timeline.ts
darrenhinde f773b290ce chore(evals): comprehensive cleanup, documentation, and test infrastructure improvements
Documentation:
- Add ARCHITECTURE.md with comprehensive system review
- Add GETTING_STARTED.md for new users
- Add DOCUMENTATION_CLEANUP.md tracking cleanup changes
- Add SCRIPTS_ORGANIZATION.md documenting script reorganization
- Remove outdated docs (TESTING_CONFIDENCE.md, TEST_REVIEW.md, SESSION_STORAGE_FIX.md)
- Update README files with current information

Script Organization:
- Move 12 scripts from framework root to organized directories:
  - scripts/debug/ (4 files): Session debugging tools
  - scripts/test/ (6 files): Test execution scripts
  - scripts/utils/ (2 files): Utility scripts
- Add comprehensive scripts/README.md with usage examples

Test Infrastructure:
- Add 5 new context loading tests for openagent
- Add result-saver.ts for test result persistence
- Add interactive results dashboard (index.html)
- Add error-handling.test.ts for framework testing
- Add result-saver.test.ts with comprehensive unit tests

Evaluator Improvements:
- Enhance context-loading-evaluator with better detection
- Update run-sdk-tests.ts with improved result handling

Agent Configuration:
- Add .opencode/agent/AGENT.md for agent definition

Test Utilities:
- Add test-agent-manual.mjs for manual testing
- Update test_tmp/README.md with usage guidelines

This commit consolidates multiple improvements:
- Better organization (scripts, docs)
- Improved testing infrastructure
- Comprehensive documentation
- Cleaner codebase structure
2025-11-26 21:34:27 +00:00

68 lines
2.2 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Test script to verify timeline builder works with real session data
*/
import { SessionReader } from './src/collector/session-reader.js';
import { TimelineBuilder } from './src/collector/timeline-builder.js';
async function test() {
const reader = new SessionReader();
const builder = new TimelineBuilder(reader);
// Get sessions
const sessions = await reader.listSessions();
console.log('Total sessions:', sessions.length);
// Find a session with tools (check first 10)
for (const session of sessions.slice(0, 10)) {
console.log('\n--- Checking session:', session.id);
console.log(' Title:', session.title?.substring(0, 60));
const messagesWithParts = await reader.getMessagesWithParts(session.id);
console.log(' Messages:', messagesWithParts.length);
let toolCount = 0;
const toolNames: string[] = [];
for (const msg of messagesWithParts) {
for (const part of msg.parts || []) {
if (part.type === 'tool') {
toolCount++;
toolNames.push(part.tool);
}
}
}
console.log(' Tool parts in raw data:', toolCount);
if (toolNames.length > 0) {
console.log(' Tools:', [...new Set(toolNames)].join(', '));
}
if (toolCount > 0) {
// Build timeline and check
const timeline = await builder.buildTimeline(session.id);
const toolCalls = timeline.filter(e => e.type === 'tool_call');
console.log(' Timeline tool_call events:', toolCalls.length);
if (toolCalls.length > 0) {
console.log(' ✅ Timeline correctly captured tool calls!');
console.log(' First tool in timeline:', toolCalls[0].data?.tool);
} else {
console.log(' ❌ Timeline MISSING tool calls!');
}
// Found a session with tools, we can stop
console.log('\n=== VERIFICATION COMPLETE ===');
if (toolCalls.length === toolCount) {
console.log('✅ SUCCESS: Timeline correctly captures all tool calls');
} else {
console.log(`❌ MISMATCH: Raw data has ${toolCount} tools, timeline has ${toolCalls.length}`);
}
return;
}
}
console.log('\n⚠️ No sessions with tool calls found in first 10 sessions');
}
test().catch(console.error);