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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Cargo Fmt
run: cargo +nightly fmt --all --check
- name: Cargo Clippy
run: cargo +nightly clippy --all-features --workspace
run: cargo +nightly clippy --all-features --all-targets --workspace
draft_release:
needs:
- build
Expand Down
2 changes: 1 addition & 1 deletion crates/forge_app/src/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,7 @@ mod tests {
assert!(
!actual
.values
.get(0)
.first()
.unwrap()
.as_str()
.unwrap()
Expand Down
1 change: 1 addition & 0 deletions crates/forge_app/src/orch_spec/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::module_inception)]
mod orch_runner;
mod orch_setup;
mod orch_spec;
Expand Down
2 changes: 1 addition & 1 deletion crates/forge_app/src/orch_spec/orch_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use url::Url;
use crate::orch_spec::orch_runner::Runner;

// User prompt
const USER_PROMPT: &'static str = r#"
const USER_PROMPT: &str = r#"
{{#if (eq event.name 'forge/user_task_update')}}
<feedback>{{event.value}}</feedback>
{{else}}
Expand Down
17 changes: 7 additions & 10 deletions crates/forge_app/src/orch_spec/orch_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async fn test_rendered_user_message() {
let mut ctx = TestContext::default().mock_assistant_responses(vec![
ChatCompletionMessage::assistant(Content::full("Hello!")).finish_reason(FinishReason::Stop),
]);
let current_time = ctx.current_time.clone();
let current_time = ctx.current_time;
ctx.run("Hi").await.unwrap();

let messages = ctx.output.context_messages();
Expand All @@ -70,7 +70,7 @@ async fn test_followup_does_not_trigger_session_summary() {
ToolResult::new("followup").output(Ok(ToolOutput::text("Follow-up question sent")));

let mut ctx = TestContext::default()
.mock_tool_call_responses(vec![(followup_call.clone().into(), followup_result)])
.mock_tool_call_responses(vec![(followup_call.clone(), followup_result)])
.mock_assistant_responses(vec![
ChatCompletionMessage::assistant("I need more information")
.tool_calls(vec![followup_call.into()]),
Expand All @@ -85,7 +85,7 @@ async fn test_followup_does_not_trigger_session_summary() {
.chat_responses
.iter()
.flatten()
.any(|response| matches!(response, ChatResponse::TaskComplete { .. }));
.any(|response| matches!(response, ChatResponse::TaskComplete));

assert!(
!has_chat_complete,
Expand Down Expand Up @@ -128,7 +128,7 @@ async fn test_tool_call_start_end_responses_for_non_agent_tools() {
let tool_result = ToolResult::new("fs_read").output(Ok(ToolOutput::text("file content")));

let mut ctx = TestContext::default()
.mock_tool_call_responses(vec![(tool_call.clone().into(), tool_result.clone())])
.mock_tool_call_responses(vec![(tool_call.clone(), tool_result.clone())])
.mock_assistant_responses(vec![
ChatCompletionMessage::assistant("Reading file")
.tool_calls(vec![tool_call.clone().into()]),
Expand Down Expand Up @@ -197,10 +197,7 @@ async fn test_no_tool_call_start_end_responses_for_agent_tools() {
ToolResult::new("forge").output(Ok(ToolOutput::text("analysis complete")));

let mut ctx = TestContext::default()
.mock_tool_call_responses(vec![(
agent_tool_call.clone().into(),
agent_tool_result.clone(),
)])
.mock_tool_call_responses(vec![(agent_tool_call.clone(), agent_tool_result.clone())])
.mock_assistant_responses(vec![
ChatCompletionMessage::assistant("Analyzing code")
.tool_calls(vec![agent_tool_call.into()]),
Expand Down Expand Up @@ -250,8 +247,8 @@ async fn test_mixed_agent_and_non_agent_tool_calls() {

let mut ctx = TestContext::default()
.mock_tool_call_responses(vec![
(fs_tool_call.clone().into(), fs_tool_result.clone()),
(agent_tool_call.clone().into(), agent_tool_result.clone()),
(fs_tool_call.clone(), fs_tool_result.clone()),
(agent_tool_call.clone(), agent_tool_result.clone()),
])
.mock_assistant_responses(vec![
ChatCompletionMessage::assistant("Reading and analyzing")
Expand Down
33 changes: 16 additions & 17 deletions crates/forge_app/src/truncation/truncate_shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ mod tests {

#[test]
fn test_no_truncation_needed() {
let stdout = vec!["line 1", "line 2", "line 3"].join("\n");
let stderr = vec!["error 1", "error 2"].join("\n");
let stdout = ["line 1", "line 2", "line 3"].join("\n");
let stderr = ["error 1", "error 2"].join("\n");

let actual = truncate_shell_output(&stdout, &stderr, 5, 5, 2000);
let expected = TruncatedShellOutput::default()
Expand All @@ -231,11 +231,11 @@ mod tests {

#[test]
fn test_truncation_with_prefix_and_suffix() {
let stdout = vec![
let stdout = [
"line 1", "line 2", "line 3", "line 4", "line 5", "line 6", "line 7",
]
.join("\n");
let stderr = vec!["error 1", "error 2", "error 3", "error 4", "error 5"].join("\n");
let stderr = ["error 1", "error 2", "error 3", "error 4", "error 5"].join("\n");

let actual = truncate_shell_output(&stdout, &stderr, 2, 2, 2000);
let expected = TruncatedShellOutput::default()
Expand Down Expand Up @@ -297,8 +297,8 @@ mod tests {

#[test]
fn test_only_prefix_lines() {
let stdout = vec!["line 1", "line 2", "line 3", "line 4", "line 5"].join("\n");
let stderr = vec!["error 1", "error 2", "error 3"].join("\n");
let stdout = ["line 1", "line 2", "line 3", "line 4", "line 5"].join("\n");
let stderr = ["error 1", "error 2", "error 3"].join("\n");

let actual = truncate_shell_output(&stdout, &stderr, 2, 0, 2000);
let expected = TruncatedShellOutput::default()
Expand All @@ -324,8 +324,8 @@ mod tests {

#[test]
fn test_only_suffix_lines() {
let stdout = vec!["line 1", "line 2", "line 3", "line 4", "line 5"].join("\n");
let stderr = vec!["error 1", "error 2", "error 3"].join("\n");
let stdout = ["line 1", "line 2", "line 3", "line 4", "line 5"].join("\n");
let stderr = ["error 1", "error 2", "error 3"].join("\n");

let actual = truncate_shell_output(&stdout, &stderr, 0, 2, 2000);
let expected = TruncatedShellOutput::default()
Expand All @@ -351,7 +351,7 @@ mod tests {

#[test]
fn test_long_line() {
let stdout = vec![
let stdout = [
"line 1 ",
"line abcdefghijklmnopqrstuvwxyz",
"line 2",
Expand All @@ -361,7 +361,7 @@ mod tests {
]
.join("\n");

let actual = truncate_shell_output(&stdout, "", usize::max_value(), usize::max_value(), 10);
let actual = truncate_shell_output(&stdout, "", usize::MAX, usize::MAX, 10);
let expected = TruncatedShellOutput::default().stdout(
Stdout::default()
.head("line 1 \nline abcde...[21 more chars truncated]\nline 2\nline 3\nline 4\nline 5")
Expand All @@ -375,15 +375,15 @@ mod tests {

#[test]
fn test_line_truncation_with_multiple_long_lines() {
let stdout = vec![
let stdout = [
"short",
"this is a very long line that exceeds limit",
"another very long line that also exceeds the limit",
"short again",
]
.join("\n");

let actual = truncate_shell_output(&stdout, "", usize::max_value(), usize::max_value(), 15);
let actual = truncate_shell_output(&stdout, "", usize::MAX, usize::MAX, 15);
let expected = TruncatedShellOutput::default().stdout(
Stdout::default()
.head("short\nthis is a very ...[28 more chars truncated]\nanother very lo...[35 more chars truncated]\nshort again")
Expand All @@ -397,7 +397,7 @@ mod tests {

#[test]
fn test_line_truncation_with_line_count_truncation() {
let stdout = vec![
let stdout = [
"line 1",
"very long line that will be truncated",
"line 3",
Expand Down Expand Up @@ -425,15 +425,14 @@ mod tests {

#[test]
fn test_no_line_truncation_when_limit_not_set() {
let stdout = vec![
let stdout = [
"line 1",
"very long line that will not be truncated because no limit is set",
"line 3",
]
.join("\n");

let actual =
truncate_shell_output(&stdout, "", usize::max_value(), usize::max_value(), 2000);
let actual = truncate_shell_output(&stdout, "", usize::MAX, usize::MAX, 2000);
let expected = TruncatedShellOutput::default().stdout(
Stdout::default()
.head("line 1\nvery long line that will not be truncated because no limit is set\nline 3")
Expand All @@ -445,7 +444,7 @@ mod tests {
}
#[test]
fn test_clip_by_lines_with_unicode_chars() {
let fixture = vec![
let fixture = [
"emoji 😀 line",
"Unicode café résumé naïve",
"Regular ASCII line",
Expand Down
3 changes: 2 additions & 1 deletion crates/forge_ci/src/workflows/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ pub fn generate_ci_workflow() {
)
.add_step(Step::new("Cargo Fmt").run("cargo +nightly fmt --all --check"))
.add_step(
Step::new("Cargo Clippy").run("cargo +nightly clippy --all-features --workspace"),
Step::new("Cargo Clippy")
.run("cargo +nightly clippy --all-features --all-targets --workspace"),
);

let draft_release_job = jobs::create_draft_release_job("build");
Expand Down
8 changes: 4 additions & 4 deletions crates/forge_display/src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ mod tests {
let old = "line 1\nline 2\nline 3\nline 4\nline 5";
let new = "line 1\nline 2\nline 3";
let diff = DiffFormat::format(old, new);
let clean_diff = strip_ansi_codes(&diff.diff());
let clean_diff = strip_ansi_codes(diff.diff());
assert_eq!(diff.lines_added(), 1);
assert_eq!(diff.lines_removed(), 3);
assert_snapshot!(clean_diff);
Expand All @@ -165,7 +165,7 @@ mod tests {
let old = "line 1\nline 2\nline 3\nline 5\nline 6\nline 7\nline 8\nline 9";
let new = "line 1\nmodified line\nline 3\nline 5\nline 6\nline 7\nline 8\nline 9";
let diff = DiffFormat::format(old, new);
let clean_diff = strip_ansi_codes(&diff.diff());
let clean_diff = strip_ansi_codes(diff.diff());
assert_eq!(diff.lines_added(), 1);
assert_eq!(diff.lines_removed(), 1);
assert_snapshot!(clean_diff);
Expand All @@ -181,7 +181,7 @@ mod tests {
let old = old_lines.join("\n");
let new = new_lines.join("\n");
let diff = DiffFormat::format(&old, &new);
let clean_diff = strip_ansi_codes(&diff.diff());
let clean_diff = strip_ansi_codes(diff.diff());

// With 150 lines, width should be 3 (for numbers like "100")
// Verify the format includes proper spacing
Expand All @@ -201,7 +201,7 @@ mod tests {
let old = old_lines.join("\n");
let new = new_lines.join("\n");
let diff = DiffFormat::format(&old, &new);
let clean_diff = strip_ansi_codes(&diff.diff());
let clean_diff = strip_ansi_codes(diff.diff());

// Diff only shows lines 3-8 (context), so width should be 1 (for single digit
// numbers) NOT 4 (which would be needed for line 1000)
Expand Down
2 changes: 1 addition & 1 deletion crates/forge_domain/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ mod tests {
let mut fixture = Agent::new("test-agent");
fixture.add_subscription("string_literal");
fixture.add_subscription(String::from("owned_string"));
fixture.add_subscription(&"string_ref".to_string());
fixture.add_subscription("string_ref".to_string());

let actual = fixture.subscribe.as_ref().unwrap();
let expected = vec![
Expand Down
Loading
Loading