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

Increase flexibility of ForageElement hierarchy #248

Conversation

devinmorgan
Copy link
Contributor

@devinmorgan devinmorgan commented May 3, 2024

πŸ‘‹ This notion doc contains the broader context of this PR stack. Please make sure to read it once!

What

Step 3 of Part 1.. This is the top of the stack.

Why

See here

Test Plan

  • ❌ I've added unit tests for this change. Did not add any new tests because this PR does not introduce any new functionality.
  • ❌ The reviewer should manually test the changes in this PR. No need to manual test because the top PR in the stack passes CI tests

Demo

N/A - no new functionality

How

This PR is the top-of-the-stack is that will get merged into main. Once folks have approved the stack. I will change the base of this PR to point to main and merge that in. I then will close #246 and #247. See here for more detail.

@devinmorgan
Copy link
Contributor Author

devinmorgan commented May 3, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @devinmorgan and the rest of your teammates on Graphite Graphite

@devinmorgan devinmorgan force-pushed the devin/move-things-to-core-and-ecom branch from 6458699 to 1772e21 Compare May 9, 2024 18:43
@devinmorgan devinmorgan force-pushed the devin/fx-1331-introduce-the-new-forageelement-hierarchy-from-pos-repo-into branch from 08b79c4 to bc613e2 Compare May 9, 2024 18:43
@devinmorgan devinmorgan marked this pull request as ready for review May 10, 2024 14:39
Copy link
Contributor

@djoksimo djoksimo left a comment

Choose a reason for hiding this comment

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

Great stuff @devinmorgan ! Left a few comments. Open to discussing them sync/async!

if (vaultResponse.isSuccess) return null
val resRegExp = BtResponseRegExp(vaultResponse)
return try {
// TODO: add DD metric to track frequency of proxy errors
Copy link
Contributor

Choose a reason for hiding this comment

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

The caller captures proxy errors using the vault monitor/measurer [VaultProxyResponseMonitor]. Can remove or update this comment to include the context from this comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah nice! OK I'll modify the comment to capture this. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the comment!

We want the private pos repo and the public ecom repo to have the
ability to evolve separately accordingly their unique needs while
still sharing common code. The first step in this journey is to
make the public ecom repo completely unaware of the existence of
the private pos repo. We do that by deleting all of the pos code

Signed-off-by: Devin Morgan <[email protected]>
The second step in the public ecommerce repo that needs to take
place in order to make sharing code between the private pos
repo and this repo pain free; all while allowing for both repos
to evolve independently

Signed-off-by: Devin Morgan <[email protected]>
This is the third step in the public ecommerce repo that needs to
take place in order to make sharing code between the private pos
repo and this repo pain free; all while allowing for both repos
to evolve independently.

This hierarchy will make it easy to keep ecom things in the
ecom-ForagePinEditText and pos things in the pos-ForagePINEditText

Signed-off-by: Devin Morgan <[email protected]>
Previously `vaultToForageResponse` relied on generics to because
VGS and BT responses differ. However, generics in Kotlin do not
support the union ("|") types, which means that using generics
will require the parent `AbstractVaultSubmitter` class to be aware
of all classes that implement it.

This is a problem because `AbstractVaultSubmitter` houses the
common template for of submitting requests to vaults and ought
to live in `/core`. But `/core` cannot be aware of any vault
specific details if it is to be reusable by the pos repo.

So, this commit, replaces the usage of generics with a common
interface that all VaultSubmitter may _privately_ implement. The
ability for VaultSubmitters to _privately_ implement the details
by which they interpret vault response and
ForageApiResponse.Success or ForageApiResponse.Failures makes it
possible to move `AbstractVaultSubmitter` to `/core` and still
house the common logic for submitting requests to vaults

Signed-off-by: Devin Morgan <[email protected]>
@devinmorgan devinmorgan force-pushed the devin/move-things-to-core-and-ecom branch from 1772e21 to ee43184 Compare May 15, 2024 17:56
@devinmorgan devinmorgan force-pushed the devin/fx-1331-introduce-the-new-forageelement-hierarchy-from-pos-repo-into branch from baf176a to 09cfb94 Compare May 15, 2024 17:57
@devinmorgan devinmorgan requested a review from djoksimo May 15, 2024 18:06
@devinmorgan devinmorgan changed the base branch from devin/move-things-to-core-and-ecom to main May 15, 2024 18:15
@devinmorgan devinmorgan merged commit 3664b73 into main May 15, 2024
5 of 7 checks passed
@devinmorgan devinmorgan deleted the devin/fx-1331-introduce-the-new-forageelement-hierarchy-from-pos-repo-into branch July 1, 2024 12:22
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