refactor(pages): Remove coverage help pages, redirect to the wiki - #7773
Conversation
MUST rely on the check-python-ast pre-commit hook for syntax verification instead of ad hoc `python -c "import ast; ast.parse(...)"` snippets. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds the settings and inject_settings context vars needed to redirect and re-link the legacy coverage help pages (#7766) to their new home on the wiki, following the same pattern already used for WIKI_TERMS_URL/WIKI_REMOVAL_URL. The 5 URLs are placeholders pending confirmation against the actual wiki pages before merge. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Removes coverage()/coverage_fds()/coverage_oa()/coverage_opinions()/ coverage_recap() and their supporting helpers (get_coverage_data_o(), build_court_dicts(), and cl/simple_pages/coverage_utils.py entirely), now that this content lives on the wiki. get_coverage_data_fds() is kept — it's shared with the wiki_data()/wiki_coverage_data() API endpoints from #7764. Also removes coverage_data_opinions() (cl/api/views.py) and its build_chart_data() helper, the JSON API that fed the deleted coverage_opinions page's D3 timeline chart — it has no other consumer. The 5 URL names are kept as permanent redirects straight to the wiki (old bookmarks/external links keep working), and the pre-2023 /coverage/ aliases are updated to redirect directly rather than bouncing through /help/coverage/'s own redirect. Drops the 4 now-external coverage pages from the sitemap — the wiki has its own. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Every internal {% url "coverage..." %} across the navbar, footer,
homepage, advanced-search help copy, no-results empty states, alert
modal, docket-entry filter panel, and the financial-disclosures
landing page now points straight at the WIKI_COVERAGE_*_URL context
vars instead of reverse()-ing the (now redirect-only) view names —
avoids an extra hop through our own 301 on every internal link.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Deletes the v1 and v2 templates for the 5 coverage pages, the vendored timelines-chart.js D3 library (~8.1k lines) and coverage-op.js that drove the opinions-coverage timeline chart, and the CSS rules (.timelines-dialog, .legendG, .brusher, rect.series-segment) that only styled that chart's now-deleted markup. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- cl/api/tests.py: drop test_build_chart_data and the build_chart_data import now that coverage_data_opinions/build_chart_data are gone. coverage_data/make_court_variable tests are untouched — they back a different, still-live API. - cl/simple_pages/tests.py: drop the coverage/coverage_fds/ coverage_recap/coverage_oa entries from test_simple_pages (they're redirects now, not pages to load-test), remove test_oa_minute_count_in_the_coverage_page (exercised the deleted coverage() view directly), and drop the 4 coverage entries from V2PagesRegisterTest.V2_PAGES (their v2 templates are deleted). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
Swaps the placeholder WIKI_COVERAGE_* slugs for the actual pages: https://wiki.free.law/c/courtlistener/help/data-coverage (and its case-law/federal-cases-and-filings/judicial-financial-disclosures/ oral-argument-recordings children). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
coverage_data() (/api/rest/v{1,2,3,4}/coverage/<court>/) was never a
public API, so drop it outright rather than routing it through the
deprecated_api flow used for genuinely deprecated v1/v2 endpoints.
Also removes its now-unused helpers, get_opinions_coverage_over_time()
and get_opinions_coverage_chart_data() (the latter's only other caller,
build_chart_data(), was already removed earlier in this branch).
v1/v2 requests to the old path now correctly fall through to the
existing deprecated_api catch-all (410); v3/v4 requests get a plain
404 — both better than the endpoint quietly staying alive past the
rest of its version's deprecation.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
oral_arguments.duration_minutes was a raw float (e.g. 4.1666...). The wiki template renders this value as-is with no rounding of its own, so do the rounding here instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Consolidates the 7 coverage-page redirects (5 /help/coverage/... plus 2 pre-2023 /coverage/... aliases) from cl/simple_pages/urls.py into cl/api/wiki_redirects.py, alongside every other old-page-to-wiki redirect, instead of leaving them scattered across an app urls.py. They're added as their own table (_COVERAGE_REDIRECTS) rather than folded into the existing wiki_suffix-based tables, since they resolve via the WIKI_COVERAGE_*_URL settings by name — those settings are also the single source of truth inject_settings() hands to templates for direct internal links, so this avoids encoding the same wiki slugs in two places. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
This automated review found no bugs beyond the DRY nit already flagged inline (which mirrors mlissner's own review comment about upgrading the other redirect tables to the same single-source-of-truth pattern). Given the size of this refactor (38 files, several deleted views/templates/JS, and new wiki-redirect settings) and mlissner's still-open question, a human look is worthwhile before merging.
Extended reasoning...
Overview
This PR deletes the legacy CourtListener coverage help pages (coverage, coverage_fds, coverage_oa, coverage_opinions, coverage_recap), their views/helpers (cl/simple_pages/coverage_utils.py, build_chart_data, get_opinions_coverage_over_time, etc.), the vendored timelines-chart.js D3 library and its driver script, and the never-public coverage_data REST endpoint. Old URLs are converted to permanent redirects straight to the wiki via new WIKI_COVERAGE_* settings, and every internal template link across the navbar, footer, homepage, advanced-search page, alert modal, no-results states, and financial-disclosures page now points directly at those wiki URLs instead of round-tripping through internal views. It also fixes wiki_coverage_data() to round OA duration to the nearest minute, with a corresponding test.
Security risks
None of note. The var-in-href Semgrep findings are false positives — the flagged href="{{ WIKI_COVERAGE_*_URL }}" values come from server-controlled Django settings (built from hardcoded wiki base URLs), not user input, so there's no XSS vector. The tabindex="300" frontend-check failure on financial_disclosures_home.html is pre-existing on a line this PR didn't touch.
Level of scrutiny
This is a large, mostly-mechanical deletion/redirect refactor (38 files) rather than new logic, which lowers risk, but the sheer size, the number of redirect targets that must stay correct for external bookmarks, and the fact it's stacked on another unmerged PR (#7770) argue for a human pass rather than pure bot approval.
Other factors
mlissner left an open review comment asking whether the other redirect tables (_PATH_REDIRECTS, _HELP_PATH_REDIRECTS) should be upgraded to the same settings-based single-source-of-truth pattern used for the new _COVERAGE_REDIRECTS table. That question has not been addressed by the author yet, and the bug-hunting pass independently flagged the same duplication as a nit. Tests were updated consistently with the removed surface area (dropped page-load/API tests, added a new rounding test), which reduces regression risk.
Now that coverage collapses to one wiki link (#7766), the page was mostly empty scaffolding: six h2 sections, most holding exactly one link. Restructure into three tiers instead: 1. A single primary CTA to the wiki's help articles — that's where most help content actually lives. 2. A 4-tile topic grid (icon + heading + one-line description + link) for Data Coverage, Developer Docs, Removing Content, and Donations & Membership — scannable at a glance instead of four paragraph sections. 3. A closing "Still Stuck? -> Contact Us" band, kept separate from the grid since it's a fallback, not a topic. help/index.html (Bootstrap, FA icons, .well tiles) and v2_help/index.html (Tailwind, {% svg %} icons, <c-button>) were rebuilt in parallel per FRONTEND.md's legacy/v2 sync requirement. Also drops the now-pointless anchors.html include — there's no long-form content left to deep-link into. .github/scripts/frontend_checks.py passes clean on both files. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- v2_help/index.html: remove the redundant "COURTLISTENER" eyebrow above the h1 — the page title already says CourtListener. - Reorder both help/index.html and v2_help/index.html's topic tiles to Donations & Membership, Data Coverage, Developer Docs, Removing Content, keeping the two stacks in sync per FRONTEND.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Addresses mlissner's review comment (and claude[bot]'s matching nit): _build_patterns() had three near-identical loops for _PATH_REDIRECTS, _HELP_PATH_REDIRECTS, and _COVERAGE_REDIRECTS, differing only in how each row's middle column resolves to a destination URL. Extract that shared shape into _add_redirects(patterns, table, url_resolver), with each call site supplying just its own URL-resolution logic as a small lambda. Didn't convert _PATH_REDIRECTS/_HELP_PATH_REDIRECTS to settings-backed URLs like _COVERAGE_REDIRECTS — that pattern exists there because those settings are also consumed directly by templates via inject_settings(). The ~20 other wiki_suffix entries have no such second consumer, so adding a dedicated setting per row would be duplication in the other direction. The loop shape was the actual repetition; this removes it without over-generalizing the tables. _REST_ENDPOINT_REDIRECTS keeps its own loop — it builds a per-row re_path() regex, not a plain path(), so it doesn't fit this helper. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Per frontend_checks.py's check_tabindex (failing on this PR): never use tabindex > 0 — it puts the element ahead of the natural tab order of everything with tabindex="0" or no tabindex at all, which is confusing for keyboard/screen-reader users. This input doesn't need special tab-order treatment. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
I think this is ready to go. I've reviewed it carefully and I think it'll be a nice improvement. @albertisfu to you for triage, please. :) |
albertisfu
left a comment
There was a problem hiding this comment.
Looks good to me!
I only found this stray JPEG that can be removed now:
disclosure-thumb-drives.jpeg
The only references to jpeg/disclosure-thumb-drives.jpeg were in the coverage_fds help templates removed in this PR, so the asset is dead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DEif2R67BWJk3KrJc5dZb5
|
Good catch — removed Generated by Claude Code |
|
Thanks, Alberto. Merging! |
Fixes
Fixes: #7766
Summary
Removes the legacy coverage help pages from CourtListener now that they live on the wiki at https://wiki.free.law/c/courtlistener/help/data-coverage
High level:
tabindexremoved to make frontend check pass.Screenshots:
New Help Page v2:
New Help Page v2, Mobile:
New help page v1, desktop (this could be prettier, but I'm OK with it for now):
New help page v1, Mobile:
Deployment
This PR should:
skip-deploy(skips everything below)skip-web-deployskip-celery-deployskip-cronjob-deployskip-daemon-deployAI Disclosure