Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor error handling in Preservation Submission Job #1250

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

jazairi
Copy link
Contributor

@jazairi jazairi commented Nov 21, 2023

Why these changes are being introduced:

The Preservation Submission Job currently handles exceptions during SIP creation by setting the SIP's status to 'error' and saving it. This allows us to see failed SIPs in the administrate dashboard, but it also causes preservation to fail silently.

Relevant ticket(s):

https://mitlibraries.atlassian.net/browse/ETD-647

How this addresses that need:

This refactors the Preservation Submission Job to create SIPs using create! instead of create, so that exceptions are raised during the object creation. When exceptions are raised, they are logged and added to the results array. Since no SIP is created when an exception is raised by create!, the logic in the rescue block around updating preservation_status has been removed.

Side effects of this change:

  • Fixtures have been adjusted to accommodate testing.
  • A quasi-related test that had no assertions has been updated to actually test something.
  • The preservation_status of 'error' has been removed, as it is no longer used in the app. There are currently no SIPs in production that have this status.
  • Unrelated to this change, the baggable module has been moved from app/models to app/lib. This to be consistent with where we store our other module, and to make it clear that it is not a model.

Developer

  • All new ENV is documented in README
  • All new ENV has been added to Heroku Pipeline, Staging and Prod
  • ANDI or Wave has been run in accordance to
    our guide and
    all issues introduced by these changes have been resolved or opened as new
    issues (link to those issues in the Pull Request details above)
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated or is unnecessary
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

Requires database migrations?

NO

Includes new or updated dependencies?

NO

Why these changes are being introduced:

The Preservation Submission Job currently handles exceptions
during SIP creation by setting the SIP's status to 'error' and
saving it. This allows us to see failed SIPs in the administrate
dashboard, but it also causes preservation to fail silently.

Relevant ticket(s):

https://mitlibraries.atlassian.net/browse/ETD-647

How this addresses that need:

This refactors the Preservation Submission Job to create SIPs
using `create!` instead of `create`, so that exceptions are
raised during the object creation. When exceptions are raised,
they are logged and added to the `results` array. Since no
SIP is created when an exception is raised by `create!`, the
logic in the `rescue` block around updating `preservation_status`
has been removed.

Side effects of this change:

* Fixtures have been adjusted to accommodate testing.
* A quasi-related test that had no assertions has been updated to
actually test something.
* The `preservation_status` of 'error' has been removed, as it
is no longer used in the app. There are currently no SIPs in
production that have this status.
* Unrelated to this change, the `baggable` module has been moved
from `app/models` to `app/lib`. This to be consistent with
where we store our other module, and to make it clear that it is
not a model.
@mitlib mitlib temporarily deployed to thesis-submit-pr-1250 November 21, 2023 16:30 Inactive
@coveralls
Copy link

Coverage Status

coverage: 98.313% (-0.002%) from 98.315%
when pulling 4c3f088 on etd-647-handle-unbaggable-theses
into 7c1ad59 on main.

@JPrevost JPrevost self-assigned this Nov 21, 2023
@jazairi jazairi merged commit ffec3ab into main Nov 21, 2023
3 checks passed
@jazairi jazairi deleted the etd-647-handle-unbaggable-theses branch November 21, 2023 21:08
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.

4 participants