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

multiple device refresh improvements #2281

Merged
merged 12 commits into from
Jan 31, 2024
Merged

Conversation

husobee
Copy link
Contributor

@husobee husobee commented Jan 9, 2024

Summary

updates to delete credentials to only hard delete where request id matches item id

Type of Change

  • Product feature
  • Bug fix
  • Performance improvement
  • Refactor
  • Other

Tested Environments

  • Development
  • Staging
  • Production

Before Requesting Review

  • Does your code build cleanly without any errors or warnings?
  • Have you used auto closing keywords?
  • Have you added tests for new functionality?
  • Have validated query efficiency for new database queries?
  • Have documented new functionality in README or in comments?
  • Have you squashed all intermediate commits?
  • Is there a clear title that explains what the PR does?
  • Have you used intuitive function, variable and other naming?
  • Have you requested security and/or privacy review if needed
  • Have you performed a self review of this PR?

Manual Test Plan

@husobee husobee self-assigned this Jan 9, 2024
@husobee husobee marked this pull request as ready for review January 24, 2024 21:28
services/skus/credentials.go Outdated Show resolved Hide resolved
services/skus/controllers.go Outdated Show resolved Hide resolved
services/skus/order.go Outdated Show resolved Hide resolved
services/skus/credentials.go Outdated Show resolved Hide resolved
services/skus/controllers.go Outdated Show resolved Hide resolved
services/skus/controllers.go Outdated Show resolved Hide resolved
services/skus/controllers.go Outdated Show resolved Hide resolved
@clD11
Copy link
Contributor

clD11 commented Jan 24, 2024

Could we add some tests to cover the new functionality/endpoints?

services/skus/controllers.go Outdated Show resolved Hide resolved
Copy link
Contributor

@pavelbrm pavelbrm left a comment

Choose a reason for hiding this comment

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

There are a few important bugs in the new code that need to be fixed before this is ready. At the very least, in the order of importance:

  • The captured loop variable will result in the same value stored len(slice) times. Plus pointers.
  • Pointers to UUIDs need to be replaced with values.

@pavelbrm pavelbrm mentioned this pull request Jan 25, 2024
18 tasks
Copy link
Contributor

@pavelbrm pavelbrm left a comment

Choose a reason for hiding this comment

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

I went ahead and expressed my feedback in #2314. Please read the description and the PR. It addresses the following aspects:

  • Expresses the deletion logic so it's testable;
  • Added test for the deletion logic so that we can see what's being passed down to the datastore level;
  • Fixed types for UUID.

@pavelbrm pavelbrm self-requested a review January 25, 2024 06:58
* fix: review

* test: add tests
…exceeds threshold

updates to multi-device improvements to get active credentials count

fixing delete tlv2 test cases to include new check call

fixing db field for request_id for tlv2 creds table
@husobee husobee force-pushed the multi-device-improvements branch from 2ebbd8e to d3ae44e Compare January 29, 2024 16:45
services/skus/datastore.go Outdated Show resolved Hide resolved
@clD11
Copy link
Contributor

clD11 commented Jan 30, 2024

Added some comments, at the minimum can we resolve any marked as issue before approving.

Copy link
Contributor

@pavelbrm pavelbrm left a comment

Choose a reason for hiding this comment

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

Waiting on the open comments to be addressed before doing the final review.

Copy link

The following commits were not verified:
d9f6d1b (unsigned)
d3ae44e (unsigned)
633ff7d (unsigned)
a40fb6c (unsigned)
5012c82 (unsigned)
ff503ec (unsigned)

services/skus/controllers.go Outdated Show resolved Hide resolved
services/skus/datastore.go Outdated Show resolved Hide resolved
@pavelbrm pavelbrm mentioned this pull request Jan 30, 2024
18 tasks
Copy link

[puLL-Merge] - brave-intl/bat-go@2281

Description

This PR makes changes to the controllers.go, credentials.go, credentials_noint_test.go, datastore.go, datastore_test.go, instrumented_datastore.go, mockdatastore.go, and order.go files. It adds a new method for handling the deletion of order item credentials and makes related modifications.

Changes

Changes

  • services/skus/controllers.go:

    • Added a new deleteItemCreds method for handling the deletion of credentials for an item.
    • Updated the DeleteOrderCreds method to accept an additional parameter reqID.
  • services/skus/credentials.go:

    • Added a constant for maxTLV2ActiveOrderCreds.
    • Updated the DeleteOrderCreds method to accept an additional parameter reqID.
    • Added a new method deleteTLV2 for handling the deletion of time-limited V2 credentials.
  • services/skus/credentials_noint_test.go:

    • Added a new test case for the deleteTLV2 method.
  • services/skus/datastore.go:

    • Updated the DeleteTimeLimitedV2OrderCredsByOrderTx method to accept an additional parameter itemIDs.
    • Added a new method GetCountActiveOrderCreds for retrieving the count of active order credentials.
  • services/skus/datastore_test.go:

    • Added a new test case for the GetCountActiveOrderCreds method.
  • services/skus/instrumented_datastore.go:

    • Updated the DeleteTimeLimitedV2OrderCredsByOrderTx method to accept an additional parameter itemIDs.
    • Added instrumented methods for GetCountActiveOrderCreds and GetTLV2Creds.
  • services/skus/mockdatastore.go:

    • Updated the DeleteTimeLimitedV2OrderCredsByOrderTx method to accept an additional parameter itemIDs.
    • Added a mock method for GetCountActiveOrderCreds.
  • services/skus/order.go:

    • Updated the RenewOrder method to call the updated DeleteOrderCreds method with an additional parameter.

Security Hotspots

N/A

@husobee husobee merged commit fc29a86 into master Jan 31, 2024
12 checks passed
@husobee husobee deleted the multi-device-improvements branch January 31, 2024 14:59
@husobee husobee mentioned this pull request Jan 31, 2024
18 tasks
@husobee husobee restored the multi-device-improvements branch February 2, 2024 20:57
husobee added a commit that referenced this pull request Feb 2, 2024
husobee added a commit that referenced this pull request Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants