Skip to content

Adrian/create owner data admin trigger#655

Merged
adrianviquez merged 20 commits intomainfrom
adrian/create-owner-data-admin-trigger
Jan 20, 2026
Merged

Adrian/create owner data admin trigger#655
adrianviquez merged 20 commits intomainfrom
adrian/create-owner-data-admin-trigger

Conversation

@adrianviquez
Copy link
Contributor

@adrianviquez adrianviquez commented Jan 15, 2026

This PR creates a django admin trigger for an owner to export data. Should be reviewed after #651.

https://linear.app/getsentry/issue/CCMRG-2015/create-django-admin-trigger-for-export-task

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.


Note

Adds an admin-triggered pipeline for owner data exports and UI to manage results.

  • New export_owner_data action on Owner creates OwnerExport (with since_date from EXPORT_DAYS_DEFAULT, created_by set from request user), prevents duplicate in-progress exports, triggers TaskService.export_owner_data, and logs via History with success/error messages
  • Registers OwnerExportAdmin with list views, filters, read-only fields, owner_link to Owner, and download_link showing a presigned URL when completed; add-only disabled, delete allowed
  • Adds export_owner_data to OwnerAdmin.actions; minor imports added for OwnerExport, CodecovUser, and export config

Written by Cursor Bugbot for commit 83dd4da. This will update automatically on new commits. Configure here.

@adrianviquez adrianviquez requested a review from a team January 15, 2026 20:39
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 15, 2026

Merging this PR will not alter performance

✅ 9 untouched benchmarks


Comparing adrian/create-owner-data-admin-trigger (b49842c) with main (6ce1874)

Open in CodSpeed

@sentry
Copy link

sentry bot commented Jan 15, 2026

Codecov Report

❌ Patch coverage is 38.77551% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.57%. Comparing base (e423dc8) to head (83dd4da).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/codecov-api/codecov_auth/admin.py 38.77% 30 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #655      +/-   ##
==========================================
+ Coverage   92.44%   92.57%   +0.12%     
==========================================
  Files        1295     1295              
  Lines       47608    47563      -45     
  Branches     1592     1592              
==========================================
+ Hits        44012    44030      +18     
+ Misses       3287     3224      -63     
  Partials      309      309              
Flag Coverage Δ
apiunit 96.38% <38.77%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@codecov-notifications
Copy link

codecov-notifications bot commented Jan 15, 2026

Codecov Report

❌ Patch coverage is 38.77551% with 30 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/codecov-api/codecov_auth/admin.py 38.77% 30 Missing ⚠️

📢 Thoughts on this report? Let us know!

@adrianviquez adrianviquez requested a review from a team as a code owner January 20, 2026 00:09
cursor[bot]

This comment was marked as outdated.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

owner_id=owner.ownerid,
export_id=export.id,
user_id=user.id if user else None,
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing cleanup leaves orphaned export blocking future exports

Medium Severity

The export_owner_data admin action creates an OwnerExport record before calling task_service.export_owner_data(), but if the task service call fails (e.g., Celery broker unavailable, network error), there's no error handling to clean up the created record. The export remains stuck in PENDING status permanently, and since the check at lines 167-179 blocks new exports when one is PENDING or IN_PROGRESS, this owner can never have another export triggered until an admin manually deletes the orphaned record.

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sporadic, okay not addressing atm, can tweak later

Copy link
Contributor

@drazisil-codecov drazisil-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approred after the Feedback from Cursor is checked.

@adrianviquez adrianviquez added this pull request to the merge queue Jan 20, 2026
Merged via the queue into main with commit 4e4bd34 Jan 20, 2026
38 of 40 checks passed
@adrianviquez adrianviquez deleted the adrian/create-owner-data-admin-trigger branch January 20, 2026 19:57
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.

2 participants