from pathlib import Path


def test_repair_script_casts_reason_text_for_concat_ws():
    source = Path('scripts/repair_operator_page_consistency_findings.py').read_text()
    assert "concat_ws(E'\\n', NULLIF(note, ''), CAST(:reason AS TEXT))" in source
    assert "concat_ws(E'\\n', NULLIF(note, ''), :reason)" not in source


def test_repair_script_still_uses_single_uuid_param():
    source = Path('scripts/repair_operator_page_consistency_findings.py').read_text()
    assert 'WHERE id = CAST(:task_id AS UUID)' in source
    assert 'ANY(CAST(:task_ids AS UUID[]))' not in source
