Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,5 @@ desktop/package-lock.json
crates/terraphim_rlm/
crates/terraphim_github_runner/
crates/terraphim_github_runner_server/
terraphim_firecracker/
terraphim_firecracker/*
!terraphim_firecracker/Cargo.toml
94 changes: 0 additions & 94 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions crates/terraphim_agent/docs/src/kg/test_ranking_kg.md

This file was deleted.

21 changes: 20 additions & 1 deletion crates/terraphim_agent/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ async fn test_end_to_end_server_workflow() -> Result<()> {
"Server should have roles available"
);

let selected_role = server_roles
let current_role = server_roles
.iter()
.find_map(|line| {
let trimmed = line.trim();
Expand All @@ -342,6 +342,25 @@ async fn test_end_to_end_server_workflow() -> Result<()> {
})
.unwrap_or_else(|| "Terraphim Engineer".to_string());

let selected_role = server_roles
.iter()
.find_map(|line| {
let trimmed = line.trim();
if trimmed.starts_with('*') {
return None;
}
let role = trimmed
.trim_start_matches('*')
.trim()
.split_once(" (")
.map(|(name, _)| name)
.unwrap_or(trimmed)
.trim()
.to_string();
(role != current_role).then_some(role)
})
.unwrap_or_else(|| current_role.clone());

// 3. Test search with server (may fail in CI due to missing KG data or slow indexing)
let (search_stdout, search_stderr, search_code) =
run_server_command(&server_url, &["search", "integration test", "--limit", "3"])?;
Expand Down
1 change: 0 additions & 1 deletion crates/terraphim_orchestrator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ terraphim_spawner = { path = "../terraphim_spawner", version = "1.0.0" }
terraphim_router = { path = "../terraphim_router", version = "1.0.0" }
terraphim_types = { path = "../terraphim_types", version = "1.0.0" }
terraphim_tracker = { path = "../terraphim_tracker", version = "1.0.0" }
terraphim_symphony = { path = "../terraphim_symphony", version = "1.0.0" }

# Core dependencies
tokio = { workspace = true, features = ["full", "signal"] }
Expand Down
8 changes: 3 additions & 5 deletions crates/terraphim_orchestrator/src/compound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ use tokio::sync::mpsc;
use tracing::{debug, info, warn};
use uuid::Uuid;

use terraphim_symphony::runner::protocol::{
FindingCategory, FindingSeverity, ReviewAgentOutput, ReviewFinding,
};
use terraphim_types::{FindingCategory, FindingSeverity, ReviewAgentOutput, ReviewFinding};

use crate::config::CompoundReviewConfig;
use crate::error::OrchestratorError;
Expand Down Expand Up @@ -376,7 +374,7 @@ impl CompoundReviewWorkflow {
.iter()
.flat_map(|o| o.findings.clone())
.collect();
let deduplicated = terraphim_symphony::runner::protocol::deduplicate_findings(all_findings);
let deduplicated = terraphim_types::deduplicate_findings(all_findings);

// Determine overall pass/fail
let pass = agent_outputs.iter().all(|o| o.pass) && failed_count == 0;
Expand Down Expand Up @@ -898,7 +896,7 @@ fn default_groups() -> Vec<ReviewGroupDef> {
#[cfg(test)]
mod tests {
use super::*;
use terraphim_symphony::runner::protocol::FindingSeverity;
use terraphim_types::FindingSeverity;

// ==================== Visual File Detection Tests ====================

Expand Down
4 changes: 2 additions & 2 deletions crates/terraphim_orchestrator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub use nightwatch::{
pub use output_poster::OutputPoster;
pub use persona::{MetapromptRenderError, MetapromptRenderer, PersonaRegistry};
pub use scheduler::{ScheduleEvent, TimeScheduler};
use terraphim_symphony::runner::protocol::{FindingSeverity, ReviewFinding};
use terraphim_types::{FindingSeverity, ReviewFinding};

use chrono::Timelike;
use std::collections::HashMap;
Expand Down Expand Up @@ -2089,7 +2089,7 @@ impl AgentOrchestrator {
result: &CompoundReviewResult,
finding: &ReviewFinding,
) -> Result<(), String> {
use terraphim_symphony::runner::protocol::FindingSeverity;
use terraphim_types::FindingSeverity;

let sev_str = match finding.severity {
FindingSeverity::Critical => "CRITICAL",
Expand Down
27 changes: 18 additions & 9 deletions crates/terraphim_orchestrator/tests/orchestrator_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,24 @@ use terraphim_orchestrator::{
};
use uuid::Uuid;

/// Return a deterministic baseline commit for git-diff tests.
/// Uses the repository root commit so tests work in any clone.
fn baseline_commit() -> String {
/// Return a deterministic baseline for git-diff tests.
/// Prefer the repository root commit, but fall back to the empty tree when the
/// checkout is shallow and history before HEAD is unavailable.
fn git_diff_baseline() -> String {
let output = std::process::Command::new("git")
.args(["rev-list", "--max-parents=0", "HEAD"])
.output()
.expect("git rev-list failed");
let commits = String::from_utf8_lossy(&output.stdout);
commits.lines().next().unwrap_or("").trim().to_string()
let baseline = commits.lines().next().unwrap_or("").trim();

if baseline.is_empty() {
// Git's well-known empty tree object works as a stable diff baseline
// even when CI checks out a shallow clone without HEAD~1 available.
"4b825dc642cb6eb9a060e54bf8d69288fbee4904".to_string()
} else {
baseline.to_string()
}
}

fn test_config() -> OrchestratorConfig {
Expand Down Expand Up @@ -181,7 +190,7 @@ async fn test_orchestrator_compound_review_integration() {
};

let workflow = CompoundReviewWorkflow::new(swarm_config);
let result = workflow.run("HEAD", "HEAD~1").await.unwrap();
let result = workflow.run("HEAD", &git_diff_baseline()).await.unwrap();

assert!(
!result.correlation_id.is_nil(),
Expand Down Expand Up @@ -462,7 +471,7 @@ async fn test_git_diff_matching_changes_spawns() {
let mut orch = AgentOrchestrator::new(config).unwrap();

// Seed with initial commit so there ARE changes
let baseline_commit = baseline_commit();
let baseline_commit = git_diff_baseline();
orch.set_last_run_commit("sentinel", &baseline_commit);

let result = orch.spawn_agent_for_test("sentinel").await;
Expand All @@ -481,7 +490,7 @@ async fn test_git_diff_non_matching_changes_skips() {
let mut orch = AgentOrchestrator::new(config).unwrap();

// Seed with initial commit so there ARE changes, but none match the watch path
let baseline_commit = baseline_commit();
let baseline_commit = git_diff_baseline();
orch.set_last_run_commit("sentinel", &baseline_commit);

let result = orch.spawn_agent_for_test("sentinel").await;
Expand Down Expand Up @@ -608,7 +617,7 @@ async fn test_spawn_agent_skipped_by_git_diff_no_matching() {
let mut orch = AgentOrchestrator::new(config).unwrap();

// Seed with initial commit so there are diff results
let baseline_commit = baseline_commit();
let baseline_commit = git_diff_baseline();
orch.set_last_run_commit("sentinel", &baseline_commit);

let result = orch.spawn_agent_for_test("sentinel").await;
Expand All @@ -628,7 +637,7 @@ async fn test_spawn_agent_proceeds_with_git_diff_findings() {
let mut orch = AgentOrchestrator::new(config).unwrap();

// Use initial commit as baseline -> every file is a change
let baseline_commit = baseline_commit();
let baseline_commit = git_diff_baseline();
orch.set_last_run_commit("sentinel", &baseline_commit);

let result = orch.spawn_agent_for_test("sentinel").await;
Expand Down
6 changes: 6 additions & 0 deletions crates/terraphim_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ pub use procedure::*;
pub mod persona;
pub use persona::{CharacteristicDef, PersonaDefinition, PersonaLoadError, SfiaSkillDef};

// Review finding types for multi-agent code review
pub mod review;
pub use review::{
FindingCategory, FindingSeverity, ReviewAgentOutput, ReviewFinding, deduplicate_findings,
};

use ahash::AHashMap;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::collections::HashSet;
Expand Down
Loading
Loading