# Tasks: Quality & Diversity Baseline ## T1: Add "brief" built-in ranking profile **File:** `tidal/src/ranking/builtins.rs` - Add constants: `BRIEF_VIEW_GATE_THRESHOLD`, `BRIEF_COMPLETION_GATE_THRESHOLD`, `BRIEF_MAX_PER_CREATOR`, `BRIEF_FORMAT_MIX_MAX_FRACTION`, `BRIEF_EXPLORATION` - Add `fn brief() -> RankingProfile` following the existing skeleton pattern - Configure: `Sort::Hot { gravity: 1.5 }`, two gates (view >= 3, completion >= 1), three boosts (view, like, completion), diversity (max_per_creator: 2, format_mix: 0.6), exploration: 0.0 (disabled — bypasses quality gates) - Register in `register_builtins()` after `date_saved()` - Update the builtin count test - Fix format enrichment in `query/executor/mod.rs`: populate `ScoredCandidate.format` from item metadata - Fix metadata loading trigger: extend `needs_metadata_for_creator_grouping` to check `format_mix_max_fraction` - Run `cargo test --manifest-path tidal/Cargo.toml --lib` to verify no regressions ## T2: Add integration tests **File:** `tidal/tests/p1_quality_diversity.rs` (new) - Create test helpers: schema with `view`, `completion`, `like` signals; item writer with configurable signal counts - Test `quality_gate_excludes_low_view_items`: 10 items, 5 with < 3 views. Assert only high-quality items in results. - Test `quality_gate_excludes_zero_completion_items`: 10 items, 5 with 0 completions. Assert only items with completions in results. - Test `creator_diversity_enforced`: 30 items from 5 creators. Assert no single creator dominates top 10. - Test `format_diversity_enforced`: 12 items (6 video, 6 podcast), all different creators. Assert no format exceeds 60%. - Test `brief_profile_registered`: Assert profile resolvable, empty results on empty DB. - Test `combined_quality_and_diversity`: 13 items mixed quality/creators/formats. Assert all constraints hold. ## T3: Verify all tests pass - Run `cargo test --manifest-path tidal/Cargo.toml --lib` (1352 tests) - Run `cargo test --manifest-path tidal/Cargo.toml --test p1_quality_diversity` (6 tests) - Run `cargo clippy --manifest-path tidal/Cargo.toml -- -D warnings` - Run `cargo fmt --manifest-path tidal/Cargo.toml -- --check`