Skip to content

ENSY-69-get-file-functionality#2

Merged
ehanson8 merged 4 commits intomainfrom
ENSY-69-get-file-functionality
May 24, 2022
Merged

ENSY-69-get-file-functionality#2
ehanson8 merged 4 commits intomainfrom
ENSY-69-get-file-functionality

Conversation

@ehanson8
Copy link
Contributor

@ehanson8 ehanson8 commented May 18, 2022

Helpful background context

As we discussed offline, I'm trying to consolidate everything in the ppod.py file to streamline this code

How can a reviewer manually see the effects of these changes?

Let's talk offline about how we want to do this going forward since this now has more testing dependencies than alma-webhook-lambdas. I'm not sure if it makes more sense to spin up a moto server and add file(s) for reviewing each PR or whether it makes more sense to take advantage of our dev infrastructure.

What are the relevant tickets?

Developer

  • All new ENV is documented in README
  • 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

Includes new or updated dependencies?

YES

* Add conftest.py and fixtures
* Update Makefile
* Add new dependencies to Pipfile
* Add functionality to get files from S3, unzip them, and return a processed file count
* Update setup.cfg to manage mypy errors for new dependencies
* Add unit tests for expected data scenarios for new functions

* https://mitlibraries.atlassian.net/browse/ENSY-69
@ehanson8 ehanson8 requested a review from hakbailey May 18, 2022 20:21
Copy link
Contributor

@hakbailey hakbailey left a comment

Choose a reason for hiding this comment

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

See inline comments for changes. Happy to chat about any of this!

@ehanson8 ehanson8 requested a review from hakbailey May 20, 2022 13:25
Copy link
Contributor

@hakbailey hakbailey left a comment

Choose a reason for hiding this comment

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

See inline comments for specific changes, plus a couple of general comments:

First, we definitely need to be able to verify this locally. After thinking through it, I think moto_server is a better strategy than Dev1 because if we use the Dev1 s3 bucket someone will have to go into the bucket and find a current prefix every time they submit a PR (because there will be a retention policy on the bucket, so files will get deleted after a period of time). And if it's been long enough that there are no files in the Dev1 bucket (because we won't be running the export from Alma Sandbox regularly going forward), then verification would require first running the publishing job from Alma, which not everyone has permissions to do. So now is probably a good time to go ahead and document how to use moto_server and the fixtures to verify this.

And second, it was ok for the initial structural PR but going forward the commit messages should follow our standard template. PR comments don't show up in the git log, so it's important that the commit messages are detailed including the why, side effects, Jira tickets, etc. The template is used in a lot of commits across repos, but for reference my template looks like this:

########50 characters############################
# Subject
# Summarize changes in around 50 characters or
# less. Capitalize, use imperative, do not end
# with a period.

########72 characters##################################################
# Why these changes are being introduced:
# Problem, Task, Reason for Commit

# How this addresses that need:
# Paragraph or bullet list of changes with reasons
# *

# Side effects of this change:
# None, but adding author info to the new and edit view will need to be
# implemented separately (currently documented in ETD-177, linked above).

# Relevant ticket(s):
# * https://mitlibraries.atlassian.net/browse/[#]

# Resolves: #123 (GH issue)
# See also: #456, #789

Why these changes are being introduced:
* Updates based on comments in PR #2

How this addresses that need:
* Simplify mocked_s3 fixture bucket with many files for quicker load times
* Add BUCKET to test_env fixture
* Remove default None value for prefix in filter_files_in_bucket
* Remove unnecessary monkeypatch calls in unit tests
* Shift bucket with many files fixture to filter_files_in_bucket unit test

Side effects of this change:
* None

Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/ENSY-69
@ehanson8
Copy link
Contributor Author

I updated the commit message style, this template makes perfect sense for my future planned commits but let me know if there's a better way to use this for the assorted edits that come through in a PR review than what I did here

@ehanson8
Copy link
Contributor Author

The moto server testing work will be spun off as a different ticket per a conversation with @hakbailey

@ehanson8 ehanson8 requested a review from hakbailey May 23, 2022 15:17
@hakbailey
Copy link
Contributor

I updated the commit message style, this template makes perfect sense for my future planned commits but let me know if there's a better way to use this for the assorted edits that come through in a PR review than what I did here

I think for PR updates it's fine to just list the changes. In general it seems like we've kind of moved away from squashing commits before merging, but if we went back to doing that then you'd just have one commit for the whole PR, following the template, and the specific changes made during review wouldn't need to be documented.

@ehanson8
Copy link
Contributor Author

That makes sense, thanks!

Copy link
Contributor

@hakbailey hakbailey left a comment

Choose a reason for hiding this comment

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

Just a few more small changes and this will be good to go!

* Update Makefile command
* Update string formatting of logger message
* Remove unnecessary calls of monkeypatch fixture
* Update README.md to reflect incomplete functionality
@ehanson8 ehanson8 requested a review from hakbailey May 23, 2022 18:54
Copy link
Contributor

@hakbailey hakbailey left a comment

Choose a reason for hiding this comment

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

Looks good!

@ehanson8 ehanson8 merged commit 86027db into main May 24, 2022
@ehanson8 ehanson8 deleted the ENSY-69-get-file-functionality branch May 24, 2022 15:35
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