Skip to content

Dashboard: archive prior-upload review conversations and add conversation history navigation - #1019

Draft
ItIsJordan with Copilot wants to merge 11 commits into
mainfrom
copilot/dashboard-archive-display-review-conversations
Draft

ItIsJordan with Copilot wants to merge 11 commits into
mainfrom
copilot/dashboard-archive-display-review-conversations

Conversation

Copilot AI commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review conversations were previously lost on each new upload because table-level submission records (and attached DataReview rows) are deleted during upload replacement. This change preserves prior review discussions by archiving them before cleanup and exposing them in the dashboard conversation UI with upload-history navigation.

  • Backend model + archival path

    • Added ReviewConversationArchive to persist per-upload conversation snapshots (publication_recid, JSON conversation payload, timestamp).
    • Added archival logic before cleanup_submission(...) in process_submission_directory(...), only when at least one review message exists.
    • Added archive cleanup when a submission is fully deleted (version 1 removal path).
  • Review message retrieval API

    • Refactored conversation assembly into a shared utility module for table-grouped review messages.
    • Kept the existing /record/data/review/message/<publication_recid> default response shape for compatibility.
    • Added opt-in history payload via query params:
      • include_conversation_metadata=true
      • optional conversation_index=<n>
    • Metadata response includes messages, conversation_index, total_conversations, has_previous, has_next.
  • Dashboard conversation UX

    • Updated review-message loading JS to request metadata mode.
    • Added Older/Newer conversation controls shown only when archived conversations exist.
    • Added navigation state handling (disable bounds) and basic accessibility semantics (aria-label, aria-live).
  • Targeted regression coverage

    • Added tests for:
      • archive creation from existing review messages,
      • archive removal on full submission delete,
      • metadata/history navigation response,
      • preservation of legacy endpoint response mode.
# views.py (new opt-in mode, legacy preserved)
if not include_metadata and conversation_index is None:
    return json.dumps(current_messages, default=default_time)

return json.dumps({
    "messages": conversations[selected_index],
    "conversation_index": selected_index,
    "total_conversations": len(conversations),
    "has_previous": selected_index > 0,
    "has_next": selected_index < (len(conversations) - 1),
}, default=default_time)

Co-authored-by: ItIsJordan <21129425+ItIsJordan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add functionality to archive and display review conversations Dashboard: archive prior-upload review conversations and add conversation history navigation Sep 22, 2026
Copilot AI requested a review from ItIsJordan September 22, 2026 08:23
@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.52239% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.85%. Comparing base (04e051c) to head (b943b32).

Files with missing lines Patch % Lines
hepdata/modules/records/utils/review_messages.py 93.54% 2 Missing ⚠️
hepdata/modules/records/views.py 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1019      +/-   ##
==========================================
+ Coverage   87.65%   87.85%   +0.19%     
==========================================
  Files          59       60       +1     
  Lines        5823     5877      +54     
==========================================
+ Hits         5104     5163      +59     
+ Misses        719      714       -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

@coveralls

coveralls commented Sep 30, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 38383350223

Coverage increased (+0.2%) to 87.851%

Details

  • Coverage increased (+0.2%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 117 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

117 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
modules/records/views.py 72 78.69%
modules/records/utils/submission.py 45 89.3%

Coverage Stats

Coverage Status
Relevant Lines: 5877
Covered Lines: 5163
Line Coverage: 87.85%
Coverage Strength: 0.88 hits per line

💛 - Coveralls

Box will no longer go completely white when hovered, and text will remain visible when hovered and disabled.
Simplifies the ID selection logic in load_all_review messages, which will reject any value of placement that is not either #conversation or #conversation-only, rather than using key-value pairs.
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.

dashboard: archive and display review conversations from previous uploads

3 participants