feat(api): Add wiki-data endpoint for coverage help pages - #7770
Merged
Conversation
Part of #7130 — API groundwork for moving the coverage help pages to the wiki. wiki_data() is getting bloated, so this adds a dedicated wiki_coverage_data() endpoint instead of extending it further. Feeds the coverage, coverage_fds, and coverage_oa help pages: - judges.count (judges DB size, used on the coverage overview page) - oral_arguments.duration_minutes and a pre-rendered markdown table of oral argument search links, matching the coverage_oa page's layout - financial_disclosures.* full breakdown (disclosures, investments, positions, agreements, non_investment_income, spousal_income, reimbursements, gifts, debts), reusing get_coverage_data_fds() The opinions coverage page is intentionally left out: its data is a nested court hierarchy driving interactive HTMX/chart forms, which doesn't fit a flat JSON payload — that page already has its own coverage_data_opinions() endpoint for the chart itself. Follows the wiki_data() pattern: cached for a day, with a staff-only ?bust_cache param to force a rebuild. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Mirrors the existing wiki_data() test coverage: response shape and field types, the oral argument court table's markdown rendering, and staff-only ?bust_cache behavior. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
mlissner
commented
Aug 11, 2026
mlissner
marked this pull request as ready for review
August 11, 2026 00:09
- Drop the oral-argument court markdown table entirely. The wiki editor will summarize OA coverage as text (circuit and supreme courts), so the endpoint no longer needs to render it. - Extract get_or_build_wiki_json() to share the ?bust_cache + cache get/set logic between wiki_data() and wiki_coverage_data(), instead of duplicating it in both views. - Replace BasicAPIPageTest's fixtures with a CourtFactory-created "ca1" court, per the no-fixtures rule. - Move test_wiki_coverage_data_endpoint into BasicAPIPageTest and merge the two nearly-identical bust_cache tests into one parametrized test. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
get_coverage_data_fds() caches its financial disclosure counts under "coverage-data.fd3" for a week, independent of wiki_data() and wiki_coverage_data()'s own caches. Staff hitting ?bust_cache — e.g. right after new disclosures land, which wiki_coverage_data()'s docstring calls out as the use case — still got up to a week-old FD counts, because the outer rebuild happily returned the stale nested cache entry. Thread the bust_cache flag from get_or_build_wiki_json() through each endpoint's build_data() callable and into get_coverage_data_fds(), so busting an endpoint's cache actually refreshes the FD counts it embeds too. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
mlissner
commented
Aug 11, 2026
mlissner
left a comment
Member
Author
There was a problem hiding this comment.
This LGTM, but a second review would be welcome.
CI failed: test_bust_cache_param's wiki_coverage_data case ran with the client still logged in as staff from the wiki_data case's aforce_login(staff), so the "anonymous/non-staff can't bust the cache" request actually busted it and returned fresh data instead of the sentinel. Give each subTest case its own fresh, logged-out client. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
6 tasks
albertisfu
approved these changes
Aug 11, 2026
albertisfu
left a comment
Contributor
There was a problem hiding this comment.
This looks good to me!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
Part of #7130 — implements #7764.
Summary
This adds a dedicated
wiki_coverage_data()endpoint (/api/rest/v4/wiki-data/coverage/) that serves stats to the that are currently in the coverage page.This skips the opinions coverage page b/c it's too complicated and we want to simplify it during this process.
Follows the
wiki_data()pattern: cached for a day, with a staff-only?bust_cacheparam to force a rebuild.Deployment
This PR should:
skip-deploy(skips everything below)skip-web-deployskip-celery-deployskip-cronjob-deployskip-daemon-deployAI Disclosure
🤖 Generated with Claude Code