Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"slice_class": "engine_unwired",
"targeted_mechanism": "none",
"kind": "harness",
"fixtures": [
"crates/aft/tests/integration/tool_call_parity_test.rs",
"crates/aft/src/search_index.rs",
"crates/aft/src/commands/semantic_search/mod.rs",
"crates/aft/src/commands/semantic_search/exact_lane.rs"
],
"slices": [
"views-g-donors-callgraph"
],
"note": "Views-on call-graph reads route through the checkout's v3 view with sealed base donors. Step G touches no ranking-fence file; the fence files in this diff come from step F below it in the stack. Views are default-off, so the benchmark runs the views-off path and ranked rows must remain byte-identical to the committed reference."
}
22 changes: 21 additions & 1 deletion crates/aft/src/callgraph_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9125,7 +9125,12 @@ impl ReadonlyCallGraphStore {
) -> Result<Self> {
let sqlite_path = crate::views::resolve_derived_path(&view_dir, generation)
.map_err(|e| CallGraphStoreError::Unavailable(e.to_string()))?;
let conn = open_readonly_connection(&sqlite_path)?;
// A sealed donor never changes; open it without locks or a WAL.
let conn = if crate::views::donor::is_sealed(&sqlite_path) {
open_sealed_connection(&sqlite_path)?
} else {
open_readonly_connection(&sqlite_path)?
};
ensure_database_ready(&conn)?;
configure_serving_reader(&conn)?;
let mut inner = CallGraphStore::from_connection(
Expand Down Expand Up @@ -11741,6 +11746,21 @@ fn open_readonly_connection(path: &Path) -> Result<TrackedConnection> {
open_readonly_connection_before(path, Instant::now())
}

/// A sealed donor (see `views::donor`) is opened with `immutable=1`: SQLite
/// then takes no locks and never looks for a WAL, which is what lets a
/// worker clone the file with a plain descriptor.
fn open_sealed_connection(path: &Path) -> Result<TrackedConnection> {
crate::private_storage::prepare_sqlite(path, OpenFlags::SQLITE_OPEN_READ_ONLY)?;
let uri = format!("{}&immutable=1", sqlite_readonly_uri(path));
let conn = TrackedConnection::open_with_flags(
&uri,
OpenFlags::SQLITE_OPEN_READ_ONLY | OpenFlags::SQLITE_OPEN_URI,
SqliteStore::CallgraphGeneration,
)?;
conn.execute_batch("PRAGMA query_only=ON;")?;
Ok(conn)
}

fn open_readonly_connection_before(path: &Path, deadline: Instant) -> Result<TrackedConnection> {
crate::private_storage::prepare_sqlite(path, OpenFlags::SQLITE_OPEN_READ_ONLY)?;
let uri = sqlite_readonly_uri(path);
Expand Down
7 changes: 5 additions & 2 deletions crates/aft/src/commands/callgraph_borrowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,12 @@ pub fn disclose_borrowed_answer(

/// Describe the borrowed callgraph this context answers from, or `None` when
/// callgraph answers come from this checkout's own data: the owner checkout,
/// a per-checkout query runtime, or a pinned per-HEAD view.
/// a per-checkout query runtime, a checkout's v3 view or a pinned per-HEAD view.
pub fn borrowed_callgraph(ctx: &AppContext) -> Option<BorrowedCallgraph> {
if !ctx.shared_artifacts_read_only() || ctx.checkout_query_runtime_active() {
if !ctx.shared_artifacts_read_only()
|| ctx.checkout_query_runtime_active()
|| ctx.callgraph_views_enabled()
{
return None;
}
if ctx.config().views.enabled
Expand Down
22 changes: 21 additions & 1 deletion crates/aft/src/commands/callgraph_store_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3058,10 +3058,30 @@ fn content_matches_store(
};
Ok(
stored == crate::cache_freshness::zero_hash().to_hex().as_str()
|| stored == current.to_hex().as_str(),
|| stored == current.to_hex().as_str()
|| stored == view_blob_key(file, current).unwrap_or_default(),
)
}

/// A view-materialized graph records each file's call-graph blob key rather
/// than its raw content hash. The key is derived from the content hash, the
/// file's language and the extractor version, so the current bytes match
/// exactly when they derive the stored key.
fn view_blob_key(file: &str, current: blake3::Hash) -> Option<String> {
let language = if crate::views::assembly::is_resolution_input(file.as_bytes()) {
"config".to_owned()
} else {
format!("{:?}", crate::parser::detect_language(Path::new(file))?).to_lowercase()
};
let key = crate::blob_store::CallgraphKey::from_source_digest(
*current.as_bytes(),
language,
crate::views::callgraph::PRODUCER,
)
.full_key();
Some(crate::blob_store::v2::FamilyKey::from(&key).to_hex())
}

fn file_matches_store(
store: &impl CallGraphRead,
file: &str,
Expand Down
Loading
Loading