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

Remove existing authentication and cart functionality (#2950) #2969

Merged
merged 1 commit into from
Apr 21, 2021

Conversation

amarjandu
Copy link
Contributor

@amarjandu amarjandu commented Apr 9, 2021

Author

  • PR title references issue
  • Title of main commit references issue
  • PR is linked to Zenhub issue

Author (reindex)

  • Added r tag to commit title or this PR does not require reindexing
  • Added reindex label to PR or this PR does not require reindexing

Author (freebies & chains)

  • Freebies are blocked on this PR or there are no freebies in this PR
  • Freebies are referenced in commit titles or there are no freebies in this PR
  • This PR is blocked by previous PR in the chain or this PR is not chained to another PR
  • Added chain label to the blocking PR or this PR is not chained to another PR

Author (upgrading)

  • Documented upgrading of deployments in UPGRADING.rst or this PR does not require upgrading
  • Added u tag to commit title or this PR does not require upgrading
  • Added upgrade label to PR or this PR does not require upgrading

Author (requirements, before every review)

  • Ran make requirements_update or this PR leaves requirements*.txt, common.mk and Makefile untouched
  • Added R tag to commit title or this PR leaves requirements*.txt untouched
  • Added reqs label to PR or this PR leaves requirements*.txt untouched

Author (before every review)

  • make integration_test passes in personal deployment or this PR does not touch functionality that could break the IT
  • Rebased branch on develop, squashed old fixups

Primary reviewer (after approval)

  • Commented on demo expectations or labelled PR as no demo
  • Decided if PR can be labeled no sandbox
  • PR title is appropriate as title of merge commit
  • Moved ticket to Approved column
  • Assigned PR to an operator

Operator (before pushing merge the commit)

  • Checked reindex label and r commit title tag
  • Checked that Demo expectations are clear or PR is labeled as no demo
  • Rebased and squashed branch
  • Sanity-checked history
  • Pushed PR branch to Github
  • Branch pushed to Gitlab and build passes in sandbox or added no sandbox label
  • Started reindex in sandbox or this PR does not require reindexing sandbox
  • Checked for failures in sandbox or this PR does not require reindexing sandbox
  • Added PR reference to merge commit title
  • Collected commit title tags in merge commit title
  • Moved linked issue to Merged column
  • Pushed merge commit to Github

Operator (after pushing the merge commit)

  • Moved freebies to Merged column or there are no freebies in this PR
  • Shortened the PR chain or this PR is not the base of another PR
  • Verified that N reviews labelling is accurate
  • Pushed merge commit to Gitlab or this changes can be pushed later, together with another PR
  • Deleted PR branch from Github and Gitlab

Operator (reindex)

  • Started reindex in dev or this PR does not require reindexing dev
  • Checked for failures in dev or this PR does not require reindexing dev
  • Started reindex in prod or this PR does not require reindexing prod
  • Checked for failures in prod or this PR does not require reindexing prod

Operator

  • Unassigned PR

@github-actions github-actions bot added the orange [process] Done by the Azul team label Apr 9, 2021
@codecov
Copy link

codecov bot commented Apr 9, 2021

Codecov Report

Merging #2969 (80ef6f8) into develop (8570300) will decrease coverage by 0.84%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2969      +/-   ##
===========================================
- Coverage    83.48%   82.64%   -0.85%     
===========================================
  Files          129      117      -12     
  Lines        13591    12168    -1423     
===========================================
- Hits         11347    10056    -1291     
+ Misses        2244     2112     -132     
Impacted Files Coverage Δ
src/azul/__init__.py 82.27% <ø> (-0.79%) ⬇️
src/azul/plugins/__init__.py 89.91% <ø> (-0.09%) ⬇️
src/azul/plugins/metadata/hca/__init__.py 100.00% <ø> (ø)
src/azul/service/elasticsearch_service.py 81.42% <ø> (-0.67%) ⬇️
src/azul/service/lambda_iam_policy.py 0.00% <ø> (ø)
test/app_test_case.py 88.70% <ø> (-1.00%) ⬇️
test/retorts.py 100.00% <ø> (ø)
test/service/test_request_builder.py 92.06% <ø> (ø)
src/azul/chalice.py 98.66% <0.00%> (-1.34%) ⬇️
src/azul/service/collection_data_access.py 35.00% <0.00%> (-1.25%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8570300...80ef6f8. Read the comment docs.

@coveralls
Copy link

coveralls commented Apr 9, 2021

Coverage Status

Coverage decreased (-0.3%) to 83.164% when pulling 80ef6f8 on issues/amar/2950-rm-auth into 8570300 on develop.

@amarjandu amarjandu force-pushed the issues/amar/2950-rm-auth branch 5 times, most recently from 6ac79e3 to 59b913d Compare April 9, 2021 22:53
@achave11-ucsc
Copy link
Member

Unassigning myself and assigning @noah-aviel-dove, as requested by
@hannes-ucsc.

Copy link
Member

@achave11-ucsc achave11-ucsc left a comment

Choose a reason for hiding this comment

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

Great work. Only a weak observation, not sure if the changes would benefit from having multiple commits, like file/path renames and addition/deletions. However, since it is a refactor, it can be justified for the changes to be done in a single commit.

@amarjandu
Copy link
Contributor Author

@achave11 I though about that a little, maybe it looks like having a commit history that looks like:

[1/3] Move entire service.app file to the attic
[2/3] Remove Auth/Cart segments out of the lambda/service/app
[3/3] Remove everything not related to the auth/cart stuff from the attic/lamdas/service/app

That might be a better way to track all the changes.

@noah-aviel-dove what you think about this?

@nadove-ucsc
Copy link
Contributor

@noah-aviel-dove what you think about this?

Sounds a bit convoluted. I agree with @achave11 that the mixture of full rename/moves and partial additions/deletions does make the changes a little harder to track, but I think it's even harder to tell what's going on when the same files get touched in multiple commits for what is functionally a single change.

Having a [1/2] commit for moving entire files and and [2/2] commit for editing the unmoved files, or vice-versa, would be the clearest solution IMO. But a single commit also seems acceptable.

@@ -0,0 +1,704 @@
@app.authorizer()
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel this file should preserve the import statements referenced in the moved code, otherwise we're not really preserving it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hard to tell whether this is correct advice or not without going every file in the attic. It just seems to me that there's a huge number of classes referenced in this code here that might be ambiguous to resolve in the future.

Copy link
Member

Choose a reason for hiding this comment

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

The main reason for the attic is not so much archival but maintaining a list of what used to exist. If you we just deleted files, it would be harder to find the commit that deleted a particular without knowing where it used to exist and what its name was.

To get to the exact original, one can always look at the commit that placed the file into the attic.

@nadove-ucsc nadove-ucsc removed their assignment Apr 12, 2021
@amarjandu amarjandu force-pushed the issues/amar/2950-rm-auth branch 2 times, most recently from ee9cc4e to 50c8150 Compare April 12, 2021 23:31
@nadove-ucsc nadove-ucsc self-requested a review April 13, 2021 02:29
Copy link
Contributor

@nadove-ucsc nadove-ucsc left a comment

Choose a reason for hiding this comment

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

Adding the import statements to the attic introduced conflicts. In light of @hannes-ucsc's clarifying comments, it seems better to omit the import statements from the attic after all.

@nadove-ucsc
Copy link
Contributor

Additionally, there are several lingering references to the cart functionality throughout the codebase and TF templates:

~/PycharmProjects/azul-sc$ grep -i cart $(find src/azul/ -name '*.py')
src/azul/plugins/__init__.py:    cart_item: Mapping[str, Sequence[str]]
src/azul/plugins/metadata/hca/__init__.py:            cart_item={
src/azul/service/lambda_iam_policy.py:                f"arn:aws:dynamodb:{aws.region_name}:{aws.account}:table/{config.dynamo_cart_table_name}",
src/azul/service/lambda_iam_policy.py:                f"arn:aws:dynamodb:{aws.region_name}:{aws.account}:table/{config.dynamo_cart_item_table_name}",
src/azul/service/lambda_iam_policy.py:                f"arn:aws:dynamodb:{aws.region_name}:{aws.account}:table/{config.dynamo_cart_table_name}/index/*",
src/azul/service/lambda_iam_policy.py:                f"arn:aws:dynamodb:{aws.region_name}:{aws.account}:table/{config.dynamo_cart_item_table_name}/index/*",
src/azul/service/lambda_iam_policy.py:                f"arn:aws:states:{aws.region_name}:{aws.account}:stateMachine:{config.cart_item_state_machine_name}",
src/azul/service/lambda_iam_policy.py:                f"arn:aws:states:{aws.region_name}:{aws.account}:stateMachine:{config.cart_export_state_machine_name}"
src/azul/service/lambda_iam_policy.py:                f"arn:aws:states:{aws.region_name}:{aws.account}:execution:{config.cart_item_state_machine_name}:*",
src/azul/service/lambda_iam_policy.py:                f"arn:aws:states:{aws.region_name}:{aws.account}:execution:{config.cart_export_state_machine_name}"
src/azul/service/user_service.py:                                             item={'UserId': user_id, 'DefaultCartId': None})
src/azul/service/user_service.py:    def update(self, user_id: str, default_cart_id):
src/azul/service/user_service.py:        :param default_cart_id: the ID of the default cart (nullable)
src/azul/service/user_service.py:        if default_cart_id is not None:
src/azul/service/user_service.py:            update_conditions['DefaultCartId'] = None
src/azul/service/user_service.py:                                                    update_values={'DefaultCartId': default_cart_id},
src/azul/service/user_service.py:            raise UpdateError(user_id, default_cart_id)
src/azul/service/elasticsearch_service.py:    def transform_cart_item_request(self,
src/azul/service/elasticsearch_service.py:        Create a query using the given filter used for cart item requests
src/azul/service/elasticsearch_service.py:        :param entity_type: type of entities to write to the cart
src/azul/service/elasticsearch_service.py:        source_filter = list(chain(service_config.cart_item['bundles'],
src/azul/service/elasticsearch_service.py:                                   service_config.cart_item[entity_type]))
src/azul/__init__.py:    def dynamo_cart_table_name(self):
src/azul/__init__.py:        return self.qualified_resource_name('carts')
src/azul/__init__.py:    def dynamo_cart_item_table_name(self):
src/azul/__init__.py:        return self.qualified_resource_name('cartitems')
src/azul/__init__.py:    cart_item_write_lambda_basename = 'cartitemwrite'
src/azul/__init__.py:    def cart_item_state_machine_name(self):
src/azul/__init__.py:        return self.qualified_resource_name('cartitems')
src/azul/__init__.py:    def cart_export_max_batch_size(self):
src/azul/__init__.py:        return int(os.environ['AZUL_CART_EXPORT_MAX_BATCH_SIZE'])
src/azul/__init__.py:    def cart_export_min_access_token_ttl(self):
src/azul/__init__.py:        return int(os.environ['AZUL_CART_EXPORT_MIN_ACCESS_TOKEN_TTL'])
src/azul/__init__.py:    def cart_export_state_machine_name(self):
src/azul/__init__.py:        return self.qualified_resource_name('cartexport')
src/azul/__init__.py:    cart_export_dss_push_lambda_basename = 'cartexportpush'

It's not clear to me whether these fall under the scope of this ticket, since the title only mentioned the "cart service". But the (undocumented) UserService class and its associated unit tests only seem to be used by the attic-ed CartItemManager, so perhaps they ought to be attic-ed as well. Same for ElasticSearchService.transform_cart_item_request. I recommend discussing this with @hannes-ucsc at parking lot, unless he weighs in before then.

@nadove-ucsc nadove-ucsc removed their assignment Apr 13, 2021
@hannes-ucsc
Copy link
Member

The ticket speaks of "cart functionality", so yes, that stuff should be moved to attic as well. Consider collecting everything in a sub-directory of the attic e.g., attic/cart.

@amarjandu amarjandu force-pushed the issues/amar/2950-rm-auth branch 3 times, most recently from e19f7b8 to e1e6768 Compare April 14, 2021 15:01
#2950 Move auth and cart service to attic
=========================================

1. Before upgrading to this commit, run ::
Copy link
Member

Choose a reason for hiding this comment

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

@hannes-ucsc hannes-ucsc removed their assignment Apr 16, 2021
@hannes-ucsc hannes-ucsc added the no demo [process] Not to be demonstrated at the end of the sprint label Apr 16, 2021
@hannes-ucsc hannes-ucsc changed the title Move auth and cart service to attic (#2950) Remove existing authentication and cart functionality (#2950) Apr 16, 2021
@amarjandu
Copy link
Contributor Author

Force pushed branch after approval due to force push to develop branch.

@amarjandu amarjandu assigned achave11-ucsc and unassigned amarjandu Apr 19, 2021
@amarjandu amarjandu added the upgrade [process] PR includes commit requiring manual upgrade label Apr 20, 2021
@nadove-ucsc nadove-ucsc added the base [process] Another PR needs to be rebased before merging this one label Apr 20, 2021
@achave11-ucsc achave11-ucsc added the sandbox [process] Resolution is being verified in sandbox deployment label Apr 20, 2021
@achave11-ucsc
Copy link
Member

achave11-ucsc commented Apr 20, 2021

Unit test not passing in sandbox, reassigning to @amarjandu.

@achave11-ucsc achave11-ucsc removed their assignment Apr 20, 2021
@achave11-ucsc achave11-ucsc removed the sandbox [process] Resolution is being verified in sandbox deployment label Apr 20, 2021
@amarjandu
Copy link
Contributor Author

unable to replicate travis failure locally.
ran git prsq then pushed re-based changes to this PR branch.
tests now show passing.

@achave11-ucsc achave11-ucsc added the sandbox [process] Resolution is being verified in sandbox deployment label Apr 21, 2021
@achave11-ucsc achave11-ucsc merged commit 1bfaaf9 into develop Apr 21, 2021
@achave11-ucsc achave11-ucsc deleted the issues/amar/2950-rm-auth branch April 21, 2021 15:46
@achave11-ucsc achave11-ucsc removed their assignment Apr 21, 2021
@amarjandu amarjandu mentioned this pull request Apr 26, 2021
48 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 review [process] Lead requested changes once base [process] Another PR needs to be rebased before merging this one no demo [process] Not to be demonstrated at the end of the sprint orange [process] Done by the Azul team sandbox [process] Resolution is being verified in sandbox deployment upgrade [process] PR includes commit requiring manual upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants