# BR-STO-03

When encryption is active, then the conversation identifier stays in clear.

Defined in [Store conversations and protect traces](https://docs.piighost.dev/en/domain/operations/storage-and-encryption/#br-sto-03).

## Where the rule lives

- [`RedisConversationMemory._index_key()`](https://github.com/Athroniaeth/piighost/blob/master/src/piighost/conversation_memory/redis_backend.py#L107)
- [`RedisConversationMemory._message_key()`](https://github.com/Athroniaeth/piighost/blob/master/src/piighost/conversation_memory/redis_backend.py#L111)
- [`SqlAlchemyConversationMemory.__init__()`](https://github.com/Athroniaeth/piighost/blob/master/src/piighost/conversation_memory/sqlalchemy_backend.py#L77)

## Direct tests

- [`tests/conversation_memory/test_sqlalchemy.py::TestConformance::test_satisfies_the_port`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_sqlalchemy.py#L34)
- [`tests/conversation_memory/test_sqlalchemy.py::TestForget::test_forget_reports_and_erases`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_sqlalchemy.py#L96)
- [`tests/conversation_memory/test_sqlalchemy.py::TestForget::test_forget_unknown_thread_reports_zero`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_sqlalchemy.py#L107)
- [`tests/conversation_memory/test_sqlalchemy.py::TestProvenance::test_first_occurrence_role_wins`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_sqlalchemy.py#L85)
- [`tests/conversation_memory/test_sqlalchemy.py::TestRoundTrip::test_clean_message_is_a_hit_with_no_detections`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_sqlalchemy.py#L64)
- [`tests/conversation_memory/test_sqlalchemy.py::TestRoundTrip::test_remembers_and_returns_a_message`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_sqlalchemy.py#L40)
- [`tests/conversation_memory/test_sqlalchemy.py::TestRoundTrip::test_rewriting_a_message_keeps_first_seen_order`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_sqlalchemy.py#L72)
- [`tests/conversation_memory/test_sqlalchemy.py::TestRoundTrip::test_unseen_message_returns_none`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_sqlalchemy.py#L48)
- [`tests/conversation_memory/test_sqlalchemy.py::TestRoundTrip::test_whole_thread_unions_in_first_seen_order`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_sqlalchemy.py#L54)
- [`tests/conversation_memory/test_sqlalchemy.py::TestWarning::test_sqlite_without_crypto_is_silent`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_sqlalchemy.py#L153)

## Indirect tests

- [`tests/acceptance/test_ops.py::TestSharedMemory::test_two_instances_agree_on_a_thread`](https://github.com/Athroniaeth/piighost/blob/master/tests/acceptance/test_ops.py#L59)
- [`tests/conversation_memory/test_redis.py::TestAtRestProtection::test_detections_are_encrypted_at_rest`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L159)
- [`tests/conversation_memory/test_redis.py::TestAtRestProtection::test_message_text_is_not_stored_in_any_key`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L148)
- [`tests/conversation_memory/test_redis.py::TestBatchingAndAtomicity::test_concurrent_identical_remembers_do_not_duplicate`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L64)
- [`tests/conversation_memory/test_redis.py::TestBatchingAndAtomicity::test_union_reads_in_a_single_mget`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L46)
- [`tests/conversation_memory/test_redis.py::TestConformance::test_satisfies_the_port`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L37)
- [`tests/conversation_memory/test_redis.py::TestForget::test_forget_leaves_other_threads`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L137)
- [`tests/conversation_memory/test_redis.py::TestForget::test_forget_purges_and_reports`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L124)
- [`tests/conversation_memory/test_redis.py::TestForget::test_forget_unknown_thread_reports_nothing`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L132)
- [`tests/conversation_memory/test_redis.py::TestGetDetections::test_clean_message_is_a_hit_with_no_detections`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L89)
- [`tests/conversation_memory/test_redis.py::TestGetDetections::test_overwriting_a_message_does_not_duplicate_in_union`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L103)
- [`tests/conversation_memory/test_redis.py::TestGetDetections::test_round_trip_for_a_message`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L77)
- [`tests/conversation_memory/test_redis.py::TestGetDetections::test_union_in_first_seen_order`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L95)
- [`tests/conversation_memory/test_redis.py::TestGetDetections::test_unknown_message_is_a_miss`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L84)
- [`tests/conversation_memory/test_redis.py::TestProvenance::test_default_role_is_user`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L180)
- [`tests/conversation_memory/test_redis.py::TestProvenance::test_records_first_occurrence_role`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L171)
- [`tests/conversation_memory/test_redis.py::TestProvenance::test_unknown_thread_has_no_provenance`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L186)
- [`tests/conversation_memory/test_redis.py::TestRedisPlaintext::test_exactly_one_of_hasher_cipher_is_refused`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L207)
- [`tests/conversation_memory/test_redis.py::TestRedisPlaintext::test_round_trips_without_crypto`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L193)
- [`tests/conversation_memory/test_redis.py::TestThreadIsolation::test_threads_do_not_leak`](https://github.com/Athroniaeth/piighost/blob/master/tests/conversation_memory/test_redis.py#L113)

## Used by

- [`RedisConversationMemory._digests()`](https://github.com/Athroniaeth/piighost/blob/master/src/piighost/conversation_memory/redis_backend.py#L226)
- [`RedisConversationMemory.forget()`](https://github.com/Athroniaeth/piighost/blob/master/src/piighost/conversation_memory/redis_backend.py#L185)
- [`RedisConversationMemory._read_all()`](https://github.com/Athroniaeth/piighost/blob/master/src/piighost/conversation_memory/redis_backend.py#L196)
- [`RedisConversationMemory.remember()`](https://github.com/Athroniaeth/piighost/blob/master/src/piighost/conversation_memory/redis_backend.py#L123)
- [`RedisConversationMemory.get_detections()`](https://github.com/Athroniaeth/piighost/blob/master/src/piighost/conversation_memory/redis_backend.py#L158)

Read from the code graph graphify builds, at the places the domain documentation gives.
