spb/trouve-ka Public
Trouve-KA — moteur de recherche web indépendant, Québec-first. Crawler distribué, index OpenSearch, ranking bilingue, galerie d'images. En prod : www.trouve-ka.com
Python 76.8%
TypeScript 15.7%
SQL 3.9%
Shell 1.4%
CSS 1.3%
Dockerfile 0.7%
1# Trouve-KA — tests de la politique du frontier2# Author: Simon-Pierre Boucher3# Contact: contact@spboucher.ai45from trouveka.frontier import compute_priority, next_recrawl_delay, retry_delay678def test_seed_priority_is_max():9 assert compute_priority(domain_quebec_score=0, is_seed=True) == 1.0101112def test_priority_bounded():13 assert 0.0 <= compute_priority(domain_quebec_score=1.0, authority_score=1.0,14 link_signal=1.0, is_new_domain=True) <= 1.015 assert compute_priority(domain_quebec_score=0.0, spam_signal=1.0, depth=10) == 0.0161718def test_quebec_dominates_priority():19 high_q = compute_priority(domain_quebec_score=0.9, depth=2)20 low_q = compute_priority(domain_quebec_score=0.1, depth=2)21 assert high_q > low_q + 0.2222324def test_recrawl_backoff_doubles_when_unchanged():25 d = next_recrawl_delay(changed=False, previous_delay_hours=24.0)26 assert d.total_seconds() == 48 * 3600272829def test_recrawl_halves_when_changed():30 d = next_recrawl_delay(changed=True, previous_delay_hours=24.0)31 assert d.total_seconds() == 12 * 3600323334def test_recrawl_bounded():35 fast = next_recrawl_delay(changed=True, previous_delay_hours=0.5, min_hours=1.0)36 slow = next_recrawl_delay(changed=False, previous_delay_hours=10_000, max_hours=720)37 assert fast.total_seconds() == 360038 assert slow.total_seconds() == 720 * 3600394041def test_retry_delay_grows_and_caps():42 assert retry_delay(0).total_seconds() == 15 * 6043 assert retry_delay(1).total_seconds() == 30 * 6044 assert retry_delay(10).total_seconds() == 24 * 360045