Orchestrata Ultimate › Tests › Reference › scripts › test_claude_turn_capture

Tests reference — tests/scripts/test_claude_turn_capture.py

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

Prose pending.

tests/scripts/test_claude_turn_capture.py

source · 58 tests · 1377 lines

Tests for scripts/claude_turn_capture.py — the SPEC-021 Claude Code

Covers: core.graph.interfaces, core.graph.repository, knowledge_graph.conversation_consumer

Kind Name Line Description
function test_user_prompt_submit_captures_one_user_turn 177
function test_user_prompt_submit_skips_blank_prompt 210
function test_stop_captures_assistant_delta_from_real_transcript 227
function test_stop_skips_tool_use_only_message 276 An assistant entry with only a tool_use block (no text) has empty
function test_stop_records_tool_calls_on_a_turn_that_has_both 313 The field the producer always sent empty.
function test_stop_attaches_held_tool_calls_to_the_next_turn_with_prose 357 A tool-only entry cannot carry a turn — the consumer requires non-blank
function test_stop_holds_tool_calls_across_cycles_when_the_delta_ends_on_a_tool 404 The carry is in Redis, not just in the loop.
function test_session_seq_stable_across_two_invocations 458
function test_kill_switch_disables_capture 510
function test_fail_open_on_unreachable_redis 534
function test_queue_is_bounded_by_ltrim 564
function test_stop_refire_is_merge_idempotent_at_consumer 591 A hook re-fire (e.g. a crash between LPUSH and marking last_uuid)
function test_end_to_end_producer_through_consumer_to_neo4j 650
function test_queue_key_default_and_override 728
function test_now_iso_is_a_parseable_utc_timestamp 733
function test_build_redis_client_uses_env_host_port_db 741
function test_get_or_create_session_seq_returns_cached_value_when_already_mapped 855 When the hash already maps this session_id (the common repeat-call
function test_get_or_create_session_seq_lost_race_adopts_winners_value 873 Real concurrency (no mocks): several threads race to allocate a
function test_enqueue_lpush_and_ltrim 912
function test_run_kill_switch_returns_before_touching_stdin_or_redis 1119
function test_run_blank_stdin_is_a_noop 1139
function test_run_malformed_json_is_a_noop 1143
function test_run_non_dict_json_is_a_noop 1147
function test_run_unknown_hook_event_name_is_a_noop 1151
function test_run_dispatches_user_prompt_submit_end_to_end 1174
function test_run_dispatches_stop_end_to_end 1209
function test_run_fail_open_on_unreachable_redis_direct 1249 A real dead-port Redis client (not a mock) raised deep inside the
function test_conversation_redis_config_raises_when_unset_or_malformed 1288
function test_unset_conversation_keys_do_not_fall_back_to_ambient_redis_and_log_one_line 1308 A healthy ambient REDIS_* must NOT receive the turn when the dedicated
function test_unreachable_conversation_redis_logs_one_line 1331
function test_capture_log_defaults_under_home_local_state 1351
function test_hook_subprocess_with_unset_keys_exits_zero_and_logs 1356
class TestResolveProject 758
method TestResolveProject.test_env_override_wins 759
method TestResolveProject.test_prefers_pyproject_name_over_cwd_basename 767 Canonical Project.slug is pyproject [project].name — the checkout
method TestResolveProject.test_invalid_pyproject_falls_back_to_basename 774
method TestResolveProject.test_falls_back_to_cwd_basename 778
method TestResolveProject.test_falls_back_to_transcript_parent_when_no_cwd 781
method TestResolveProject.test_returns_none_when_nothing_resolves 787
class TestExtractAssistantText 792
method TestExtractAssistantText.test_string_content 793
method TestExtractAssistantText.test_text_blocks_joined_tool_use_skipped 797
method TestExtractAssistantText.test_no_message_key 809
method TestExtractAssistantText.test_non_dict_message 812
method TestExtractAssistantText.test_content_not_list_or_str 815
method TestExtractAssistantText.test_text_block_missing_text_field 818
class TestReadAssistantEntries 823
method TestReadAssistantEntries.test_skips_malformed_lines_and_non_assistant 824
method TestReadAssistantEntries.test_missing_file_returns_empty_list 837
class TestDeltaSince 841
method TestDeltaSince.test_no_marker_returns_all 842
method TestDeltaSince.test_marker_found_returns_suffix 846
method TestDeltaSince.test_marker_not_found_returns_all 850
class TestHandleUserPromptSubmitDirect 930
method TestHandleUserPromptSubmitDirect.test_missing_prompt_is_a_noop 931
method TestHandleUserPromptSubmitDirect.test_missing_session_id_is_a_noop 940
method TestHandleUserPromptSubmitDirect.test_unresolvable_project_is_a_noop 951
method TestHandleUserPromptSubmitDirect.test_valid_event_enqueues_one_message 961
class TestHandleStopDirect 990
method TestHandleStopDirect.test_missing_session_id_is_a_noop 991
method TestHandleStopDirect.test_missing_transcript_path_is_a_noop 1001
method TestHandleStopDirect.test_unresolvable_project_is_a_noop 1009 A bare (no directory component) transcript path has an empty
method TestHandleStopDirect.test_nonexistent_transcript_file_is_a_noop 1030
method TestHandleStopDirect.test_valid_event_enqueues_delta_and_skips_tool_use_only 1045