Skip to content

test(knowledge_engine): 补齐 index.rs 与 index_state.rs 单元测试#20

Merged
juice094 merged 11 commits into
mainfrom
test/coverage-knowledge-engine
May 11, 2026
Merged

test(knowledge_engine): 补齐 index.rs 与 index_state.rs 单元测试#20
juice094 merged 11 commits into
mainfrom
test/coverage-knowledge-engine

Conversation

@juice094
Copy link
Copy Markdown
Owner

变更概要

  • 修复 SCHEMA_DDL 缺失 repo_index_state 表(测试基础设施补齐)
  • 调整 registry/test_helpers 可见性为 pub,供跨模块测试复用
  • index.rs: 新增 prepare_repos 4 场景测试 + save_repo_index_state 1 场景测试
  • index_state.rs: 新增 get_repo_index_state 4 状态测试(Missing/Fresh/Stale/Unknown)及行为方法测试

检查项

  • cargo test --all-targets 全绿(437 passed / 0 failed)
  • cargo clippy --all-targets -- -D warnings 零警告
  • cargo fmt --check 通过
  • 新增代码无生产环境 unwrap

juice094 added 11 commits May 11, 2026 20:46
- Extend RegistryClient with save_relation, query_relations, delete_relations, list_vault_notes
- Add WorkflowClient trait (list_workflows, get_workflow, run_workflow, get_execution)
- Add VaultClient trait (list_vault_notes, read_vault_note, get_backlinks, build_vault_graph)
- Implement all traits on AppContext (registry.rs, workflow/mod.rs, vault/mod.rs)
- Enable AppContext Clone via Arc<Mutex<EnvVersionCache>> for spawn_blocking safety
- Refactor relations.rs, workflow.rs, vault.rs to use trait calls exclusively
- Eliminate all production-code inline crate:: calls in mcp/tools/ relations|workflow|vault
…inate loop-level I/O

- index_repo: accept Config by parameter instead of loading internally
- daemon.rs: load Config once before indexing loop
- run_index_with_progress: hoist Config::load() out of repo loop
- Extract prepare_repos() pure helper for path resolution / auto-registration
- Result: ~20 fewer inline crate:: calls, eliminated repeated disk I/O in hot loop
…xing

- Extract index_repo_core() with explicit writer/schema parameters
- index_repo() retains legacy behavior (creates standalone writer)
- Add index_repo_with_writer() for batch callers
- daemon.rs: init writer once before loop, commit once after loop
- Eliminates N-1 redundant Tantivy init/get_writer/commit cycles
- Add  rustdoc to 7 core modules:
  i18n, knowledge_engine, workflow, registry, storage, daemon, embedding
- Clarify  rationale in i18n/mod.rs
- Create ADR-004: MCP Tool Layer Trait Decoupling
- Create ADR-005: AppContext Clone for Async Context Propagation
- Update ADR index with ADR-003/004/005
- CONTRIBUTING.md: update health metrics to v0.15.0 / 427 tests / AGPL-3.0+
- SECURITY.md: update supported version to 0.15.x
- Create CODE_OF_CONDUCT.md (Contributor Covenant v2.0)
- Create SUPPORT.md (docs, issues, discussions, commercial support)
- Create .github/PULL_REQUEST_TEMPLATE.md with checklist
- Create .github/ISSUE_TEMPLATE/bug_report.md
- Create .github/ISSUE_TEMPLATE/feature_request.md
- Create .github/ISSUE_TEMPLATE/config.yml (disable blank issues)
- 修复 SCHEMA_DDL 缺失 repo_index_state 表(测试基础设施)
- 将 registry/test_helpers 可见性调整为 pub(跨模块测试共享)
- index.rs: 覆盖 prepare_repos (4 场景) + save_repo_index_state (1 场景)
- index_state.rs: 覆盖 get_repo_index_state (4 状态测试) 及行为方法测试
- 修复 Windows 短文件名路径断言兼容性
- 新增 coverage_report.txt 到 .gitignore
@juice094 juice094 force-pushed the test/coverage-knowledge-engine branch from 69eb364 to 63293c1 Compare May 11, 2026 15:57
@juice094 juice094 merged commit dc695e0 into main May 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant