Orchestrata Ultimate › Tests › Reference › knowledge_graph › test_context_injector_coverage

Tests reference — tests/knowledge_graph/test_context_injector_coverage.py

Module of tests/knowledge_graph, split out because the directory page would be too large.

Prose pending.

tests/knowledge_graph/test_context_injector_coverage.py

source · 28 tests · 656 lines

Coverage tests for context_injector.py — uses a real graph driver.

Covers: knowledge_graph.context_injector

Kind Name Line Description
function test_to_prompt_with_all_sections 30
function test_to_prompt_truncates_on_token_limit 64 Long context gets truncated when exceeding max_context_tokens.
function test_inject_with_no_driver_returns_unchanged 101
function test_should_inject_disabled_when_no_driver 108
function test_should_inject_enabled_with_driver_and_valid_subject 114
function test_extract_targets_from_files_created 125
function test_extract_targets_from_project_dir 131
function test_extract_targets_from_file_tree 148
function test_extract_targets_caps_at_thirty 157
function test_inject_attaches_graph_context 170
function test_inject_with_no_targets_skips_context 190
function test_inject_handles_empty_file_match 197 When no files match the target, _query_context returns empty.
function test_inject_resolves_exact_path_with_project_id 211 When project_id is configured, target paths resolve against f.path
function test_inject_avoids_basename_overmatch_when_project_scoped 230 Two files share a basename in different directories. Project-scoped
function test_inject_resolves_canonical_file_id 259 When project_id is configured, File nodes are resolved by canonical
function test_inject_does_not_fall_back_to_basename_when_exact_path_missing 279 The basename heuristic has been removed: a target that matches only
function test_to_prompt_renders_requirements_and_decisions 304
function test_inject_includes_requirements_and_decisions 318 A real File whose Class TRACES_TO a RequirementItem, with a Decision
function test_inject_unifies_requirement_item_with_parent_requirement 358 A symbol tracing to a RequirementItem also surfaces the parent
function test_inject_scopes_semantic_layer_to_project_id 401 Requirements and decisions from other projects must not leak into the
function test_inject_includes_recent_changes_from_change_nodes 452 Explicit (:File)-[:CHANGED_IN]->(:Change) records surface in graph_context.
function test_inject_includes_recent_changes_from_file_timestamp 475 When no Change nodes exist, file.updated_at/synced_at is used as fallback.
function test_inject_recent_changes_project_scoped 495 Recent changes from other projects must not leak when project_id is set.
function test_inject_recent_changes_omits_empty_section 531 When no change data exists, the Recent Changes section is omitted.
function test_inject_includes_similar_patterns_from_base_classes 547 Files whose classes share a base class appear as similar patterns.
function test_inject_includes_similar_patterns_from_inherits_edges 576 Files whose classes INHERIT the same base node appear as similar patterns.
function test_inject_similar_patterns_project_scoped 606 Similar patterns from other projects must not leak when project_id is set.
function test_inject_similar_patterns_omits_empty_section 643 When no shared bases exist, the Similar Patterns section is omitted.