Skip to content

fix: retain link score fallbacks when preview filters match nothing - #2411

Open
linjiaye929 wants to merge 1 commit into
unclecode:developfrom
linjiaye929:bugfix/link-preview-filtered-score
Open

linjiaye929 wants to merge 1 commit into
unclecode:developfrom
linjiaye929:bugfix/link-preview-filtered-score

Conversation

@linjiaye929

@linjiaye929 linjiaye929 commented Oct 16, 2026 •

Copy link
Copy Markdown

Summary

When preview filters match no links, extract_link_heads() returns before applying the existing score fallback. Links with an intrinsic score therefore retain total_score=None; the same excluded link gets its fallback if another URL happens to match.

Route the empty selection through _merge_head_data(links, [], config). Filtering still prevents head fetching, and the existing scoring rules are unchanged. This covers the early-return path left outside #1761.

Verification

  • New public-method regressions: 12 fail on unchanged develop, 5 controls pass; all 17 pass after the fix.
  • 27 tests pass including existing merge/scoring regressions. Coverage includes include/exclude filters, external-only links, scoring on/off, missing/failed heads, weighted scores and empty links.
  • Tests control only the initialized seeder fetch boundary; no live crawl, model calls or network attempts. New tests pass Black and diff checks; pre-existing production formatting is left unchanged. Full suite was not run.

Run pytest tests/unit/test_link_preview_filter_scoring.py tests/test_merge_head_data_scoring.py.

AI assistance was used for implementation and verification.

Hosted checks

At head 56c4ec61fd443247d14f1fdf703aec49e8a7cd4d, the Discord notification workflow is action_required; there are zero check runs. This does not establish hosted code/test CI passing.

@linjiaye929
linjiaye929 marked this pull request as ready for review October 16, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant