Skip to content

Committee profile 404s when summary history includes a cycle with no committee history record #7059

@patphongs

Description

@patphongs

Summary

A committee profile page can return 404 even when the committee exists in the API, if /committee/<committee_id>/history/ includes last_cycle_has_financial or cycles_has_financial for a cycle that has no data at /committee/<committee_id>/history/<cycle>/.

Example:

  • Committee page: /data/committee/C70004569/
  • Summary history endpoint returns the committee and has 2034:
    • https://api.open.fec.gov/v1/committee/C70004569/history?per_page=1&api_key=DEMO_KEY
Image
  • Cycle-specific history endpoint for that cycle returns no data:
    • https://api.open.fec.gov/v1/committee/C70004569/history/2034?per_page=1&api_key=DEMO_KEY
Image

Current CMS behavior in fec/data/views.py:

  1. Load /committee/C70004569/history/
  2. Read last_cycle_has_financial == 2034
  3. Request /committee/C70004569/history/2034
  4. Raise Http404 when that endpoint returns no row

What should have happened?

The committee profile should render because the committee exists. If the cycle-specific history row is missing for a cycle, the page should fall back to the summary committee record and show the existing "missing financials" state instead of returning 404.

Frequency

Ongoing for any committee where the summary history endpoint has a cycle that the cycle-specific history endpoint does not actually return.

Suggested fix:

  • Do not raise Http404 solely because /committee/<committee_id>/history/<cycle> is empty when /committee/<committee_id>/history/ already returned the committee.
  • Fall back to the summary history record and allow the existing missing-financials UI to handle the inconsistent cycle data.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    🔨 Pre-refinement

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions