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

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ homepage = "https://github.com/rabii-chaarani/codebaseGraph"
readme = "README.md"
keywords = ["codebase", "graph", "mcp", "cli", "analysis"]
categories = ["command-line-utilities", "development-tools"]
exclude = ["assets/ladybug-extensions/0.17.0/win_amd64/**"]
exclude = ["assets/ladybug-extensions/0.18.1/win_amd64/**"]

[workspace]
members = [".", "crates/k-wiki", "crates/xtask"]
Expand All @@ -24,7 +24,7 @@ bundled-windows-extensions = []

[dependencies]
fs2 = "0.4.3"
lbug = "0.17.1"
lbug = "0.18.3"
notify = "8.2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
33 changes: 33 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,37 @@ fn main() {
println!("cargo:rustc-link-search=native={}", path.display());
}
}

if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos")
&& std::env::var("CARGO_CFG_TARGET_ARCH").as_deref() == Ok("x86_64")
{
link_macos_x86_compiler_runtime();
}
}

fn link_macos_x86_compiler_runtime() {
println!("cargo:rerun-if-env-changed=DEVELOPER_DIR");
let output = std::process::Command::new("xcrun")
.args(["clang", "--print-resource-dir"])
.output()
.expect("macOS x86_64 builds require xcrun and clang");
assert!(
output.status.success(),
"xcrun clang --print-resource-dir failed with {}",
output.status
);

let resource_dir =
String::from_utf8(output.stdout).expect("clang resource directory must be valid UTF-8");
let library_dir = std::path::Path::new(resource_dir.trim())
.join("lib")
.join("darwin");
let runtime = library_dir.join("libclang_rt.osx.a");
assert!(
runtime.is_file(),
"macOS compiler runtime not found at {}",
runtime.display()
);
println!("cargo:rustc-link-search=native={}", library_dir.display());
println!("cargo:rustc-link-lib=static=clang_rt.osx");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
agent_memory:
version: 1
kind: procedural
scope: repository
status: active
owner: codex
created_at: 2026-08-14T15:05:00+09:30
last_verified_at: 2026-08-14T15:06:00+09:30
verified_by: codex
review_after: null
supersedes:
- ladybug-release-extension-cache-variants-2026-08-13
superseded_by: null
sources:
- kind: ci-log
reference: GitHub Actions run 31770156177 job 94674205658
content_hash: null
- kind: source
reference: Cargo.toml and Cargo.lock pin lbug 0.18.3
content_hash: null
- kind: source
reference: lbug 0.18.3 build.rs removes bundled component relinking and bundled CMakeLists.txt declares LBUG_EXTENSION_VERSION=0.18.1
content_hash: null
- kind: test
reference: db_writer::extensions::tests::supports_prebuilt_and_source_built_ladybug_extension_cache_versions
content_hash: null
- kind: test
reference: db_writer::tests::native_writer_loads_json_staging_through_ladybug_copy and adapters::cli::tests::graph::graph_search_reads_native_fts_indexes
content_hash: null
history:
- from: candidate
to: active
actor: codex
at: 2026-08-14T15:06:00+09:30
reason: Verified against the failing CI linker command, the lbug 0.17.1 and 0.18.3 build scripts, the 0.18.3 bundled CMake extension version, official 0.18.1 extension binaries, a successful crates.io dry-run, and passing JSON/FTS runtime tests.
description: lbug 0.18.3 fixes the 0.17.1 source-link fallback but requires matching 0.18.1 extension binaries and cache paths.
tags:
- ci
- crates-io
- extensions
- ladybug
- linker
- release
timestamp: 2026-08-14T15:05:00+09:30
title: Align Ladybug source linking and extension ABI when upgrading lbug
type: agent-memory
---
When `cargo publish --dry-run` verifies the crates.io tarball without an external `LBUG_LIBRARY_DIR`, `lbug 0.17.1` can fall back to a source build that whole-archives both `liblbug.a` and its component archives, producing duplicate symbols. Upgrade to `lbug 0.18.3` or later with the source-link fix, and keep its native extension ABI aligned: the bundled Ladybug source in 0.18.3 declares `LBUG_EXTENSION_VERSION=0.18.1`, so vendored JSON/FTS binaries and the seeded `.lbdb/extension/0.18.1/<platform>` paths must come from the official 0.18.1 extension repository. Never copy older extension bytes into the new cache directory; JSON may appear to work while FTS fails at load time with unresolved C++ symbols. Verify both `cargo publish --dry-run --locked` and focused JSON/FTS runtime tests after the upgrade.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
agent_memory:
version: 1
kind: procedural
scope: repository
status: active
owner: codex
created_at: 2026-08-14T15:42:00+09:30
last_verified_at: 2026-08-14T15:43:00+09:30
verified_by: codex
review_after: null
supersedes: []
superseded_by: null
sources:
- kind: ci-log
reference: GitHub Actions run 31773525988 job 94684123400, undefined ___cpu_model on macos-x86_64
content_hash: null
- kind: source
reference: build.rs link_macos_x86_compiler_runtime
content_hash: null
- kind: ci-log
reference: GitHub Actions run 31774057855, all native targets and required check successful
content_hash: null
history:
- from: candidate
to: active
actor: codex
at: 2026-08-14T15:43:00+09:30
reason: Verified against the failed macOS Intel linker command and the subsequent hosted CI run where macOS Intel, Linux, Apple Silicon, Windows, publish verification, and the required aggregate all succeeded.
description: Ladybug's macOS x86 static archive needs LLVM's CPU-model runtime in Rust's nodefaultlibs final link.
tags:
- ci
- ladybug
- linker
- macos
- release
- x86_64
timestamp: 2026-08-14T15:42:00+09:30
title: Link LLVM compiler runtime for Ladybug on macOS Intel
type: agent-memory
---
When linking the prebuilt Ladybug 0.18.3 static archive for `x86_64-apple-darwin`, the archive can reference `__cpu_model`. Rust invokes the final C linker with `-nodefaultlibs`, so Clang does not automatically add the compiler runtime and the native artifact build fails with an undefined `___cpu_model` symbol. For macOS x86_64 only, resolve the active Clang resource directory through `xcrun clang --print-resource-dir`, add its `lib/darwin` directory to the native link search, and statically link `libclang_rt.osx.a`. Do not add this link to Linux, Apple Silicon, or Windows. Verify the repair with the hosted `macos-x86_64` native artifact build and smoke test, then confirm every other native matrix target remains green.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ agent_memory:
version: 1
kind: procedural
scope: repository
status: active
status: superseded
owner: codex
created_at: 2026-08-13T00:00:00+09:30
last_verified_at: 2026-08-13T00:00:00+09:30
verified_by: codex
review_after: null
supersedes: []
superseded_by: null
superseded_by: ladybug-0183-link-and-extension-alignment-2026-08-14
sources:
- kind: commit
reference: 'ba7ed2f fix(release): seed both Ladybug extension caches'
Expand All @@ -33,6 +33,11 @@ agent_memory:
actor: codex
at: 2026-08-13T00:00:00+09:30
reason: Verified against the distinct 0.19.0 source-built and 0.17.0 prebuilt Ladybug cache requests in the failing logs, and the successful Ubuntu and Windows native-package smoke tests in run 31671399427.
- from: active
to: superseded
actor: codex
at: 2026-08-14T15:07:00+09:30
reason: The repository now uses lbug 0.18.3 consistently for source and prebuilt modes, so both require ABI-compatible 0.18.1 extension binaries instead of seeding 0.17.0 and 0.19.0 copies.
description: Prebuilt and source-built Ladybug libraries can resolve the same bundled extensions from different cache-version paths.
tags:
- ci
Expand Down
42 changes: 17 additions & 25 deletions src/db_writer/extensions.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use crate::error::NativeError;
use std::path::{Path, PathBuf};

// Prebuilt Ladybug 0.17.x libraries look in the 0.17.0 cache, while the
// source-built release library resolves the same extensions from 0.19.0.
// Seed both compatible cache locations so packaged binaries never download
// extensions at runtime.
const LADYBUG_EXTENSION_CACHE_VERSIONS: [&str; 2] = ["0.17.0", "0.19.0"];
// Both the prebuilt and source-built Ladybug 0.18.3 libraries resolve
// extensions from this ABI-compatible cache path. Seed it so packaged
// binaries never download extensions at runtime.
const LADYBUG_EXTENSION_CACHE_VERSIONS: [&str; 1] = ["0.18.1"];

pub fn preseed_ladybug_extensions(include_fts: bool) -> Result<(), NativeError> {
let home = ladybug_home_dir()?;
Expand Down Expand Up @@ -73,10 +72,10 @@ fn ladybug_platform() -> Option<&'static str> {
fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> {
match extension {
"json" => Some(include_bytes!(
"../../assets/ladybug-extensions/0.17.0/linux_amd64/json/libjson.lbug_extension"
"../../assets/ladybug-extensions/0.18.1/linux_amd64/json/libjson.lbug_extension"
)),
"fts" => Some(include_bytes!(
"../../assets/ladybug-extensions/0.17.0/linux_amd64/fts/libfts.lbug_extension"
"../../assets/ladybug-extensions/0.18.1/linux_amd64/fts/libfts.lbug_extension"
)),
_ => None,
}
Expand All @@ -86,10 +85,10 @@ fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> {
fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> {
match extension {
"json" => Some(include_bytes!(
"../../assets/ladybug-extensions/0.17.0/linux_arm64/json/libjson.lbug_extension"
"../../assets/ladybug-extensions/0.18.1/linux_arm64/json/libjson.lbug_extension"
)),
"fts" => Some(include_bytes!(
"../../assets/ladybug-extensions/0.17.0/linux_arm64/fts/libfts.lbug_extension"
"../../assets/ladybug-extensions/0.18.1/linux_arm64/fts/libfts.lbug_extension"
)),
_ => None,
}
Expand All @@ -99,10 +98,10 @@ fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> {
fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> {
match extension {
"json" => Some(include_bytes!(
"../../assets/ladybug-extensions/0.17.0/osx_amd64/json/libjson.lbug_extension"
"../../assets/ladybug-extensions/0.18.1/osx_amd64/json/libjson.lbug_extension"
)),
"fts" => Some(include_bytes!(
"../../assets/ladybug-extensions/0.17.0/osx_amd64/fts/libfts.lbug_extension"
"../../assets/ladybug-extensions/0.18.1/osx_amd64/fts/libfts.lbug_extension"
)),
_ => None,
}
Expand All @@ -112,10 +111,10 @@ fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> {
fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> {
match extension {
"json" => Some(include_bytes!(
"../../assets/ladybug-extensions/0.17.0/osx_arm64/json/libjson.lbug_extension"
"../../assets/ladybug-extensions/0.18.1/osx_arm64/json/libjson.lbug_extension"
)),
"fts" => Some(include_bytes!(
"../../assets/ladybug-extensions/0.17.0/osx_arm64/fts/libfts.lbug_extension"
"../../assets/ladybug-extensions/0.18.1/osx_arm64/fts/libfts.lbug_extension"
)),
_ => None,
}
Expand All @@ -129,10 +128,10 @@ fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> {
fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> {
match extension {
"json" => Some(include_bytes!(
"../../assets/ladybug-extensions/0.17.0/win_amd64/json/libjson.lbug_extension"
"../../assets/ladybug-extensions/0.18.1/win_amd64/json/libjson.lbug_extension"
)),
"fts" => Some(include_bytes!(
"../../assets/ladybug-extensions/0.17.0/win_amd64/fts/libfts.lbug_extension"
"../../assets/ladybug-extensions/0.18.1/win_amd64/fts/libfts.lbug_extension"
)),
_ => None,
}
Expand Down Expand Up @@ -160,17 +159,10 @@ mod tests {

#[test]
fn supports_prebuilt_and_source_built_ladybug_extension_cache_versions() {
assert_eq!(super::LADYBUG_EXTENSION_CACHE_VERSIONS, ["0.18.1"]);
assert_eq!(
super::LADYBUG_EXTENSION_CACHE_VERSIONS,
["0.17.0", "0.19.0"]
);
assert_eq!(
extension_dir(Path::new("cache"), "0.17.0", "win_amd64", "json"),
PathBuf::from("cache/.lbdb/extension/0.17.0/win_amd64/json")
);
assert_eq!(
extension_dir(Path::new("cache"), "0.19.0", "linux_amd64", "json"),
PathBuf::from("cache/.lbdb/extension/0.19.0/linux_amd64/json")
extension_dir(Path::new("cache"), "0.18.1", "osx_arm64", "json"),
PathBuf::from("cache/.lbdb/extension/0.18.1/osx_arm64/json")
);
}
}