Orchestrata Ultimate › Tests › Reference › context

Tests reference — tests/context

tests/context — 8 test modules, 77 test functions (cumulative over subdirectories). Source tree: tests/context at commit 8a2cb42ad. Generated from the tests AST snapshot by scripts/gen-data-pages.py.

Prose pending.

Subdirectories

Directory Modules Tests
providers/ 5 41

Modules

Module Tests Covers
test_assembler.py 21 10
test_budget.py 11 1
test_usage_log.py 4 1

Module details

tests/context/test_assembler.py

source · 21 tests · 466 lines

Unit tests for context_assembler.py.

Covers: context.assembler, context.budget, context.providers.semantic_context, knowledge_graph.context_injector, memory.memory_context, memory.memory_engine, orchestrator.artifact_store, semantic_graph.config, session.models, core.graph/ (package)

Kind Name Line Description
class TestUnifiedContextAssembler 24
method TestUnifiedContextAssembler.test_assemble_returns_all_context_layers 25
method TestUnifiedContextAssembler.test_assemble_includes_plan_layer_from_goal_tasks 47 When ContextData carries an active goal with tasks, the plan layer
method TestUnifiedContextAssembler.test_assemble_plan_layer_empty_without_goal_tasks 81 No goal means no plan layer — the part stays empty but present.
method TestUnifiedContextAssembler.test_assemble_plan_layer_uses_current_step 94 When current_step is set, the plan layer renders that task as current
method TestUnifiedContextAssembler.test_assemble_includes_ast_context_for_target_files 124 When payload carries target files, the assembler injects AST signals.
method TestUnifiedContextAssembler.test_assemble_threads_project_id_to_ast_context 150 When the assembler is configured with a project_id, the AST context
method TestUnifiedContextAssembler.test_assemble_with_disabled_injector_does_not_add_graph_context 166
method TestUnifiedContextAssembler.test_assemble_counts_user_tokens 177
method TestUnifiedContextAssembler.test_assemble_respects_budget_for_user_layer 188
method TestUnifiedContextAssembler.test_assemble_preserves_payload 199
method TestUnifiedContextAssembler.test_assemble_includes_memory_when_engine_registered 209
method TestUnifiedContextAssembler.test_assemble_includes_semantic_layer_key 240 The semantic layer is part of the assembled context parts.
method TestUnifiedContextAssembler.test_assemble_uses_store_ranked_digest_when_available 251 When the artifact store exposes render_artifact_digest, the assembler
method TestUnifiedContextAssembler.test_assemble_trims_oversized_artifact_layer 287 An artifact layer that exceeds its budget is trimmed at natural
method TestUnifiedContextAssembler.test_assemble_falls_back_to_provider_when_store_digest_raises 318 A store render_artifact_digest that raises is tolerated; the generic
class TestContextPackCaching 349
method TestContextPackCaching.test_repeated_assemble_uses_pack_cache 355 Two identical assemble calls hit the pack cache and return the same
method TestContextPackCaching.test_different_payload_misses_cache 374 A different payload fingerprint produces a cache miss.
method TestContextPackCaching.test_snapshot_change_invalidates_cache 389 A different snapshot_id bypasses the cached pack.
class TestSemanticContextProvider 407
method TestSemanticContextProvider.test_render_semantic_context_empty_for_irrelevant_subject 408 Subjects outside the semantic recall set do not trigger backend calls.
method TestSemanticContextProvider.test_render_semantic_context_degrades_when_memgraph_unreachable 421 When Memgraph is unreachable the provider returns "" without failing.
method TestSemanticContextProvider.test_render_semantic_context_extracts_file_terms 443 File basenames are fed into keyword extraction even without message terms.

tests/context/test_budget.py

source · 11 tests · 122 lines

Unit tests for context_budget.py.

Covers: context.budget

Kind Name Line Description
class TestContextBudget 14
method TestContextBudget.test_budget_accepts_exact_allocation 15
method TestContextBudget.test_budget_accepts_under_allocation 33
method TestContextBudget.test_budget_rejects_over_allocation 38
method TestContextBudget.test_layer_budget_returns_value 47
method TestContextBudget.test_layer_budget_rejects_unknown_layer 52
class TestContextUsage 58
method TestContextUsage.test_usage_tracks_spend 59
method TestContextUsage.test_usage_rejects_exceeding_layer_budget 70
method TestContextUsage.test_usage_tracks_total_against_budget 77
method TestContextUsage.test_usage_rejects_negative_spend 85
method TestContextUsage.test_usage_rejects_unknown_layer 91
method TestContextUsage.test_usage_to_dict_includes_all_layers 97

tests/context/test_usage_log.py

source · 4 tests · 94 lines

Observed tests for context-usage logging and aggregation.

Covers: context.usage_log

Kind Name Line Description
class TestContextUsageLog 12
method TestContextUsageLog.test_write_and_read_usage_record 13
method TestContextUsageLog.test_read_skips_corrupt_lines 37
method TestContextUsageLog.test_aggregate_usage_computes_totals 44
method TestContextUsageLog.test_write_uses_env_override 84