Orchestrata Ultimate › Tests › Reference › session › test_session_integrity

Tests reference — tests/session/test_session_integrity.py

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

Prose pending.

tests/session/test_session_integrity.py

source · 22 tests · 371 lines

Tests for verify_history_integrity() and recover_from_git().

Covers: core.tracing.traceability, session.context, session.models

Kind Name Line Description
class TestVerifyHistoryIntegrity 93 Tests for FR-016: Context Integrity Verification.
method TestVerifyHistoryIntegrity.test_valid_state 96 No gaps, no duplicates, valid continuity: result is valid.
method TestVerifyHistoryIntegrity.test_gap_detection 108 Sessions 3 and 4 missing between history 2 and context 5.
method TestVerifyHistoryIntegrity.test_duplicate_detection 119 Session 3 appears in both history and context.json.
method TestVerifyHistoryIntegrity.test_continuity_violation 129 History max (5) >= context min (3): continuity broken.
method TestVerifyHistoryIntegrity.test_empty_state 139 No files exist: valid by default with empty collections.
method TestVerifyHistoryIntegrity.test_json_only 147 Only context.json exists, no history file: valid.
method TestVerifyHistoryIntegrity.test_history_only 156 Only history exists, no context.json: valid.
method TestVerifyHistoryIntegrity.test_sync_failure 164 context.md content diverges from what context.json would render.
method TestVerifyHistoryIntegrity.test_sync_pass 175 context.md written by mgr.write() passes sync check.
method TestVerifyHistoryIntegrity.test_result_keys_present 187 Result dict always contains the documented keys.
method TestVerifyHistoryIntegrity.test_multiple_gaps 201 Large gap: only sessions 1 and 10 present.
method TestVerifyHistoryIntegrity.test_multiple_duplicates 211 Sessions 2 and 3 duplicated across both files.
class TestRecoverFromGit 238 Tests for FR-017: Git-Based Session Recovery.
method TestRecoverFromGit.test_basic_recovery 255 Session 1 exists in git but not current state: gets recovered.
method TestRecoverFromGit.test_no_git_repo 271 Non-git directory returns empty result without error.
method TestRecoverFromGit.test_no_lost_sessions 278 All sessions already present: nothing to recover.
method TestRecoverFromGit.test_max_commits_limit 287 max_commits parameter caps the scan depth.
method TestRecoverFromGit.test_non_destructive 300 Recovery never overwrites existing history entries.
method TestRecoverFromGit.test_no_context_json_in_git 314 Commits with no context.json: zero commits scanned, nothing recovered.
method TestRecoverFromGit.test_result_keys_present 325 Result dict always contains the documented keys.
method TestRecoverFromGit.test_recovered_sessions_sorted 332 Recovered session numbers are returned sorted.
method TestRecoverFromGit.test_already_present_populated 347 Sessions found in git but already in current state go into already_present.
method TestRecoverFromGit.test_recovery_writes_history_header 359 When history file is absent, recovery creates it with archive header.