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
26 changes: 18 additions & 8 deletions crates/tracedecay-application/src/primitives/symbol_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::sync::Arc;

use tracedecay_code_index::graph_projection::{
CodeGraphInteractiveReader, CodeGraphReadCostMeter, CodeGraphSymbolBindingV1,
CodeGraphSymbolSummaryV1,
CodeGraphSymbolSummaryV1, UnresolvedCallerGapsV1,
};
use tracedecay_code_index::lineage::LineageSymbolRecordV1;
use tracedecay_contracts::retrieval::{
Expand Down Expand Up @@ -562,7 +562,7 @@ where
let Ok(graph) = open_graph(&self.code_graph, context).await else {
return failed(context, "caller traversal failed");
};
let (records, unsupported) = match relation_traversal(
let (records, unresolved) = match relation_traversal(
&graph.reader,
Arc::clone(&graph.cancellation),
&request.node_id,
Expand All @@ -573,7 +573,7 @@ where
Ok(records) => records,
Err(()) => return failed(context, "caller traversal failed"),
};
let mut gaps = if unsupported {
let mut gaps = if unresolved.exact_target_unavailable {
// Unresolved Rust receiver calls and TypeScript imports the
// seal could not bind share one disclosure; the gap is the
// call site, not a language.
Expand All @@ -586,6 +586,12 @@ where
} else {
Vec::new()
};
gaps.extend(
unresolved
.unmodeled_imports
.iter()
.map(|shape| PrimitiveSupportGap::import_unmodeled(shape.as_str())),
);
// A caller inside an unexpanded macro body is syntactic
// evidence only; what the expansion calls is not covered.
gaps.extend(
Expand Down Expand Up @@ -972,24 +978,28 @@ fn relation_traversal(
maximum_depth: u32,
incoming: bool,
scope: &SymbolGraphScope,
) -> Result<(Vec<SymbolRelationRecord>, bool), ()> {
) -> Result<(Vec<SymbolRelationRecord>, UnresolvedCallerGapsV1), ()> {
let seed = SymbolOccurrenceId::new(seed.to_owned()).map_err(|_| ())?;
let mut seen = HashSet::from([seed.clone()]);
let mut frontier = vec![seed];
let mut records = Vec::new();
let mut unsupported_callers = false;
let mut unresolved_callers = UnresolvedCallerGapsV1::default();
for depth in 1..=maximum_depth {
if frontier.is_empty() || records.len() >= MAX_COMPATIBILITY_RESULTS {
break;
}
if incoming {
unsupported_callers |= graph
.has_unresolved_callers(
let gaps = graph
.unresolved_caller_gaps(
&frontier,
scope.path_prefix.as_deref(),
Arc::clone(&cancellation),
)
.map_err(|_| ())?;
unresolved_callers.exact_target_unavailable |= gaps.exact_target_unavailable;
unresolved_callers
.unmodeled_imports
.extend(gaps.unmodeled_imports);
}
let batches = if incoming {
graph.callers(
Expand Down Expand Up @@ -1029,7 +1039,7 @@ fn relation_traversal(
}
frontier = next;
}
Ok((records, unsupported_callers))
Ok((records, unresolved_callers))
}

fn trait_dispatch_targets(
Expand Down
1 change: 1 addition & 0 deletions crates/tracedecay-code-extraction/src/annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pub(crate) fn emit_annotation_usage<S: AnnotationEmitterState>(
line: start_line,
column: start_column,
file_path: state.file_path().to_string(),
unmodeled_import: None,
});

state.push_edge(Edge {
Expand Down
1 change: 1 addition & 0 deletions crates/tracedecay-code-extraction/src/bash_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ impl BashExtractor {
line: node.start_position().row as u32,
column: node.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
let mut cursor = node.walk();
Expand Down
1 change: 1 addition & 0 deletions crates/tracedecay-code-extraction/src/batch_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ impl BatchExtractor {
line: node.start_position().row as u32,
column: node.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/tracedecay-code-extraction/src/clojure_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ impl ClojureExtractor {
line: child.start_position().row as u32,
column: child.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
Self::extract_calls(state, child, fn_id, 1);
Expand Down
2 changes: 2 additions & 0 deletions crates/tracedecay-code-extraction/src/cobol_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ impl CobolExtractor {
line: node.start_position().row as u32,
column: node.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
}
Expand All @@ -529,6 +530,7 @@ impl CobolExtractor {
line: node.start_position().row as u32,
column: node.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/tracedecay-code-extraction/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ pub(crate) fn extract_call_expression_sites(
line: child.start_position().row as u32,
column: child.start_position().column as u32,
file_path: file_path.to_string(),
unmodeled_import: None,
});
}
extract_call_expression_sites(source, file_path, unresolved_refs, child, fn_node_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ impl CppExtractor {
line: child.start_position().row as u32,
column: child.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
if !cursor.goto_next_sibling() {
Expand Down Expand Up @@ -372,6 +373,7 @@ impl CppExtractor {
line: start_line,
column: start_column,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
state.edges.push(Edge {
source: id,
Expand Down
5 changes: 5 additions & 0 deletions crates/tracedecay-code-extraction/src/csharp_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ impl CSharpExtractor {
line: start_line,
column: start_column,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}

Expand Down Expand Up @@ -1199,6 +1200,7 @@ impl CSharpExtractor {
line: start_line,
column: start_column,
file_path: state.file_path.clone(),
unmodeled_import: None,
});

if let Some(ref tid) = target_id {
Expand Down Expand Up @@ -1458,6 +1460,7 @@ impl CSharpExtractor {
line: child.start_position().row as u32,
column: child.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
if !cursor.goto_next_sibling() {
Expand Down Expand Up @@ -1663,6 +1666,7 @@ impl CSharpExtractor {
line: child.start_position().row as u32,
column: child.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
Self::extract_call_sites(state, child, fn_node_id);
}
Expand All @@ -1675,6 +1679,7 @@ impl CSharpExtractor {
line: child.start_position().row as u32,
column: child.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
Self::extract_call_sites(state, child, fn_node_id);
}
Expand Down
6 changes: 6 additions & 0 deletions crates/tracedecay-code-extraction/src/dart_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ impl DartExtractor {
line: start_line,
column: start_column,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}

Expand Down Expand Up @@ -510,6 +511,7 @@ impl DartExtractor {
line: superclass.start_position().row as u32,
column: superclass.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}

Expand Down Expand Up @@ -1624,6 +1626,7 @@ impl DartExtractor {
line: ident.start_position().row as u32,
column: ident.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
Self::extract_call_sites(state, child, fn_node_id);
Expand All @@ -1643,6 +1646,7 @@ impl DartExtractor {
line: child.start_position().row as u32,
column: child.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
}
Expand All @@ -1664,6 +1668,7 @@ impl DartExtractor {
line: child.start_position().row as u32,
column: child.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
}
Expand Down Expand Up @@ -1880,6 +1885,7 @@ impl DartExtractor {
line: start_line,
column: start_column,
file_path: state.file_path.clone(),
unmodeled_import: None,
});

state.edges.push(Edge {
Expand Down
1 change: 1 addition & 0 deletions crates/tracedecay-code-extraction/src/elixir_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ impl ElixirExtractor {
line: child.start_position().row as u32,
column: child.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
Self::extract_calls(state, child, fn_id);
Expand Down
2 changes: 2 additions & 0 deletions crates/tracedecay-code-extraction/src/erlang_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ impl ErlangExtractor {
line: start_line,
column: 0,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
let _ = text;
Expand Down Expand Up @@ -384,6 +385,7 @@ impl ErlangExtractor {
line: child.start_position().row as u32,
column: child.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
Self::extract_calls(state, child, fn_id);
Expand Down
3 changes: 3 additions & 0 deletions crates/tracedecay-code-extraction/src/fortran_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ impl FortranExtractor {
line: start_line,
column: start_column,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}

Expand Down Expand Up @@ -844,6 +845,7 @@ impl FortranExtractor {
line: child.start_position().row as u32,
column: child.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
Self::extract_call_sites(state, child, fn_node_id);
Expand All @@ -861,6 +863,7 @@ impl FortranExtractor {
line: child.start_position().row as u32,
column: child.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
Self::extract_call_sites(state, child, fn_node_id);
Expand Down
1 change: 1 addition & 0 deletions crates/tracedecay-code-extraction/src/fsharp_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ impl FSharpExtractor {
line: child.start_position().row as u32,
column: child.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
Self::extract_calls(state, child, fn_id);
Expand Down
1 change: 1 addition & 0 deletions crates/tracedecay-code-extraction/src/glsl_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ impl GlslExtractor {
line,
column,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
}
Expand Down
4 changes: 4 additions & 0 deletions crates/tracedecay-code-extraction/src/go_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ impl GoExtractor {
line: start_line,
column: start_column,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}

Expand Down Expand Up @@ -713,6 +714,7 @@ impl GoExtractor {
line,
column,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
}
Expand Down Expand Up @@ -1020,6 +1022,7 @@ impl GoExtractor {
line,
column,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
// Also try to create a direct Receives edge if we can find
// the struct node. We look for it by matching name.
Expand Down Expand Up @@ -1152,6 +1155,7 @@ impl GoExtractor {
line: child.start_position().row as u32,
column: child.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
// Also recurse into the call expression for nested calls.
Expand Down
1 change: 1 addition & 0 deletions crates/tracedecay-code-extraction/src/gwbasic_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ impl GwBasicExtractor {
line: node.start_position().row as u32,
column: node.start_position().column as u32,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/tracedecay-code-extraction/src/hlsl_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ impl HlslExtractor {
line,
column,
file_path: state.file_path.clone(),
unmodeled_import: None,
});
}
}
Expand Down
Loading
Loading