Skip to content

Commit 1a3884e

Browse files
committed
Merge origin/main into cursor/dag-execution-parallelization-429d
2 parents 44624f2 + 17d0976 commit 1a3884e

File tree

26 files changed

+988
-240
lines changed

26 files changed

+988
-240
lines changed

src/commands/eval/command.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ pub async fn eval_command(
2323
mut config: config::Config,
2424
fixtures_dir: PathBuf,
2525
output_path: Option<PathBuf>,
26-
options: EvalRunOptions,
26+
mut options: EvalRunOptions,
2727
) -> Result<()> {
2828
config.verification_fail_open = true;
29+
if options.trend_file.is_none() {
30+
options.trend_file = Some(config.eval_trend_path.clone());
31+
}
2932
ensure_frontier_eval_models(&config, &options)?;
3033
if options.repeat > 1 || !options.matrix_models.is_empty() {
3134
return run_eval_batch(config, &fixtures_dir, output_path.as_deref(), &options).await;

src/commands/misc/feedback/apply.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
mod accept;
33
#[path = "apply/reject.rs"]
44
mod reject;
5-
#[path = "apply/stats.rs"]
6-
mod stats;
75

86
pub(super) use accept::apply_feedback_accept;
97
pub(super) use reject::apply_feedback_reject;

src/commands/misc/feedback/apply/accept.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
use crate::core;
22
use crate::review;
33

4-
use super::stats::record_accepted_feedback;
5-
64
pub(in super::super) fn apply_feedback_accept(
75
store: &mut review::FeedbackStore,
86
comments: &[core::Comment],
97
) -> usize {
108
let mut updated = 0;
119
for comment in comments {
12-
let is_new = store.accept.insert(comment.id.clone());
13-
if is_new {
10+
if review::apply_comment_feedback_signal(store, comment, true) {
1411
updated += 1;
15-
record_accepted_feedback(store, comment);
1612
}
17-
store.suppress.remove(&comment.id);
1813
}
1914
updated
2015
}
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
use crate::core;
22
use crate::review;
33

4-
use super::stats::record_rejected_feedback;
5-
64
pub(in super::super) fn apply_feedback_reject(
75
store: &mut review::FeedbackStore,
86
comments: &[core::Comment],
97
) -> usize {
108
let mut updated = 0;
119
for comment in comments {
12-
let is_new = store.suppress.insert(comment.id.clone());
13-
if is_new {
10+
if review::apply_comment_feedback_signal(store, comment, false) {
1411
updated += 1;
15-
record_rejected_feedback(store, comment);
1612
}
17-
store.accept.remove(&comment.id);
1813
}
1914
updated
2015
}

src/commands/misc/feedback/apply/stats.rs

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/config.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ pub struct Config {
158158
#[serde(default = "default_feedback_path")]
159159
pub feedback_path: PathBuf,
160160

161+
#[serde(default = "default_eval_trend_path")]
162+
pub eval_trend_path: PathBuf,
163+
164+
#[serde(default = "default_feedback_eval_trend_path")]
165+
pub feedback_eval_trend_path: PathBuf,
166+
161167
/// Path to the convention store file for learned review patterns.
162168
/// Defaults to ~/.local/share/diffscope/conventions.json if not set.
163169
#[serde(default)]
@@ -496,6 +502,8 @@ impl Default for Config {
496502
symbol_index_lsp_command: None,
497503
symbol_index_lsp_languages: default_symbol_index_lsp_languages(),
498504
feedback_path: default_feedback_path(),
505+
eval_trend_path: default_eval_trend_path(),
506+
feedback_eval_trend_path: default_feedback_eval_trend_path(),
499507
convention_store_path: None,
500508
system_prompt: None,
501509
api_key: None,
@@ -813,6 +821,15 @@ impl Config {
813821
} else {
814822
self.symbol_index_provider = provider;
815823
}
824+
if self.feedback_path.as_os_str().is_empty() {
825+
self.feedback_path = default_feedback_path();
826+
}
827+
if self.eval_trend_path.as_os_str().is_empty() {
828+
self.eval_trend_path = default_eval_trend_path();
829+
}
830+
if self.feedback_eval_trend_path.as_os_str().is_empty() {
831+
self.feedback_eval_trend_path = default_feedback_eval_trend_path();
832+
}
816833

817834
if let Some(command) = &self.symbol_index_lsp_command {
818835
if command.trim().is_empty() {
@@ -1348,6 +1365,14 @@ fn default_feedback_path() -> PathBuf {
13481365
PathBuf::from(".diffscope.feedback.json")
13491366
}
13501367

1368+
fn default_eval_trend_path() -> PathBuf {
1369+
PathBuf::from(".diffscope.eval-trend.json")
1370+
}
1371+
1372+
fn default_feedback_eval_trend_path() -> PathBuf {
1373+
PathBuf::from(".diffscope.feedback-eval-trend.json")
1374+
}
1375+
13511376
fn default_pattern_repo_max_files() -> usize {
13521377
8
13531378
}

src/core/comment.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ mod types;
2121
use classify::{determine_category, determine_fix_effort, determine_severity};
2222
use confidence::calculate_confidence;
2323
use ordering::{
24-
deduplicate_comments as deduplicate_comment_list, sort_by_priority as sort_comments_by_priority,
24+
deduplicate_comments as deduplicate_comment_list,
25+
sort_by_priority as order_comments_by_priority,
2526
};
2627
#[cfg(test)]
2728
use std::path::PathBuf;
@@ -98,6 +99,10 @@ impl CommentSynthesizer {
9899
}
99100
}
100101

102+
pub fn sort_comments_by_priority(comments: &mut [Comment]) {
103+
order_comments_by_priority(comments);
104+
}
105+
101106
#[cfg(test)]
102107
mod tests {
103108
use super::*;

src/core/comment/ordering.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ pub(super) fn sort_by_priority(comments: &mut [Comment]) {
1818
severity_rank(&a.severity)
1919
.cmp(&severity_rank(&b.severity))
2020
.then_with(|| category_rank(&a.category).cmp(&category_rank(&b.category)))
21+
.then_with(|| {
22+
b.confidence
23+
.partial_cmp(&a.confidence)
24+
.unwrap_or(std::cmp::Ordering::Equal)
25+
})
2126
.then_with(|| a.file_path.cmp(&b.file_path))
2227
.then_with(|| a.line_number.cmp(&b.line_number))
2328
});

src/core/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub mod symbol_graph;
2828
pub mod symbol_index;
2929

3030
pub use changelog::ChangelogGenerator;
31-
pub use comment::{Comment, CommentSynthesizer};
31+
pub use comment::{sort_comments_by_priority, Comment, CommentSynthesizer};
3232
pub use commit_prompt::CommitPromptBuilder;
3333
pub use context::{ContextFetcher, ContextType, LLMContextChunk};
3434
pub use context_provenance::ContextProvenance;

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ async fn main() -> Result<()> {
756756
commands::feedback_eval_command(
757757
input,
758758
output,
759-
trend_file,
759+
trend_file.or_else(|| Some(config.feedback_eval_trend_path.clone())),
760760
confidence_threshold,
761761
eval_report,
762762
)

0 commit comments

Comments
 (0)