from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
def test_v033_files():
    for p in ['app/api/v033.py','app/services/corporate_os_v033.py','app/static/corporate-os.html','migrations/033_corporate_operating_system.sql']:
        assert (ROOT/p).exists()
def test_v033_operating_controls():
    text=(ROOT/'app/services/corporate_os_v033.py').read_text()
    for item in ['build_unit_tree','compute_key_result_progress','refresh_objective_progress','kpi_status','validate_relation','executive_cockpit']:
        assert item in text
def test_v033_routes():
    text=(ROOT/'app/api/v033.py').read_text()
    for route in ['/units','/processes','/assets','/objectives','/key-results','/kpis','/relations','/graph','/recommendations','/cockpit']:
        assert route in text
def test_v033_rls():
    sql=(ROOT/'migrations/033_corporate_operating_system.sql').read_text()
    assert 'ROW LEVEL SECURITY' in sql and 'WITH CHECK' in sql and 'app.current_tenant_id' in sql
