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
34 changes: 17 additions & 17 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ members = [
exclude = ["tests/fixtures/mini-axum"]

[workspace.package]
version = "1.3.0"
version = "1.4.0"
edition = "2021"
rust-version = "1.80"
authors = ["NeuroMesh Team <team@neuromesh.local>"]
Expand Down
87 changes: 82 additions & 5 deletions crates/neuromesh-cli/src/commands/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ struct PacketJsonOut {
/// lines), 20 deep — function-level localisation.
#[serde(skip_serializing_if = "Vec::is_empty")]
definitions: Vec<neuromesh_graph::RankedDefinition>,
/// Research runs (`NM_DIAG=1`): the same list under other settings.
#[serde(skip_serializing_if = "Option::is_none")]
diag_definitions:
Option<std::collections::BTreeMap<String, Vec<neuromesh_graph::RankedDefinition>>>,
/// The whole-question file ranking (BM25F), top 10, for evaluation.
ranked_paths: Vec<String>,
identifiers: Vec<String>,
Expand Down Expand Up @@ -104,12 +108,11 @@ pub fn execute(args: &[String]) -> Result<()> {

let selected_paths = neuromesh_context::gold::packet_file_order(&graph, &prompt, &view);
let localization = neuromesh_context::gold::localization_order(&graph, &prompt, &view, 20);
// Every prompt gets the function list: a short issue still has a function
// to change (30 of LocAgent's 274 Lite instances are under 60 words and
// scored as misses without one).
let definitions =
if prompt.split_whitespace().count() >= neuromesh_parser::text_normalize::REPORT_WORDS {
neuromesh_context::gold::definition_order(&graph, &prompt, &localization, def_depth())
} else {
Vec::new()
};
neuromesh_context::gold::definition_order(&graph, &prompt, &localization, def_depth());
let mut files: Vec<String> = packet_file_names(&view).into_iter().collect();
files.sort();
let reduction = if workspace_tokens > 0 {
Expand Down Expand Up @@ -139,6 +142,7 @@ pub fn execute(args: &[String]) -> Result<()> {
selected_files_count: files.len(),
selected_files: files.clone(),
selected_paths,
diag_definitions: diag_definitions(&graph, &prompt, &localization),
localization,
definitions,
ranked_paths: graph
Expand Down Expand Up @@ -417,6 +421,79 @@ fn def_depth() -> usize {
.unwrap_or(20)
}

/// Definition lists under research settings, only when `NM_DIAG=1` (one run
/// measures several variants on the same checkouts).
fn diag_definitions(
graph: &neuromesh_graph::NeuralProjectGraph,
prompt: &str,
localization: &[String],
) -> Option<std::collections::BTreeMap<String, Vec<neuromesh_graph::RankedDefinition>>> {
if std::env::var("NM_DIAG").ok().as_deref() != Some("1") {
return None;
}
use neuromesh_context::gold::{definition_order_with, DefinitionOpts};
use neuromesh_graph::ChunkOpts;
let base = DefinitionOpts::default();
let variants = [
(
"raw",
DefinitionOpts {
file_prior: false,
traceback: false,
..base
},
),
(
"no_trace",
DefinitionOpts {
traceback: false,
..base
},
),
(
"no_stem",
DefinitionOpts {
chunk: ChunkOpts {
no_stem: true,
owner_terms: false,
},
..base
},
),
(
"owner",
DefinitionOpts {
chunk: ChunkOpts {
no_stem: false,
owner_terms: true,
},
..base
},
),
(
"no_stem_owner",
DefinitionOpts {
chunk: ChunkOpts {
no_stem: true,
owner_terms: true,
},
..base
},
),
];
Some(
variants
.into_iter()
.map(|(name, opts)| {
(
name.to_string(),
definition_order_with(graph, prompt, localization, def_depth(), opts),
)
})
.collect(),
)
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
Loading
Loading