use super::*;

#[test]
fn builds_infrastructure_asset_trace_report_with_alias_disproved_status() {
    let mut analysis = empty_analysis_report();
    analysis.placed_structure_record_triplets = Some(SmpSavePlacedStructureRecordTripletProbe {
        profile_family: analysis.profile_family.clone(),
        source_kind: "save-placed-structure-triplets".to_string(),
        semantic_family: "placed-structure-triplets".to_string(),
        records_tag_offset: 0,
        close_tag_offset: 0,
        record_count: 2057,
        entries: Vec::new(),
        evidence: Vec::new(),
    });
    analysis.placed_structure_dynamic_side_buffer =
            Some(SmpSavePlacedStructureDynamicSideBufferProbe {
                profile_family: analysis.profile_family.clone(),
                source_kind: "save-side-buffer".to_string(),
                semantic_family: "infrastructure-asset".to_string(),
                metadata_tag_offset: 0,
                records_tag_offset: 0,
                close_tag_offset: 0,
                records_span_len: 0,
                direct_record_stride: 6,
                direct_record_stride_hex: "0x00000006".to_string(),
                live_id_bound: 3865,
                live_id_bound_hex: "0x00000f19".to_string(),
                live_record_count: 3865,
                live_record_count_hex: "0x00000f19".to_string(),
                owner_shared_dword: 0xff000000,
                owner_shared_dword_hex: "0xff000000".to_string(),
                owner_shared_dword_relative_offset: 0,
                owner_shared_dword_matches_first_compact_prefix_leading_dword: true,
                first_record_child_count_after_owner_shared: Some(1),
                first_record_child_count_after_owner_shared_hex: Some("0x0001".to_string()),
                first_record_saved_primary_child_byte_after_owner_shared: Some(0xff),
                first_record_saved_primary_child_byte_after_owner_shared_hex: Some(
                    "0xff".to_string(),
                ),
                first_record_first_name_tag_relative_offset_after_owner_shared: Some(3),
                prefix_leading_dword: 0xff000000,
                prefix_leading_dword_hex: "0xff000000".to_string(),
                prefix_trailing_word: 1,
                prefix_trailing_word_hex: "0x0001".to_string(),
                prefix_separator_byte: 0xff,
                prefix_separator_byte_hex: "0xff".to_string(),
                first_embedded_name_tag_relative_offset: 0x20,
                embedded_name_tag_count: 138,
                decoded_embedded_name_row_count: 138,
                decoded_embedded_name_row_with_tertiary_name_count: 0,
                unique_compact_prefix_pattern_count: 7,
                prefix_leading_dword_matching_embedded_profile_tag_count: 17,
                unique_embedded_name_pair_count: 5,
                first_embedded_primary_name: Some("TrackCapST_Cap.3dp".to_string()),
                first_embedded_secondary_name: Some("Infrastructure".to_string()),
                first_embedded_tertiary_name: None,
                embedded_name_row_samples: Vec::new(),
                compact_prefix_pattern_summaries: Vec::new(),
                name_pair_summaries: vec![SmpSavePlacedStructureDynamicSideBufferNamePairSummary {
                    primary_name: "TrackCapST_Cap.3dp".to_string(),
                    secondary_name: "Infrastructure".to_string(),
                    count: 12,
                    first_name_tag_relative_offset: 0x20,
                    unique_compact_prefix_pattern_count: 2,
                    dominant_prefix_leading_dword: 0xff0000ff,
                    dominant_prefix_leading_dword_hex: "0xff0000ff".to_string(),
                    dominant_prefix_trailing_word: 1,
                    dominant_prefix_trailing_word_hex: "0x0001".to_string(),
                    dominant_prefix_separator_byte: 0xff,
                    dominant_prefix_separator_byte_hex: "0xff".to_string(),
                    dominant_prefix_count: 9,
                }],
                payload_envelope_summary: Some(
                    SmpSavePlacedStructureDynamicSideBufferPayloadEnvelopeSummary {
                        row_count_with_policy_tag_before_next_name: 120,
                        row_count_with_complete_0x55f1_0x55f2_0x55f3_envelope: 118,
                        row_count_missing_policy_tag_before_next_name: 18,
                        row_count_missing_profile_tag_after_policy: 2,
                        unique_policy_chunk_lens: vec![0x1a, 0x24],
                        unique_profile_chunk_lens: vec![0x08, 0x14],
                        dominant_policy_chunk_len: Some(0x1a),
                        dominant_policy_chunk_len_count: 110,
                        dominant_profile_chunk_len: Some(0x08),
                        dominant_profile_chunk_len_count: 90,
                        short_profile_flag_pair_summary: Some(
                            SmpSavePlacedStructureDynamicSideBufferShortProfileFlagPairSummary {
                                row_count_with_0x06_profile_span: 72,
                                unique_flag_pair_count: 2,
                                dominant_first_flag_byte: Some(0x01),
                                dominant_first_flag_byte_hex: Some("0x01".to_string()),
                                dominant_first_flag_byte_count: 60,
                                dominant_second_flag_byte: Some(0x00),
                                dominant_second_flag_byte_hex: Some("0x00".to_string()),
                                dominant_second_flag_byte_count: 55,
                                dominant_flag_pair: Some(
                                    SmpSavePlacedStructureDynamicSideBufferShortProfileFlagPair {
                                        first_flag_byte: 0x01,
                                        first_flag_byte_hex: "0x01".to_string(),
                                        second_flag_byte: 0x00,
                                        second_flag_byte_hex: "0x00".to_string(),
                                        count: 48,
                                    },
                                ),
                                sample_rows: Vec::new(),
                            },
                        ),
                        fixed_policy_summary: Some(
                            SmpSavePlacedStructureDynamicSideBufferFixedPolicySummary {
                                row_count_with_0x1a_policy_chunk: 118,
                                unique_trailing_word_count: 1,
                                dominant_trailing_word: Some(1),
                                dominant_trailing_word_hex: Some("0x0001".to_string()),
                                dominant_trailing_word_count: 118,
                                compact_prefix_correlations: Vec::new(),
                                sample_rows: Vec::new(),
                            },
                        ),
                        name_prelude_candidate_summary: Some(
                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCandidateSummary {
                                row_count_with_candidate_window: 118,
                                unique_candidate_pattern_count: 2,
                                dominant_child_count_candidate: Some(1),
                                dominant_child_count_candidate_count: 110,
                                dominant_saved_primary_child_byte_candidate: Some(0xff),
                                dominant_saved_primary_child_byte_candidate_hex: Some(
                                    "0xff".to_string(),
                                ),
                                dominant_saved_primary_child_byte_candidate_count: 110,
                                dominant_candidate_pattern: Some(
                                    SmpSavePlacedStructureDynamicSideBufferNamePreludeCandidatePattern {
                                        child_count_candidate: 1,
                                        child_count_candidate_hex: "0x0001".to_string(),
                                        saved_primary_child_byte_candidate: 0xff,
                                        saved_primary_child_byte_candidate_hex: "0xff".to_string(),
                                        count: 110,
                                    },
                                ),
                                candidate_pattern_correlations: vec![
                                    SmpSavePlacedStructureDynamicSideBufferNamePreludeCandidatePatternCorrelation {
                                        child_count_candidate: 2,
                                        child_count_candidate_hex: "0x0002".to_string(),
                                        saved_primary_child_byte_candidate: 0xff,
                                        saved_primary_child_byte_candidate_hex: "0xff".to_string(),
                                        row_count: 18,
                                        unique_name_pair_count: 1,
                                        unique_profile_span_count: 1,
                                        dominant_primary_name: Some(
                                            "BridgeSTWood_Section.3dp".to_string(),
                                        ),
                                        dominant_secondary_name: Some(
                                            "Infrastructure".to_string(),
                                        ),
                                        dominant_name_pair_count: 18,
                                        dominant_profile_span: Some(6),
                                        dominant_profile_span_count: 10,
                                        dominant_mode_family: Some("bridge".to_string()),
                                        dominant_mode_family_count: 18,
                                        mode_family_counts: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeModeFamilyCount {
                                                mode_family: "bridge".to_string(),
                                                count: 18,
                                            },
                                        ],
                                        sample_rows: Vec::new(),
                                    },
                                ],
                                profile_span_correlations: vec![
                                    SmpSavePlacedStructureDynamicSideBufferNamePreludeProfileSpanCorrelation {
                                        previous_profile_chunk_len_to_next_name_or_end: 3,
                                        row_count: 17,
                                        dominant_child_count_candidate: Some(1),
                                        dominant_child_count_candidate_count: 17,
                                        dominant_saved_primary_child_byte_candidate: Some(0xff),
                                        dominant_saved_primary_child_byte_candidate_hex: Some(
                                            "0xff".to_string(),
                                        ),
                                        dominant_saved_primary_child_byte_candidate_count: 17,
                                        dominant_candidate_pattern: Some(
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCandidatePattern {
                                                child_count_candidate: 1,
                                                child_count_candidate_hex: "0x0001".to_string(),
                                                saved_primary_child_byte_candidate: 0xff,
                                                saved_primary_child_byte_candidate_hex: "0xff"
                                                    .to_string(),
                                                count: 17,
                                            },
                                        ),
                                        dominant_mode_family: Some("tunnel".to_string()),
                                        dominant_mode_family_count: 15,
                                        mode_family_counts: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeModeFamilyCount {
                                                mode_family: "track_cap".to_string(),
                                                count: 2,
                                            },
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeModeFamilyCount {
                                                mode_family: "tunnel".to_string(),
                                                count: 15,
                                            },
                                        ],
                                        compact_prefix_pattern_summaries: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeProfileSpanPrefixSummary {
                                                prefix_leading_dword: 0x0000_55f3,
                                                prefix_leading_dword_hex: "0x000055f3".to_string(),
                                                prefix_trailing_word: 0x0001,
                                                prefix_trailing_word_hex: "0x0001".to_string(),
                                                prefix_separator_byte: 0xff,
                                                prefix_separator_byte_hex: "0xff".to_string(),
                                                count: 17,
                                            },
                                        ],
                                        sample_rows: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeProfileSpanSample {
                                                sample_index: 0,
                                                name_tag_relative_offset: 1200,
                                                primary_name: Some("TunnelSTBrick_Section.3dp".to_string()),
                                                secondary_name: Some("Infrastructure".to_string()),
                                                prefix_leading_dword: 0x0000_55f3,
                                                prefix_leading_dword_hex: "0x000055f3".to_string(),
                                                prefix_trailing_word: 0x0001,
                                                prefix_trailing_word_hex: "0x0001".to_string(),
                                                prefix_separator_byte: 0xff,
                                                prefix_separator_byte_hex: "0xff".to_string(),
                                                child_count_candidate: 1,
                                                child_count_candidate_hex: "0x0001".to_string(),
                                                saved_primary_child_byte_candidate: 0xff,
                                                saved_primary_child_byte_candidate_hex: "0xff".to_string(),
                                            },
                                        ],
                                    },
                                    SmpSavePlacedStructureDynamicSideBufferNamePreludeProfileSpanCorrelation {
                                        previous_profile_chunk_len_to_next_name_or_end: 6,
                                        row_count: 72,
                                        dominant_child_count_candidate: Some(1),
                                        dominant_child_count_candidate_count: 62,
                                        dominant_saved_primary_child_byte_candidate: Some(0xff),
                                        dominant_saved_primary_child_byte_candidate_hex: Some(
                                            "0xff".to_string(),
                                        ),
                                        dominant_saved_primary_child_byte_candidate_count: 72,
                                        dominant_candidate_pattern: Some(
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCandidatePattern {
                                                child_count_candidate: 1,
                                                child_count_candidate_hex: "0x0001".to_string(),
                                                saved_primary_child_byte_candidate: 0xff,
                                                saved_primary_child_byte_candidate_hex: "0xff"
                                                    .to_string(),
                                                count: 62,
                                            },
                                        ),
                                        dominant_mode_family: Some("bridge".to_string()),
                                        dominant_mode_family_count: 72,
                                        mode_family_counts: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeModeFamilyCount {
                                                mode_family: "bridge".to_string(),
                                                count: 72,
                                            },
                                        ],
                                        compact_prefix_pattern_summaries: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeProfileSpanPrefixSummary {
                                                prefix_leading_dword: 0xff00_0000,
                                                prefix_leading_dword_hex: "0xff000000".to_string(),
                                                prefix_trailing_word: 0x0001,
                                                prefix_trailing_word_hex: "0x0001".to_string(),
                                                prefix_separator_byte: 0xff,
                                                prefix_separator_byte_hex: "0xff".to_string(),
                                                count: 72,
                                            },
                                        ],
                                        sample_rows: vec![],
                                    },
                                    SmpSavePlacedStructureDynamicSideBufferNamePreludeProfileSpanCorrelation {
                                        previous_profile_chunk_len_to_next_name_or_end: 0x27,
                                        row_count: 3,
                                        dominant_child_count_candidate: Some(1),
                                        dominant_child_count_candidate_count: 3,
                                        dominant_saved_primary_child_byte_candidate: Some(0xff),
                                        dominant_saved_primary_child_byte_candidate_hex: Some(
                                            "0xff".to_string(),
                                        ),
                                        dominant_saved_primary_child_byte_candidate_count: 3,
                                        dominant_candidate_pattern: Some(
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCandidatePattern {
                                                child_count_candidate: 1,
                                                child_count_candidate_hex: "0x0001".to_string(),
                                                saved_primary_child_byte_candidate: 0xff,
                                                saved_primary_child_byte_candidate_hex: "0xff"
                                                    .to_string(),
                                                count: 3,
                                            },
                                        ),
                                        dominant_mode_family: Some("bridge".to_string()),
                                        dominant_mode_family_count: 2,
                                        mode_family_counts: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeModeFamilyCount {
                                                mode_family: "bridge".to_string(),
                                                count: 2,
                                            },
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeModeFamilyCount {
                                                mode_family: "tunnel".to_string(),
                                                count: 1,
                                            },
                                        ],
                                        compact_prefix_pattern_summaries: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeProfileSpanPrefixSummary {
                                                prefix_leading_dword: 0xff00_00ff,
                                                prefix_leading_dword_hex: "0xff0000ff".to_string(),
                                                prefix_trailing_word: 0x0001,
                                                prefix_trailing_word_hex: "0x0001".to_string(),
                                                prefix_separator_byte: 0xff,
                                                prefix_separator_byte_hex: "0xff".to_string(),
                                                count: 1,
                                            },
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeProfileSpanPrefixSummary {
                                                prefix_leading_dword: 0xff00_00ff,
                                                prefix_leading_dword_hex: "0xff0000ff".to_string(),
                                                prefix_trailing_word: 0x0002,
                                                prefix_trailing_word_hex: "0x0002".to_string(),
                                                prefix_separator_byte: 0xff,
                                                prefix_separator_byte_hex: "0xff".to_string(),
                                                count: 2,
                                            },
                                        ],
                                        sample_rows: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeProfileSpanSample {
                                                sample_index: 0,
                                                name_tag_relative_offset: 2805,
                                                primary_name: Some("TunnelSTBrick_Section.3dp".to_string()),
                                                secondary_name: Some("Infrastructure".to_string()),
                                                prefix_leading_dword: 0xff00_00ff,
                                                prefix_leading_dword_hex: "0xff0000ff".to_string(),
                                                prefix_trailing_word: 0x0001,
                                                prefix_trailing_word_hex: "0x0001".to_string(),
                                                prefix_separator_byte: 0xff,
                                                prefix_separator_byte_hex: "0xff".to_string(),
                                                child_count_candidate: 1,
                                                child_count_candidate_hex: "0x0001".to_string(),
                                                saved_primary_child_byte_candidate: 0xff,
                                                saved_primary_child_byte_candidate_hex: "0xff".to_string(),
                                            },
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeProfileSpanSample {
                                                sample_index: 1,
                                                name_tag_relative_offset: 3764,
                                                primary_name: Some("BridgeSTWood_Section.3dp".to_string()),
                                                secondary_name: Some("Infrastructure".to_string()),
                                                prefix_leading_dword: 0xff00_00ff,
                                                prefix_leading_dword_hex: "0xff0000ff".to_string(),
                                                prefix_trailing_word: 0x0002,
                                                prefix_trailing_word_hex: "0x0002".to_string(),
                                                prefix_separator_byte: 0xff,
                                                prefix_separator_byte_hex: "0xff".to_string(),
                                                child_count_candidate: 1,
                                                child_count_candidate_hex: "0x0001".to_string(),
                                                saved_primary_child_byte_candidate: 0xff,
                                                saved_primary_child_byte_candidate_hex: "0xff".to_string(),
                                            },
                                        ],
                                    },
                                ],
                                compact_prefix_correlations: vec![
                                    SmpSavePlacedStructureDynamicSideBufferNamePreludeCompactPrefixCorrelation {
                                        prefix_leading_dword: 0x0000_55f3,
                                        prefix_leading_dword_hex: "0x000055f3".to_string(),
                                        prefix_trailing_word: 0x0001,
                                        prefix_trailing_word_hex: "0x0001".to_string(),
                                        prefix_separator_byte: 0xff,
                                        prefix_separator_byte_hex: "0xff".to_string(),
                                        row_count: 17,
                                        unique_name_pair_count: 2,
                                        unique_profile_span_count: 1,
                                        dominant_primary_name: Some("TunnelSTBrick_Section.3dp".to_string()),
                                        dominant_secondary_name: Some("Infrastructure".to_string()),
                                        dominant_name_pair_count: 15,
                                        dominant_profile_span: Some(3),
                                        dominant_profile_span_count: 17,
                                        dominant_candidate_pattern: Some(
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCandidatePattern {
                                                child_count_candidate: 1,
                                                child_count_candidate_hex: "0x0001".to_string(),
                                                saved_primary_child_byte_candidate: 0xff,
                                                saved_primary_child_byte_candidate_hex: "0xff".to_string(),
                                                count: 17,
                                            },
                                        ),
                                        dominant_mode_family: Some("tunnel".to_string()),
                                        dominant_mode_family_count: 15,
                                        mode_family_counts: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeModeFamilyCount {
                                                mode_family: "track_cap".to_string(),
                                                count: 2,
                                            },
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeModeFamilyCount {
                                                mode_family: "tunnel".to_string(),
                                                count: 15,
                                            },
                                        ],
                                        name_pair_summaries: vec![
                                            SmpSavePlacedStructureDynamicSideBufferDominantProfileSpanNamePairSummary {
                                                primary_name: Some("TunnelSTBrick_Section.3dp".to_string()),
                                                secondary_name: Some("Infrastructure".to_string()),
                                                count: 15,
                                            },
                                            SmpSavePlacedStructureDynamicSideBufferDominantProfileSpanNamePairSummary {
                                                primary_name: Some("TrackCapST_Cap.3dp".to_string()),
                                                secondary_name: Some("Infrastructure".to_string()),
                                                count: 2,
                                            },
                                        ],
                                        profile_span_counts: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCompactPrefixProfileSpanCount {
                                                previous_profile_chunk_len_to_next_name_or_end: 3,
                                                count: 17,
                                            },
                                        ],
                                        rows_with_previous_short_profile_flag_pair: 17,
                                        previous_short_profile_flag_pair_counts: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCompactPrefixFlagPairCount {
                                                first_flag_byte: 0x00,
                                                first_flag_byte_hex: "0x00".to_string(),
                                                second_flag_byte: 0x01,
                                                second_flag_byte_hex: "0x01".to_string(),
                                                count: 17,
                                            },
                                        ],
                                        sample_rows: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCompactPrefixSample {
                                                sample_index: 0,
                                                name_tag_relative_offset: 1200,
                                                primary_name: Some("TunnelSTBrick_Section.3dp".to_string()),
                                                secondary_name: Some("Infrastructure".to_string()),
                                                child_count_candidate: 1,
                                                child_count_candidate_hex: "0x0001".to_string(),
                                                saved_primary_child_byte_candidate: 0xff,
                                                saved_primary_child_byte_candidate_hex: "0xff".to_string(),
                                                previous_profile_chunk_len_to_next_name_or_end: Some(3),
                                            },
                                        ],
                                    },
                                    SmpSavePlacedStructureDynamicSideBufferNamePreludeCompactPrefixCorrelation {
                                        prefix_leading_dword: 0xff00_00ff,
                                        prefix_leading_dword_hex: "0xff0000ff".to_string(),
                                        prefix_trailing_word: 0x0001,
                                        prefix_trailing_word_hex: "0x0001".to_string(),
                                        prefix_separator_byte: 0xff,
                                        prefix_separator_byte_hex: "0xff".to_string(),
                                        row_count: 1,
                                        unique_name_pair_count: 1,
                                        unique_profile_span_count: 1,
                                        dominant_primary_name: Some("TunnelSTBrick_Section.3dp".to_string()),
                                        dominant_secondary_name: Some("Infrastructure".to_string()),
                                        dominant_name_pair_count: 1,
                                        dominant_profile_span: Some(0x27),
                                        dominant_profile_span_count: 1,
                                        dominant_candidate_pattern: Some(
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCandidatePattern {
                                                child_count_candidate: 1,
                                                child_count_candidate_hex: "0x0001".to_string(),
                                                saved_primary_child_byte_candidate: 0xff,
                                                saved_primary_child_byte_candidate_hex: "0xff".to_string(),
                                                count: 1,
                                            },
                                        ),
                                        dominant_mode_family: Some("tunnel".to_string()),
                                        dominant_mode_family_count: 1,
                                        mode_family_counts: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeModeFamilyCount {
                                                mode_family: "tunnel".to_string(),
                                                count: 1,
                                            },
                                        ],
                                        name_pair_summaries: vec![
                                            SmpSavePlacedStructureDynamicSideBufferDominantProfileSpanNamePairSummary {
                                                primary_name: Some("TunnelSTBrick_Section.3dp".to_string()),
                                                secondary_name: Some("Infrastructure".to_string()),
                                                count: 1,
                                            },
                                        ],
                                        profile_span_counts: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCompactPrefixProfileSpanCount {
                                                previous_profile_chunk_len_to_next_name_or_end: 0x27,
                                                count: 1,
                                            },
                                        ],
                                        rows_with_previous_short_profile_flag_pair: 1,
                                        previous_short_profile_flag_pair_counts: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCompactPrefixFlagPairCount {
                                                first_flag_byte: 0x00,
                                                first_flag_byte_hex: "0x00".to_string(),
                                                second_flag_byte: 0x01,
                                                second_flag_byte_hex: "0x01".to_string(),
                                                count: 1,
                                            },
                                        ],
                                        sample_rows: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCompactPrefixSample {
                                                sample_index: 0,
                                                name_tag_relative_offset: 2805,
                                                primary_name: Some("TunnelSTBrick_Section.3dp".to_string()),
                                                secondary_name: Some("Infrastructure".to_string()),
                                                child_count_candidate: 1,
                                                child_count_candidate_hex: "0x0001".to_string(),
                                                saved_primary_child_byte_candidate: 0xff,
                                                saved_primary_child_byte_candidate_hex: "0xff".to_string(),
                                                previous_profile_chunk_len_to_next_name_or_end: Some(0x27),
                                            },
                                        ],
                                    },
                                    SmpSavePlacedStructureDynamicSideBufferNamePreludeCompactPrefixCorrelation {
                                        prefix_leading_dword: 0xff00_00ff,
                                        prefix_leading_dword_hex: "0xff0000ff".to_string(),
                                        prefix_trailing_word: 0x0002,
                                        prefix_trailing_word_hex: "0x0002".to_string(),
                                        prefix_separator_byte: 0xff,
                                        prefix_separator_byte_hex: "0xff".to_string(),
                                        row_count: 2,
                                        unique_name_pair_count: 1,
                                        unique_profile_span_count: 1,
                                        dominant_primary_name: Some("BridgeSTWood_Section.3dp".to_string()),
                                        dominant_secondary_name: Some("Infrastructure".to_string()),
                                        dominant_name_pair_count: 2,
                                        dominant_profile_span: Some(0x27),
                                        dominant_profile_span_count: 2,
                                        dominant_candidate_pattern: Some(
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCandidatePattern {
                                                child_count_candidate: 1,
                                                child_count_candidate_hex: "0x0001".to_string(),
                                                saved_primary_child_byte_candidate: 0xff,
                                                saved_primary_child_byte_candidate_hex: "0xff".to_string(),
                                                count: 2,
                                            },
                                        ),
                                        dominant_mode_family: Some("bridge".to_string()),
                                        dominant_mode_family_count: 2,
                                        mode_family_counts: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeModeFamilyCount {
                                                mode_family: "bridge".to_string(),
                                                count: 2,
                                            },
                                        ],
                                        name_pair_summaries: vec![
                                            SmpSavePlacedStructureDynamicSideBufferDominantProfileSpanNamePairSummary {
                                                primary_name: Some("BridgeSTWood_Section.3dp".to_string()),
                                                secondary_name: Some("Infrastructure".to_string()),
                                                count: 2,
                                            },
                                        ],
                                        profile_span_counts: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCompactPrefixProfileSpanCount {
                                                previous_profile_chunk_len_to_next_name_or_end: 0x27,
                                                count: 2,
                                            },
                                        ],
                                        rows_with_previous_short_profile_flag_pair: 2,
                                        previous_short_profile_flag_pair_counts: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCompactPrefixFlagPairCount {
                                                first_flag_byte: 0x00,
                                                first_flag_byte_hex: "0x00".to_string(),
                                                second_flag_byte: 0x01,
                                                second_flag_byte_hex: "0x01".to_string(),
                                                count: 2,
                                            },
                                        ],
                                        sample_rows: vec![
                                            SmpSavePlacedStructureDynamicSideBufferNamePreludeCompactPrefixSample {
                                                sample_index: 0,
                                                name_tag_relative_offset: 3764,
                                                primary_name: Some("BridgeSTWood_Section.3dp".to_string()),
                                                secondary_name: Some("Infrastructure".to_string()),
                                                child_count_candidate: 1,
                                                child_count_candidate_hex: "0x0001".to_string(),
                                                saved_primary_child_byte_candidate: 0xff,
                                                saved_primary_child_byte_candidate_hex: "0xff".to_string(),
                                                previous_profile_chunk_len_to_next_name_or_end: Some(0x27),
                                            },
                                        ],
                                    },
                                ],
                                sample_rows: Vec::new(),
                            },
                        ),
                        dominant_profile_span_class_summary: None,
                        sample_rows: Vec::new(),
                    },
                ),
                live_entry_prelude_summary: Some(
                    SmpSavePlacedStructureDynamicSideBufferLiveEntryPreludeSummary {
                        live_entry_directory_row_count: 3865,
                        decoded_live_entry_id_count: 3865,
                        payload_relative_offset_monotonic: true,
                        rows_with_payload_pointer_inside_records_span: 138,
                        rows_with_zero_child_count: 0,
                        rows_with_nonzero_child_count: 138,
                        rows_with_first_name_tag_after_prelude: 138,
                        rows_with_first_name_tag_at_offset_3: 138,
                        unique_child_count_values: vec![1],
                        unique_first_name_tag_relative_offsets: vec![3],
                        dominant_child_count: Some(1),
                        dominant_child_count_count: 138,
                        dominant_saved_primary_child_byte: Some(0),
                        dominant_saved_primary_child_byte_hex: Some("0x00".to_string()),
                        dominant_saved_primary_child_byte_count: 138,
                        dominant_first_name_tag_relative_offset: Some(3),
                        dominant_first_name_tag_relative_offset_count: 138,
                        sample_rows: Vec::new(),
                    },
                ),
                evidence: Vec::new(),
            });
    analysis.placed_structure_dynamic_side_buffer_alignment =
        Some(SmpSavePlacedStructureDynamicSideBufferAlignmentProbe {
            unique_side_buffer_name_pair_count: 5,
            unique_triplet_name_pair_count: 56,
            overlapping_name_pair_count: 0,
            side_buffer_row_count: 138,
            side_buffer_rows_with_matching_triplet_name_pair_count: 0,
            side_buffer_rows_without_matching_triplet_name_pair_count: 138,
            triplet_name_pairs_without_side_buffer_match_count: 56,
            matched_name_pair_samples: Vec::new(),
            unmatched_side_buffer_name_pair_samples: Vec::new(),
            evidence: Vec::new(),
        });

    let trace = build_infrastructure_asset_trace_report(&analysis);
    assert!(trace.side_buffer_present);
    assert_eq!(trace.triplet_alignment_overlap_count, 0);
    assert_eq!(trace.known_owner_bridge_fields.len(), 7);
    assert_eq!(trace.known_bridge_helpers.len(), 21);
    assert_eq!(trace.next_owner_questions.len(), 4);
    assert!(trace.next_owner_questions.iter().any(|line| {
        line.contains("compact-prefix regimes subdivide")
            && line.contains("0x0a BallastCap")
            && line.contains("0x0b TrackCap")
            && line.contains("0x02 Tunnel")
            && line.contains("0x01 Bridge")
    }));
    assert!(trace.next_owner_questions.iter().any(|line| {
        line.contains("direct route-entry bridge helpers")
            && line.contains("0x00448a70/0x00493660/0x0048b660")
            && line.contains("[this+0x248]")
            && line.contains("cache/cleanup state")
    }));
    assert!(
        trace
            .known_bridge_helpers
            .iter()
            .any(|line| line.contains("0x004a2c80/0x004a34e0")
                && line.contains("paired upstream infrastructure composition choosers")
                && line.contains("BallastCap/Overpass"))
    );
    assert!(trace.known_bridge_helpers.iter().any(
        |line| line.contains("0x0048a340") && line.contains("[0x226]/[0x219]/[0x251]/bit 0x20")
    ));
    assert!(
        trace
            .known_bridge_helpers
            .iter()
            .any(|line| line.contains("0x00455a40") && line.contains("slot +0x44"))
    );
    assert!(
        trace
            .known_bridge_helpers
            .iter()
            .any(|line| line.contains("0x004559d0") && line.contains("0x55f1/0x55f2/0x55f3"))
    );
    assert!(
        trace
            .known_bridge_helpers
            .iter()
            .any(|line| line.contains("0x00490960") && line.contains("selector propagator"))
    );
    assert!(
        trace
            .known_bridge_helpers
            .iter()
            .any(|line| line.contains("0x00490200") && line.contains("route/link comparator"))
    );
    assert_eq!(trace.candidate_consumer_hypotheses.len(), 3);
    assert_eq!(
        trace.candidate_consumer_hypotheses[0].status,
        "highest_priority_static_mapping_target"
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("0x004a2c80 routes the DT family")
                && line.contains("0x004a34e0 routes the ST family")
                && line.contains("0x0048a340/0x0048f4c0/0x00490200/0x00490960"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("0x621a44/0x621a54 feed BridgeST")
                && line.contains("0x621a94 feeds TunnelDT variants")
                && line.contains("BallastCapDT/ST")
                && line.contains("OverpassDT/ST"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(
                |line| line.contains("[this+0x226]==1 routes bridge families")
                    && line.contains("[this+0x226]==2 routes tunnel families")
                    && line.contains("[this+0x226]==3 routes overpass/ballast families")
                    && line.contains("bit 0x20 in [this+0x24c]")
            )
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(
                |line| line.contains("0x0048a340 as the exact chooser-state setter")
                    && line.contains("[this+0x226]")
                    && line.contains("[this+0x219]")
                    && line.contains("[this+0x251]")
                    && line.contains("[this+0x24c]")
            )
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(
                |line| line.contains("[this+0x219] indexes Steel/Stone/Wood tables")
                    && line.contains("value 2 takes the special suspension-cap path")
                    && line.contains("[this+0x251] selects Brick versus Concrete")
            )
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("[this+0x252]")
                && line.contains("R10, L10, 12, 14, 16, and 18")
                && line.contains("BridgeDT/BridgeST suspension-cap literals"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .blockers
            .iter()
            .any(
                |line| line.contains("remaining mixed exact compact-prefix classes")
                    && line.contains("0xff0000ff/0x0002/0xff is pure bridge")
                    && line.contains("0x0005d368/0x0001/0xff is pure track-cap")
                    && line.contains("0xff0000ff/0x0001/0xff")
                    && line.contains("0x000055f3/0x0001/0xff")
            )
    );
    assert!(
            trace.candidate_consumer_hypotheses[0]
                .evidence
                .iter()
                .any(|line| line.contains(
                    "profile-span mode-family correlations now also split the previous 0x55f3 spans directly"
                ) && line.contains("span=0x6 rows=72")
                    && line.contains("span=0x3 rows=17")
                    && line.contains("span=0x27 rows=3"))
        );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains(
                "exact compact-prefix correlations now split the residual prelude classes directly"
            ) && line.contains("0x000055f3/0x0001/0xff")
                && line.contains("0xff0000ff/0x0001/0xff")
                && line.contains("0xff0000ff/0x0002/0xff"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("short 0x03-byte post-profile gaps")
                && line.contains("track_cap:2")
                && line.contains("tunnel:15")
                && line.contains("0x000055f3/0x0001/0xff:17"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("sparse 0x27 post-profile outlier")
                && line.contains("0xff0000ff/0x0001/0xff:1")
                && line.contains("0xff0000ff/0x0002/0xff:2")
                && line.contains("TunnelSTBrick_Section.3dp")
                && line.contains("BridgeSTWood_Section.3dp"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(
                |line| line.contains("bridge-only two-child class is now grounded save-side")
                    && line.contains("0x0002")
                    && line.contains("BridgeSTWood_Section.3dp")
            )
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line
                .contains("0xff0000ff/0x0001/0xff compact-prefix class is now explicit")
                && line.contains("dominant prelude=0x0001/0xff"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line
                .contains("0x000055f3/0x0001/0xff compact-prefix class is now explicit")
                && line.contains("dominant prelude=0x0001/0xff"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line
                .contains("0xff0000ff/0x0002/0xff compact-prefix class is now explicit")
                && line.contains("dominant prelude="))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("slot +0x44 = 0x004559d0")
                && line.contains("+0x40 = 0x00455fc0")
                && line.contains("+0x4c = 0x00455930"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("0x004559d0 writing 0x55f1")
                && line.contains("[this+0x206/+0x20a/+0x20e]")
                && line.contains("0x52ec50")
                && line.contains("0x55f3"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(
                |line| line.contains("chooser siblings calling 0x00490960 directly")
                    && line.contains("0x0048a340")
                    && line.contains("0x0048f4c0")
                    && line.contains("0x00490200")
            )
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(
                |line| line.contains("0x00490960 copying selector fields into the child object")
                    && line.contains("0x00455b70")
                    && line.contains("0x005cfd74")
                    && line.contains("[this+0x248]")
            )
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("0x00490200 reading the seeded lanes")
                && line.contains("0x006cfca8")
                && line.contains("[this+0x216/+0x218/+0x201/+0x202]"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("0x0048e140/0x0048e160/0x0048e180")
                && line.contains("[this+0x206/+0x20a/+0x20e]")
                && line.contains("0x0048e1a0")
                && line.contains("[this+0x202]"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("0x0048ed30")
                && line.contains("[this+0x248]")
                && line.contains("[this+0x08]")
                && line.contains("0x455d20/0x455650/0x53b080"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("0x004a2eba/0x004a30f9/0x004a339c")
                && line.contains("0x005cb138 = BallastCapDT_Cap.3dp")
                && line.contains("0x004909e2"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("mode 0x0b")
                && line.contains("TrackCapDT/ST_Cap")
                && line.contains("mode 0x03")
                && line.contains("OverpassST_section")
                && line.contains("mode 0x02")
                && line.contains("mode 0x01"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("objdump on 0x00490960")
                && line.contains("stem at [esp+0x14]")
                && line.contains("[esp+0x18]/[esp+0x1c] feed 0x539530")
                && line.contains("[esp+0x20] feeds 0x53a5b0")
                && line.contains("[esp+0x34] gates whether the new child is cached")
                && line.contains("selector-copy block")
                && line.contains("[esp+0x28]/[esp+0x2c]/[esp+0x30]")
                && line.contains("0x0048ed01/0x0048ed20")
                && line.contains("bypass")
                && line.contains("0x004a17eb/0x004a1995/0x004a1b44/0x004a1b7d")
                && line.contains("0x004a1b95")
                && line.contains("arg7/arg8/arg9 = -1/-1/0")
                && line.contains("arg8 fixed at 1")
                && line.contains("arg9 fixed at 0"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("0x004a17eb/0x004a1995")
                && line.contains("0x621a94/0x621a64")
                && line.contains("one-bit selector (0 or 1)")
                && line.contains("0x004a1b44/0x004a1b7d")
                && line.contains("0x621a9c/0x621a6c")
                && line.contains("0x004a1b95")
                && line.contains("0x0048ed01/0x0048ed20")
                && line.contains("0x005cb198 versus 0x005cb1ac"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("objdump on 0x00455b70")
                && line.contains("[this+0x206/+0x20a/+0x20e]")
                && line.contains("0x51d820")
                && line.contains("0x005c87a8")
                && line.contains("0x005cfd74 = \"Infrastructure\""))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("objdump on 0x51d820")
                && line.contains("owned heap strings")
                && line.contains("0x5a1145")
                && line.contains("0x5a125d")
                && line.contains("byte-for-byte"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("objdump on 0x52ec50")
                && line.contains("bit 5 of [this+0x20]")
                && line.contains("bit 6 of [this+0x20]")
                && line.contains("0x531030"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(
                |line| line.contains("objdump on 0x531030/0x5a464d/0x5a44a8")
                    && line.contains("0x531030 just forwards")
                    && line.contains("0x5a44a8 is the shared chunked stream write path")
            )
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(
                |line| line.contains("cannot come from selector-copy state alone")
                    && line.contains("0xff0000ff/0x0001/0xff")
                    && line.contains("dominant TrackCap rows")
                    && line.contains("tunnel residue")
            )
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(
                |line| line.contains("BridgeSTWood_Section.3dp aligns with mode 0x01 Bridge")
                    && line.contains("TunnelSTBrick_Cap/Section.3dp with mode 0x02 Tunnel")
                    && line.contains("BallastCapST_Cap.3dp with mode 0x0a BallastCap")
                    && line.contains("TrackCapST_Cap.3dp with mode 0x0b TrackCap")
            )
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains(
                "mode-family correlations now also split the candidate patterns directly"
            ) && line.contains("0x0002/0xff rows=18")
                && line.contains("bridge"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| {
                line.contains("0x00518140")
                    && line.contains("12-byte row")
                    && line.contains("[collection+0x3c]")
            })
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("0x00518380") && line.contains("ordinal"))
    );
    assert!(
            trace.candidate_consumer_hypotheses[0]
                .evidence
                .iter()
                .any(|line| line.contains("0x005181f0/0x00518260")
                    && line.contains("previous live id"))
        );
    assert!(trace.notes.iter().any(|line| {
        line.contains("pure bridge-only 0x0002/0xff candidate class is grounded save-side")
            && line.contains("paired DT/ST siblings at 0x004a2c80 and 0x004a34e0")
            && line.contains("grounded top-level branch meaning")
            && line.contains("grounded bridge/tunnel material selector roles")
            && line.contains("concrete child-construction/write-side chain through 0x00490960")
            && line.contains("0x004559d0")
    }));
    assert!(trace.notes.iter().any(|line| line.contains("ST-only")
        && line.contains("ST chooser sibling")
        && line.contains("DT sibling remains grounded statically")));
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| {
                line.contains("0x52ebd0/0x52ec50")
                    && (line.contains("bits 0x20/0x40") || line.contains("bits 0x20 and 0x40"))
            })
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| {
                (line.contains("0x455870/0x455930")
                    || (line.contains("0x455870") && line.contains("0x455930")))
                    && (line.contains("six 4-byte lanes") || line.contains("six dword lanes"))
            })
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| {
                line.contains("0x530720")
                    && line.contains("0x52e8b0")
                    && line.contains("[this+0x4b/+0x4f/+0x53]")
            })
    );
    assert!(
        trace.candidate_consumer_hypotheses[2]
            .evidence
            .iter()
            .any(|line| line.contains("0x00448a70")
                && line.contains("[world+0x15e1/+0x162d]")
                && line.contains("0x00448af0")
                && line.contains("[world+0x2139/+0x213d/+0x2141]"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[2]
            .evidence
            .iter()
            .any(|line| line.contains("0x00493660")
                && line.contains("[child+0x218]")
                && line.contains("[child+0x226]")
                && line.contains("0x006cfc9c")
                && line.contains("0x487960"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[2]
            .evidence
            .iter()
            .any(|line| line.contains("0x0048b660")
                && line.contains("[child+0x216]")
                && line.contains("[child+0x201]")
                && line.contains("0x53a350"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[2]
            .evidence
            .iter()
            .any(|line| line.contains("0x0048e2c0")
                && line.contains("bit 0x20 in [child+0x201]")
                && line.contains("0x53a3a0")
                && line.contains("0x48a9e0")
                && line.contains("0x0048e3c0")
                && line.contains("[child+0x22e]")
                && line.contains("0x006cfcb4")
                && line.contains("bit 0x02 in [child+0x24c]"))
    );
    assert!(
        trace.candidate_consumer_hypotheses[0]
            .evidence
            .iter()
            .any(|line| line.contains("u16 child count")
                && line.contains("saved primary-child byte"))
    );
    assert_eq!(trace.branches[0].status, "grounded_separate_owner_seam");
    assert_eq!(trace.branches[1].status, "disproved_by_grounded_probe");
}
