Skip to content

Commit 6f8fe99

Browse files
committed
fix: stabilize pr-586 on main by resolving ci blockers
1 parent 44d1382 commit 6f8fe99

6 files changed

Lines changed: 34 additions & 94 deletions

File tree

Cargo.lock

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

crates/terraphim_automata_py/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "terraphim_automata_py"
33
version = "1.0.0"
4-
edition.workspace = true
4+
edition = "2024"
55
authors = ["Terraphim Contributors"]
66
description = "Python bindings for terraphim_automata - Fast autocomplete and text processing for knowledge graphs"
77
documentation = "https://terraphim.ai"

crates/terraphim_types/examples/kg_normalization.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl KgNormalizer {
9595
let path = entry.path();
9696
if path.is_dir() {
9797
visit_dir(&path, docs);
98-
} else if path.extension().map_or(false, |e| e == "md") {
98+
} else if path.extension().is_some_and(|e| e == "md") {
9999
if let Ok(content) = fs::read_to_string(&path) {
100100
let (title, tags, linked_terms) = parse_markdown_frontmatter(&content);
101101
let doc = CorpusDocument {
@@ -272,9 +272,9 @@ fn parse_markdown_frontmatter(content: &str) -> (String, Vec<String>, Vec<String
272272
let mut tags = Vec::new();
273273
let mut linked_terms = Vec::new();
274274

275-
if content.starts_with("---") {
276-
if let Some(end) = content[3..].find("---") {
277-
let frontmatter = &content[3..end + 3];
275+
if let Some(stripped) = content.strip_prefix("---") {
276+
if let Some(end) = stripped.find("---") {
277+
let frontmatter = &stripped[..end];
278278
for line in frontmatter.lines() {
279279
let line = line.trim();
280280
if line.starts_with("title:") {
@@ -314,8 +314,8 @@ fn parse_markdown_frontmatter(content: &str) -> (String, Vec<String>, Vec<String
314314
if title.is_empty() {
315315
for line in content.lines() {
316316
let trimmed = line.trim();
317-
if trimmed.starts_with("# ") {
318-
title = trimmed[2..].to_string();
317+
if let Some(stripped) = trimmed.strip_prefix("# ") {
318+
title = stripped.to_string();
319319
break;
320320
}
321321
}
@@ -342,8 +342,8 @@ fn extract_terms_from_content(content: &str) -> Vec<String> {
342342
// Extract headers
343343
for line in content.lines() {
344344
let trimmed = line.trim();
345-
if trimmed.starts_with("## ") {
346-
let header = trimmed[3..].trim();
345+
if let Some(stripped) = trimmed.strip_prefix("## ") {
346+
let header = stripped.trim();
347347
// Split header into potential terms
348348
for word in header.split(&[',', '-', '/'][..]) {
349349
let word = word.trim();

crates/terraphim_types/examples/ontology_usage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fn example_hgnc_normalization() {
7272

7373
fn example_coverage_signal() {
7474
// Create entities with varying grounding using string-based entity_type
75-
let entities = vec![
75+
let entities = [
7676
ExtractedEntity {
7777
entity_type: "cancer_diagnosis".to_string(),
7878
raw_value: "non-small cell lung cancer".to_string(),

crates/terraphim_types/src/lib.rs

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,25 +2070,20 @@ pub struct AgentCommunication {
20702070
// ============================================================================
20712071

20722072
/// Normalization method used for grounding
2073-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2073+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
20742074
#[serde(rename_all = "snake_case")]
20752075
pub enum NormalizationMethod {
20762076
/// Exact match via Aho-Corasick
2077+
#[default]
20772078
Exact,
20782079
/// Fuzzy match via Levenshtein or Jaro-Winkler
20792080
Fuzzy,
20802081
/// Graph rank-based prioritization
20812082
GraphRank,
20822083
}
20832084

2084-
impl Default for NormalizationMethod {
2085-
fn default() -> Self {
2086-
NormalizationMethod::Exact
2087-
}
2088-
}
2089-
20902085
/// Grounding metadata for normalized terms (Dynamic Ontology)
2091-
#[derive(Debug, Clone, Serialize, Deserialize)]
2086+
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
20922087
pub struct GroundingMetadata {
20932088
/// Canonical URI from ontology (NCIt, HGNC, etc.)
20942089
pub normalized_uri: Option<String>,
@@ -2121,18 +2116,6 @@ impl GroundingMetadata {
21212116
}
21222117
}
21232118

2124-
impl Default for GroundingMetadata {
2125-
fn default() -> Self {
2126-
Self {
2127-
normalized_uri: None,
2128-
normalized_label: None,
2129-
normalized_prov: None,
2130-
normalized_score: None,
2131-
normalized_method: None,
2132-
}
2133-
}
2134-
}
2135-
21362119
/// Coverage governance signal
21372120
#[derive(Debug, Clone, Serialize, Deserialize)]
21382121
pub struct CoverageSignal {

terraphim_ai_nodejs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ crate-type = ["cdylib"]
1111
[dependencies]
1212
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
1313
napi = { version = "3.8.3", default-features = false, features = ["napi8", "tokio_rt"] }
14-
napi-derive = "2.12.2"
14+
napi-derive = "3.5.2"
1515
serde_json = { workspace = true }
1616
terraphim_automata = { path = "../crates/terraphim_automata", default-features = false }
1717
terraphim_service = { path = "../crates/terraphim_service" }

0 commit comments

Comments
 (0)