Skip to content

Commit 18dc944

Browse files
authored
fix(native): restore cargo test --lib green (#978)
Three pre-existing failures surfaced by `cargo test --lib`, none of which CI catches (CI only runs `cargo check --workspace`): - `tree-sitter-scala 0.25` and `tree-sitter-swift 0.7` emit ABI-15 grammars, but the workspace pins `tree-sitter = "0.24"` (supports up to ABI-14). Loading either grammar raised `LanguageError { version: 15 }`, breaking all 10 Scala/Swift extractor tests. Downgrade to the last 0.24-compatible releases (0.24.1 / 0.6.0). - `BuildSettings` derived `Default`, which gave `incremental: false` via `bool::default()`. `BuildConfig::build` is `#[serde(default)]`, so deserializing `{}` fell through to `BuildSettings::default()` and disagreed with the `#[serde(default = "default_true")]` field attribute. Implement `Default` manually so both paths agree. Full suite now: 176 passed, 0 failed (was 165 passed, 11 failed). docs check acknowledged — change is an internal grammar-crate downgrade and a Default-impl bug fix; no user-facing API, language support, or architecture change.
1 parent 30c8564 commit 18dc944

3 files changed

Lines changed: 20 additions & 8 deletions

File tree

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/codegraph-core/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ tree-sitter-php = "0.23"
2525
tree-sitter-c = "0.23"
2626
tree-sitter-cpp = "0.23"
2727
tree-sitter-kotlin-sg = "0.4"
28-
tree-sitter-swift = "0.7"
29-
tree-sitter-scala = "0.25"
28+
tree-sitter-swift = "0.6"
29+
tree-sitter-scala = "0.24"
3030
tree-sitter-bash = "0.23"
3131
tree-sitter-hcl = "1"
3232
tree-sitter-elixir = "0.3"

crates/codegraph-core/src/config.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub struct BuildConfig {
2323
pub aliases: std::collections::HashMap<String, String>,
2424
}
2525

26-
#[derive(Debug, Clone, Deserialize, Default)]
26+
#[derive(Debug, Clone, Deserialize)]
2727
#[serde(rename_all = "camelCase")]
2828
pub struct BuildSettings {
2929
/// Whether incremental builds are enabled (default: true).
@@ -35,6 +35,18 @@ pub struct BuildSettings {
3535
pub drift_threshold: f64,
3636
}
3737

38+
// Manual impl so `BuildSettings::default()` matches the serde field defaults.
39+
// `#[derive(Default)]` would give `incremental: false`, which disagrees with
40+
// `#[serde(default = "default_true")]` when the outer `build` key is absent.
41+
impl Default for BuildSettings {
42+
fn default() -> Self {
43+
Self {
44+
incremental: default_true(),
45+
drift_threshold: default_drift_threshold(),
46+
}
47+
}
48+
}
49+
3850
fn default_true() -> bool {
3951
true
4052
}

0 commit comments

Comments
 (0)