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

Patch bug around DETECTOR_VERSION managing new record creation #115

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

matt-bernhardt
Copy link
Member

@matt-bernhardt matt-bernhardt commented Oct 3, 2024

This patches a bug in the Detection and Categorization workflow, where new records don't adequately respond to changes in the DETECTOR_VERSION value. The solution is to be more explicit about assigning that value from ENV, doing so one step farther upstream rather than inside the Detection and Categorization models themselves.

Developer

Ticket(s)

https://mitlibraries.atlassian.net/browse/TCO-90

Accessibility

  • 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)
  • There are no accessibility implications to this change

Documentation

  • Project documentation has been updated, and yard output previewed
  • No documentation changes are needed

ENV

  • All new ENV is documented in README.
  • All new ENV has been added to Heroku Pipeline, Staging and Prod.
  • ENV has not changed.

Stakeholders

  • Stakeholder approval has been confirmed
  • Stakeholder approval is not needed

Dependencies and migrations

NO dependencies are updated

NO migrations are included

Reviewer

Code

  • I have confirmed that the code works as intended.
  • Any CodeClimate issues have been fixed or confirmed as
    added technical debt.

Documentation

  • The commit message is clear and follows our guidelines
    (not just this pull request message).
  • The documentation has been updated or is unnecessary.
  • New dependencies are appropriate or there were no changes.

Testing

  • There are appropriate tests covering any new functionality.
  • No additional test coverage is required.

@mitlib mitlib temporarily deployed to tacos-api-pipeline-pr-115 October 3, 2024 18:55 Inactive
@mitlib mitlib temporarily deployed to tacos-api-pipeline-pr-115 October 3, 2024 20:37 Inactive
@matt-bernhardt matt-bernhardt marked this pull request as ready for review October 4, 2024 19:10
@matt-bernhardt matt-bernhardt mentioned this pull request Oct 4, 2024
16 tasks
@JPrevost JPrevost self-assigned this Oct 4, 2024
** Why are these changes being introduced:

We initially tried populating the detector_version value in the
Detection and Categorization records within those models themselves via
a before_create lifecycle hook. That proved unworkable because the app
ends up calling .find_by_or_create, and the "find" part of that pathway
has no relevant lifecycle hook to pick up the current value. This caused
a bug that would have prevented the anticipated creation of new records
when we bump the DETECTOR_VERSION env variable.

** Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/tco-90

** How does this address that need:

This abandons the attempt to populate detector_version via a lifecycle
hook, and moves that responsibility to the models which initiate the
creation of these records (where they are already defining the other
needed fields).

Because these values are now being defined upstream, the lifecycle hook
is no longer needed, so we remove it.

Removing this lifecycle hook causes some other tests to fail. Some of
those tests need to be updated to _also_ define detector_version, while
a test about that auto-population feature is just deleted as no longer
relevant.

** Document any side effects to this change:

No side effects other than our code is a little less sparse than I was
hoping for. Such is life.
@mitlib mitlib temporarily deployed to tacos-api-pipeline-pr-115 October 4, 2024 19:22 Inactive
@matt-bernhardt matt-bernhardt merged commit dc936a9 into main Oct 4, 2024
2 checks passed
@matt-bernhardt matt-bernhardt deleted the tco-90 branch October 4, 2024 19:23
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.

3 participants