8000 Link health: Broken filter, badge, settings and Check links action by sincere-arjun · Pull Request #2 · sincere-arjun/linkding · GitHub
[go: up one dir, main page]

Skip to content

Link health: Broken filter, badge, settings and Check links action - #2

Open
sincere-arjun wants to merge 9 commits into
masterfrom
moneypenny/14f3be48
Open

sincere-arjun wants to merge 9 commits into
masterfrom
moneypenny/14f3be48

Conversation

@sincere-arjun
Copy link
Copy Markdown
Owner

What this adds

Frontend for periodic link health checks:

  • Broken filter in the search preferences dropdown on the active and archived pages: a "Link health filter" radio group (broken=off|yes) next to the Shared and Unread filters. It is carried through the search, sort, pagination and bundle links and marks the preferences button as active. It is not saved by "Save as default" (it's a filter, not a preference).
  • Broken badge (.link-broken-badge, text "Broken") on broken bookmarks. The reason (status code or check error, plus last-checked time) is in the title and in a visually hidden description referenced by aria-describedby, so screen readers get it too. List items also get a link-broken class.
  • Link health settings: a "Link health" group in the profile settings form with "Enable periodic link health checks" and the check interval (every 6 hours, 12 hours, daily, weekly).
  • Check links bulk action (bulk_check_links) on the active and archived pages, calling check_bookmark_links(bookmark_ids, request.user) (owner-only).
  • Owner-only on shared pages: link health is only shown to the bookmark's owner. The shared page (logged in and public) shows no badge or status, does not offer the Broken filter, and ignores ?broken=yes.

Depends on #1

This builds on #1 (backend: models, checker and background tasks) and contains its commits via a merge of its current head (d95a8c4). Please review and merge it after #1.

Tests

  • make test: 1440 passed
  • make lint: clean
  • bookmarks/tests_e2e/e2e_test_link_health.py: 5 passed (recorded). It covers the settings group, the badge, the Broken filter, the Check links action (task mocked) and the shared page. It only uses the local live server, with no network access.
  • New view and template tests cover the settings form, the filter (active, archived, shared), the badge and its accessible description, the bulk action (owner-only ids, select-all with the filter, background tasks disabled), "Save as default", and the shared page for logged-in and anonymous users.

Known gap: search suggestions while typing come from the REST API and don't take the Broken filter into account. Submitting the search applies it.

Refs: upstream linkding issue 68 (sissbruecker/linkding, not linked on purpose).

🤖 Generated with Claude Code

kashyaparjun and others added 9 commits November 2, 2026 14:24
Adds the shared contract for periodic link health checks: Bookmark link_*
fields and UserProfile settings (migration 0055), LD_LINK_CHECK_TIMEOUT and
LD_LINK_CHECK_HOST_DELAY settings, the link_health checker service, huey
tasks including the periodic scheduler, check_bookmark_links and the
BookmarkSearch "broken" filter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scheduled link health check tasks now carry a not_checked_since timestamp,
so bookmarks that were checked after being scheduled are skipped instead of
being checked again when the queue is backed up. Adds tests for the
scheduler and task enqueueing, check_bookmark_links, the BookmarkSearch
broken param and the broken query filter, and documents the
LD_LINK_CHECK_TIMEOUT and LD_LINK_CHECK_HOST_DELAY options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Settings: "Link health" group in the profile form with
  enable_link_health_checks and link_health_check_interval.
- Search preferences: "Link health filter" radio group (Off/Broken) using
  the BookmarkSearchForm "broken" field; marks the preferences button as
  modified when active and is kept as hidden field in other forms.
- Bookmark list: "Broken" badge (.link-broken-badge) for bookmarks with
  link_broken, title shows status code or check error and last check time.
- Bulk edit: "Check links" action (bulk_check_links) calling
  check_bookmark_links.
- Tests for settings, filter, badge and bulk action, plus a Playwright
  e2e test (e2e_test_link_health.py) covering all four in the browser.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
record_result now writes with a queryset update instead of
save(update_fields=...), so a bookmark deleted while its link is being
checked no longer raises, aborts the batch and makes huey retry it (which
counted failures twice for Check now). The failure count is incremented
atomically with F(), so concurrent checks of the same bookmark don't lose
failures.

Also test that the scheduler is registered as a periodic huey task every
15 minutes, and clarify what LD_LINK_CHECK_HOST_DELAY actually limits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ders

- Only expose link health (Broken badge, status/error title, link-broken
  class) to the bookmark owner, so it no longer shows on the shared page
  or the public share.
- Shared views ignore the broken filter: it neither filters shared
  bookmarks nor is carried through forms on the shared page.
- Badge reason (status/error and last checked) is available to screen
  readers via a visually hidden description; visible text stays "Broken".
- Tests: shared view (logged in and anonymous) shows no link health of
  other users and ignores ?broken=yes, Save as default does not persist
  the broken filter, badge accessible description, and an e2e test for
  the shared page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The public shared bookmarks API (AllowAny) built its search from the
request, so ?broken=yes let anyone list which shared links are dead.
query_shared_bookmarks now skips the broken filter; the owner's own
active and archived queries still apply it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shared page search preferences only offer sorting, so the link health
filter is not shown there. Add view tests (logged in and anonymous) and
an e2e check of the dropdown to keep it that way, and check that the
owner's active and archived pages still render it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants

0