Skip to content

Reviews Recap: Move proposals recap in its own adapter#4677

Open
marcoacierno wants to merge 4 commits into
mainfrom
cleanup-reviews-recap-structure
Open

Reviews Recap: Move proposals recap in its own adapter#4677
marcoacierno wants to merge 4 commits into
mainfrom
cleanup-reviews-recap-structure

Conversation

@marcoacierno

@marcoacierno marcoacierno commented Jun 20, 2026

Copy link
Copy Markdown
Member

What

Currently the proposal recap is implemented outside the adpater pattern that we have for the review system, meaning that it shows itself in the grants as well and in general leaks again the implementation details into the admin class

@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pycon Error Error Jun 20, 2026 5:11pm

@claude

claude Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

This PR refactors recap view logic and helper functions out of reviews/admin.py into a ProposalsReviewAdapter in reviews/adapters.py, and renames the recap template from reviews-recap.html to proposals-recap.html.

Critical

Broken import in tasks.py
reviews/tasks.py:16 still has from reviews.admin import get_accepted_submissions — that function was moved to reviews/adapters.py. The Celery task compute_recap_analysis will raise ImportError on every dispatch. None of the existing tests catch this because they mock at a higher level.

High

GrantsReviewAdapter violates the ReviewAdapter Protocol
GrantsReviewAdapter (adapters.py:572+) doesn't implement recap_template or get_recap_context, which the Protocol requires. The UI guard in go_to_recap_screen hides the link, but the recap URL itself (<review_session_id>/review/recap/) is unguarded — any direct navigation to a grants recap URL raises AttributeError rather than returning a 404.

Adapter URLs registered without admin_site.admin_view() wrapping
admin.py:222 inserts adapter extra URLs via get_all_review_adapters_extra_urls() without wrapping them in self.admin_site.admin_view(...). All other admin URLs go through that wrapper, which enforces staff login, CSRF verification, and admin exception middleware. The review_recap_compute_analysis_view on the adapter does its own permission check, but CSRF protection is missing at the Django level.

Medium

Stale test references
Tests in test_recap.py (lines 242, 264, 289, 310, 337, 360, 378, 524, 558) call admin.review_recap_compute_analysis_view(...) — that method no longer exists on ReviewSessionAdmin after this PR. These tests will fail.

Unhandled DoesNotExist in review_recap_compute_analysis_view
adapters.py:518ReviewSession.objects.get(id=review_session_id) raises an unhandled 500 on an invalid ID instead of a 404.

Null type crash in get_recap_context
adapters.py:484s.type.name will AttributeError if a submission has a null type. get_accepted_submissions uses select_related('type') but doesn't filter type__isnull=False.

@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.41463% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.04%. Comparing base (99de59b) to head (7c4c6b2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4677      +/-   ##
==========================================
- Coverage   92.52%   92.04%   -0.49%     
==========================================
  Files         359      355       -4     
  Lines       10800    10801       +1     
  Branches      821      827       +6     
==========================================
- Hits         9993     9942      -51     
- Misses        696      747      +51     
- Partials      111      112       +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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