Skip to content

Commit ce1ba57

Browse files
author
Test User
committed
Merge remote-tracking branch 'origin/main'
2 parents f96b8b9 + baca48b commit ce1ba57

90 files changed

Lines changed: 1233 additions & 56 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
- **`QualityScore` type** added to `IndexedDocument` and `Document` in `terraphim_types`, carrying `logic_score`, `structure_score`, and `composite` (NaN-guarded) fields for downstream ranking (Refs #547)
13+
- **Rustdoc on `terraphim_server`** added `//!` crate-level doc, struct/enum/field docs and function doc-comments across `src/lib.rs`, `src/error.rs`, `src/api.rs`, and all `src/workflows/` sub-modules -- `RUSTDOCFLAGS="-W missing-docs" cargo doc --no-deps` now produces zero warnings
14+
- **Rustdoc on core public types** added doc comments to `ServiceError`, `TerraphimService`, middleware `Error`, rolegraph `Error`, `split_paragraphs`, `DocumentType`, `RouteDirective`, `MarkdownDirectives`, `Edge`, `ChatMessage`, and `Priority` across four crates (Refs #547)
15+
- **Orchestrator webhook fix** resolves project from repo for unqualified `@adf:` mentions
16+
- **Provider probe timeout** increased from 60s to 120s for reliability
17+
- **Orchestrator fallback** triggers fallback provider on `rate_limit` exit when KG routing fails
18+
- **ADF config validation** added for `grace_period`, `max_cpu`, and `probe_ttl`
19+
- **Build-runner-llm** agent with Graph-first System, cost tracking, and BUILD.md build sequences
20+
- **Rate-limit backoff** enabled by default in orchestrator; `RATE_LIMIT_BACKOFF_ENABLED` env var wired to systemd service
1221
- **Intra-doc link fixes** resolved broken rustdoc links and unclosed HTML tag warnings across `terraphim_orchestrator`, `terraphim_types`, `terraphim_tracker` — cargo doc now produces zero warnings on all core crates
1322
- **Unique tempdir** in `test_tool_index_save_and_load` to eliminate cross-run state pollution (Refs #1340)
1423
- **Module-level rustdoc** added to `terraphim_dsm` and `terraphim_github_runner_server` — the final two binary crates lacking a crate-level `//!` comment
@@ -42,6 +51,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4251

4352
### Fixed
4453

54+
- **`min_quality` threshold clamped** to `[0.0, 1.0]` in `apply_min_quality_filter`; negative values are now treated as zero rather than silently excluding all documents (Refs #1459)
55+
- **Unit tests for `apply_min_quality_filter`** cover zero, midpoint, boundary, and negative-threshold cases to prevent regression (Refs #1459)
4556
- **World-readable sensitive config files** now emit tracing error/warn at load time via `warn_if_world_readable()` in orchestrator config and all `conf.d` include files (Refs #826)- **RUSTSEC-2026-0049** eliminated by switching serenity to native-tls (Refs #418)
4657
- **Spec gaps** addressed and resolved across ADF orchestrator templates (Refs #1040)
4758
- **Global concurrency limits** enforced in orchestrator to prevent task/memory exhaustion (Refs #664)

crates/haystack_jmap/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ pub fn email_to_document(email: &Email) -> Document {
421421
synonyms: None,
422422
route: None,
423423
priority: None,
424+
quality_score: None,
424425
}
425426
}
426427

crates/terraphim-markdown-parser/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ pub fn blocks_to_documents(source_id: &str, normalized: &NormalizedMarkdown) ->
204204
synonyms: None,
205205
route: None,
206206
priority: None,
207+
quality_score: None,
207208
}
208209
})
209210
.collect()

crates/terraphim_agent/src/main.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,9 @@ enum Command {
716716
/// Include pinned KG entries in results
717717
#[arg(long, default_value_t = false)]
718718
include_pinned: bool,
719+
/// Minimum composite quality score (0.0-1.0). Excludes documents below this threshold.
720+
#[arg(long)]
721+
min_quality: Option<f64>,
719722
},
720723
/// Manage roles (list, select)
721724
Roles {
@@ -2048,6 +2051,7 @@ async fn run_offline_command(
20482051
limit,
20492052
fail_on_empty,
20502053
include_pinned,
2054+
min_quality,
20512055
} => {
20522056
let (role_name, auto) = service
20532057
.resolve_or_auto_route(role.as_deref(), &query)
@@ -2091,14 +2095,24 @@ async fn run_offline_command(
20912095
include_pinned,
20922096
role: Some(role_name.clone()),
20932097
layer: Layer::default(),
2098+
min_quality,
20942099
};
20952100

20962101
service.search_with_query(&search_query).await?
20972102
} else {
2098-
// Single term query (backward compatibility)
2099-
service
2100-
.search_with_role(&query, &role_name, Some(limit))
2101-
.await?
2103+
// Single term query
2104+
let search_query = SearchQuery {
2105+
search_term: NormalizedTermValue::from(query.as_str()),
2106+
search_terms: None,
2107+
operator: None,
2108+
skip: Some(0),
2109+
limit: Some(limit),
2110+
include_pinned,
2111+
role: Some(role_name.clone()),
2112+
layer: Layer::default(),
2113+
min_quality,
2114+
};
2115+
service.search_with_query(&search_query).await?
21022116
};
21032117

21042118
let results_count = results.len();
@@ -4095,6 +4109,7 @@ async fn run_server_command(
40954109
limit,
40964110
fail_on_empty: _,
40974111
include_pinned,
4112+
min_quality,
40984113
} => {
40994114
// Get selected role from server if not specified
41004115
let role_name = if let Some(role) = role {
@@ -4121,6 +4136,7 @@ async fn run_server_command(
41214136
role: Some(role_name),
41224137
layer: Layer::default(),
41234138
include_pinned,
4139+
min_quality,
41244140
}
41254141
} else {
41264142
// Single term query (backward compatibility)
@@ -4133,6 +4149,7 @@ async fn run_server_command(
41334149
role: Some(role_name),
41344150
layer: Layer::default(),
41354151
include_pinned,
4152+
min_quality,
41364153
}
41374154
};
41384155

@@ -5124,6 +5141,7 @@ fn ui_loop(
51245141
role: Some(RoleName::new(&role)),
51255142
layer: Layer::default(),
51265143
include_pinned: false,
5144+
min_quality: None,
51275145
};
51285146
backend.search(&q).await
51295147
}) {

crates/terraphim_agent/src/repl/handler.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ impl ReplHandler {
540540
role: role_name,
541541
layer: Layer::default(),
542542
include_pinned: false,
543+
min_quality: None,
543544
};
544545

545546
match api_client.search(&search_query).await {
@@ -891,6 +892,7 @@ impl ReplHandler {
891892
synonyms: None,
892893
route: None,
893894
priority: None,
895+
quality_score: None,
894896
};
895897

896898
match api_client

crates/terraphim_agent/src/service.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,13 +324,16 @@ impl TuiService {
324324
role: Some(role.clone()),
325325
layer: Layer::default(),
326326
include_pinned: false,
327+
min_quality: None,
327328
};
328329

329330
let mut service = self.service.lock().await;
330331
Ok(service.search(&query).await?)
331332
}
332333

333334
/// Search documents using a complete SearchQuery (supports logical operators)
335+
///
336+
/// Quality filtering via `query.min_quality` is applied by the underlying service.
334337
pub async fn search_with_query(&self, query: &SearchQuery) -> Result<Vec<Document>> {
335338
let mut service = self.service.lock().await;
336339
Ok(service.search(query).await?)

crates/terraphim_agent/src/shared_learning/store.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,6 +1368,7 @@ mod tests {
13681368
synonyms: None,
13691369
route: None,
13701370
priority: None,
1371+
quality_score: None,
13711372
};
13721373
let learning_id = "learning-graph-test";
13731374
graph.insert_document(learning_id, doc);

crates/terraphim_agent/tests/cross_mode_consistency_test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ async fn search_via_server(
253253
role: Some(RoleName::new(role)),
254254
layer: Layer::default(),
255255
include_pinned: false,
256+
min_quality: None,
256257
};
257258

258259
let response = client.search(&search_query).await?;

crates/terraphim_agent/tests/error_handling_test.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ async fn test_malformed_server_response() {
9494
role: Some(RoleName::new("Default")),
9595
layer: Layer::default(),
9696
include_pinned: false,
97+
min_quality: None,
9798
};
9899

99100
let result = client.search(&extreme_query).await;
@@ -141,6 +142,7 @@ async fn test_invalid_role_handling() {
141142
role: Some(RoleName::new("CompleteLyInvalidRoleName12345")),
142143
layer: Layer::default(),
143144
include_pinned: false,
145+
min_quality: None,
144146
};
145147

146148
let result = client.search(&invalid_query).await;
@@ -206,6 +208,7 @@ async fn test_empty_and_special_character_queries() {
206208
role: Some(RoleName::new("Default")),
207209
layer: Layer::default(),
208210
include_pinned: false,
211+
min_quality: None,
209212
};
210213

211214
let result = client.search(&search_query).await;
@@ -261,6 +264,7 @@ async fn test_concurrent_request_handling() {
261264
role: Some(RoleName::new("Default")),
262265
layer: Layer::default(),
263266
include_pinned: false,
267+
min_quality: None,
264268
};
265269
client_clone.search(&query).await
266270
});
@@ -371,6 +375,7 @@ async fn test_summarization_error_handling() {
371375
synonyms: None,
372376
route: None,
373377
priority: None,
378+
quality_score: None,
374379
};
375380

376381
let result = client
@@ -527,6 +532,7 @@ async fn test_graceful_degradation() {
527532
role: Some(RoleName::new("Default")),
528533
layer: Layer::default(),
529534
include_pinned: false,
535+
min_quality: None,
530536
};
531537
client
532538
.search(&query)

crates/terraphim_agent/tests/integration_test.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ async fn test_api_client_search() {
6060
role: Some(RoleName::new("Terraphim Engineer")),
6161
layer: Layer::default(),
6262
include_pinned: false,
63+
min_quality: None,
6364
};
6465

6566
let result = client.search(&query).await;
@@ -212,6 +213,7 @@ async fn test_search_with_different_roles() {
212213
role: Some(RoleName::new(role_name)),
213214
layer: Layer::default(),
214215
include_pinned: false,
216+
min_quality: None,
215217
};
216218

217219
let result = client.search(&query).await;
@@ -255,6 +257,7 @@ async fn test_search_pagination() {
255257
role: Some(RoleName::new("Default")),
256258
layer: Layer::default(),
257259
include_pinned: false,
260+
min_quality: None,
258261
};
259262

260263
let result1 = client.search(&query1).await;
@@ -270,6 +273,7 @@ async fn test_search_pagination() {
270273
role: Some(RoleName::new("Default")),
271274
layer: Layer::default(),
272275
include_pinned: false,
276+
min_quality: None,
273277
};
274278

275279
let result2 = client.search(&query2).await;
@@ -464,6 +468,7 @@ async fn test_api_error_handling() {
464468
role: Some(RoleName::new("NonExistentRole")),
465469
layer: Layer::default(),
466470
include_pinned: false,
471+
min_quality: None,
467472
};
468473

469474
let result = client.search(&query).await;

0 commit comments

Comments
 (0)