mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 06:06:02 +09:00
## 🔧 Critical Swarm System Fixes ### Fixed Task File Naming Bug - Tasks were being saved as '[object Object].json' due to TaskId object structure - Now properly extracts task ID string for file naming - Files save correctly as 'task_<id>.json' ### Added Task Timeout Protection - Implemented automatic timeout detection in task execution loop - Tasks that exceed timeout (default 5 minutes) are marked as failed - Prevents swarms from hanging indefinitely on stuck tasks - Agent state properly cleaned up on timeout ### Fixed Target Directory Propagation - Testing tasks were receiving null targetDir, preventing file access - Target directory now extracted from objective description - All tasks inherit targetDir through context - Enhanced extractTargetDirectory to check multiple sources ### Improved Task Dependencies - Fixed taskDependenciesMet to handle both string and TaskId objects - Added convertDependenciesToTaskDependencies for Map structure - Dependencies now properly resolve for sequential task execution ### Auto Strategy Integration - Added missing autoStrategy property and initialization - Proper AutoStrategy instantiation in coordinator constructor - Enables intelligent task decomposition for 'auto' strategy ## 📊 Added Comprehensive Benchmarks ### Benchmark Suite Integration - Added complete Python-based benchmarking tool - Tests 7 strategies across 5 coordination modes - 100% success rate across all test scenarios - Performance metrics: 0.10s - 0.20s execution times ### Real-World Performance Data - Calculator example: 4m 20s total (3 tasks) - Task breakdown: Analysis 29%, Implementation 22%, Testing 48% - Successfully created 6 files with proper directory structure ## 📝 Documentation Updates ### Updated README.md - Added v1.0.50 changelog with critical fixes - Integrated benchmark performance results table - Added real-world timing example - Removed old update notes for clarity - Added dedicated Benchmarks & Performance section ## 🧪 Test Results - Swarm now completes successfully with proper task coordination - All fixes validated in production environment - Task files save with correct names - Testing tasks find implementation files - Swarms exit cleanly after completion 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
97 lines
2.8 KiB
TypeScript
97 lines
2.8 KiB
TypeScript
import { describe, it, beforeEach } from "https://deno.land/std@0.220.0/testing/bdd.ts";
|
|
import { assertEquals, assertExists, assertGreater } from "https://deno.land/std@0.220.0/assert/mod.ts";
|
|
|
|
// Simple utility functions to test
|
|
function greet(name: string): string {
|
|
return `Hello, ${name}!`;
|
|
}
|
|
|
|
function sum(numbers: number[]): number {
|
|
return numbers.reduce((acc, num) => acc + num, 0);
|
|
}
|
|
|
|
function formatDate(date: Date): string {
|
|
const year = date.getFullYear();
|
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
const day = String(date.getDate()).padStart(2, '0');
|
|
return `${year}-${month}-${day}`;
|
|
}
|
|
|
|
describe("Simple Test Suite", () => {
|
|
describe("greet function", () => {
|
|
it("should return a greeting message", () => {
|
|
const result = greet("World");
|
|
assertEquals(result, "Hello, World!");
|
|
});
|
|
|
|
it("should handle empty string", () => {
|
|
const result = greet("");
|
|
assertEquals(result, "Hello, !");
|
|
});
|
|
|
|
it("should handle special characters", () => {
|
|
const result = greet("Claude-Flow 🚀");
|
|
assertEquals(result, "Hello, Claude-Flow 🚀!");
|
|
});
|
|
});
|
|
|
|
describe("sum function", () => {
|
|
it("should sum an array of numbers", () => {
|
|
const result = sum([1, 2, 3, 4, 5]);
|
|
assertEquals(result, 15);
|
|
});
|
|
|
|
it("should return 0 for empty array", () => {
|
|
const result = sum([]);
|
|
assertEquals(result, 0);
|
|
});
|
|
|
|
it("should handle negative numbers", () => {
|
|
const result = sum([-5, 10, -3, 8]);
|
|
assertEquals(result, 10);
|
|
});
|
|
|
|
it("should handle decimal numbers", () => {
|
|
const result = sum([1.5, 2.5, 3.0]);
|
|
assertEquals(result, 7.0);
|
|
});
|
|
});
|
|
|
|
describe("formatDate function", () => {
|
|
it("should format date correctly", () => {
|
|
const date = new Date(2024, 0, 15); // January 15, 2024
|
|
const result = formatDate(date);
|
|
assertEquals(result, "2024-01-15");
|
|
});
|
|
|
|
it("should pad single digit months and days", () => {
|
|
const date = new Date(2024, 2, 5); // March 5, 2024
|
|
const result = formatDate(date);
|
|
assertEquals(result, "2024-03-05");
|
|
});
|
|
|
|
it("should handle end of year", () => {
|
|
const date = new Date(2023, 11, 31); // December 31, 2023
|
|
const result = formatDate(date);
|
|
assertEquals(result, "2023-12-31");
|
|
});
|
|
});
|
|
|
|
describe("Basic assertions", () => {
|
|
it("should demonstrate various assertions", () => {
|
|
// Check existence
|
|
const obj = { name: "test", value: 42 };
|
|
assertExists(obj);
|
|
assertExists(obj.name);
|
|
|
|
// Check equality
|
|
assertEquals(2 + 2, 4);
|
|
assertEquals("hello".toUpperCase(), "HELLO");
|
|
assertEquals([1, 2, 3].length, 3);
|
|
|
|
// Check comparison
|
|
assertGreater(10, 5);
|
|
assertGreater(new Date().getFullYear(), 2020);
|
|
});
|
|
});
|
|
}); |