Render a short ranking explanation based on drift state.
(profile: Dict)
| 1572 | remainder = [paper for paper in scored_papers if paper.category != "must_read"] |
| 1573 | |
| 1574 | hard_target_count = max(target_count, len(must_read_items)) |
| 1575 | hard_max_count = max(max_count, len(must_read_items)) |
| 1576 | non_must_read_capacity = max(0, hard_target_count - len(must_read_items)) |
| 1577 | |
| 1578 | limited_remainder = list(remainder[: max(0, hard_max_count - len(must_read_items))]) |
| 1579 | if len(limited_remainder) > non_must_read_capacity: |
| 1580 | limited_remainder = limited_remainder[:non_must_read_capacity] |
| 1581 | limited = must_read_items + limited_remainder |
| 1582 | |
| 1583 | print( |
| 1584 | f"Applying push count limit: {len(scored_papers)} -> {len(limited)} " |
| 1585 | f"(target={hard_target_count}, max={hard_max_count}, must_read={len(must_read_items)})" |
| 1586 | ) |
| 1587 | return limited |
| 1588 | |
| 1589 | |
| 1590 | def format_drift_hint(profile: Dict) -> str: |
| 1591 | """Render a short ranking explanation based on drift state.""" |
| 1592 | drift_state = (profile or {}).get("drift_state", {}) or {} |
| 1593 | status = drift_state.get("status", "stable") |
| 1594 | if drift_state.get("anchor_topic"): |
| 1595 | anchor_label = format_direction_label(drift_state.get("anchor_topic")) |
| 1596 | progress = float(drift_state.get("anchor_progress", 0.0) or 0.0) |
| 1597 | if int(drift_state.get("commitment_days_remaining", 0) or 0) > 0: |
| 1598 | return f"兴趣迁移状态:已锁定锚点 {anchor_label},当前正在持续推进(progress={progress:.2f})。" |
| 1599 | return f"兴趣迁移状态:已形成稳定迁移方向,当前锚点为 {anchor_label}(progress={progress:.2f})。" |
| 1600 | if drift_state.get("hidden_anchor") and drift_state.get("drift_enabled"): |
no test coverage detected