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

Adds a cli command to restart privacy requests #96

Merged
merged 1 commit into from Dec 6, 2022

Conversation

michaelfarrell76
Copy link
Member

@michaelfarrell76 michaelfarrell76 commented Dec 6, 2022

Related Issues

This PR moves out our internal battle tested bulk-restart request script to be accessible through the cli.

Screen.Recording.2022-12-06.at.12.31.48.AM.mov

Bulk update a set of privacy requests based on a set of request filters.

Authentication

In order to use this cli, you will first need to generate an API key on the Transcend Admin Dashboard (https://app.transcend.io/infrastructure/api-keys).

The API key needs the following scopes:

  • Submit New Data Subject Request
  • View the Request Compilation

Arguments

Argument Description Type Default Required
auth The Transcend API capable of submitting privacy requests. string N/A true
acions The request action to restart. RequestAction[] N/A true
statuses The request statuses to restart. RequestStatus[] N/A true
transcendUrl URL of the Transcend backend. Use https://api.us.transcend.io for US hosting. string - URL https://api.transcend.io false
requestReceiptFolder The path to the folder where receipts of each upload are stored. This allows for debugging of errors. string ./privacy-request-upload-receipts false
sombraAuth The sombra internal key, use for additional authentication when self-hosting sombra. string N/A false
concurrency The concurrency to use when uploading requests in parallel. number 20 false
requestIds Specify the specific request IDs to restart string[] [] false
createdAt Restart requests that were submitted before a specific date. Date Date.now() false
markSilent Requests older than this date should be marked as silent mode Date Date.now() - 3 months false
sendEmailReceipt Send email receipts to the restarted requests boolean false false
copyIdentifiers Copy over all enriched identifiers from the initial request. Leave false to restart from scratch with initial identifiers only. boolean false false
skipWaitingPeriod Skip queued state of request and go straight to compiling boolean false false

Usage

yarn tr-request-restart --auth=$TRANSCEND_API_KEY --statuses=COMPILING,ENRICHING --actions=ACCESS,ERASURE

For self-hosted sombras that use an internal key:

yarn tr-request-restart --auth=$TRANSCEND_API_KEY --sombraAuth=$SOMBRA_INTERNAL_KEY --statuses=COMPILING,ENRICHING --actions=ACCESS,ERASURE

Specifying the backend URL, needed for US hosted backend infrastructure.

yarn tr-request-restart --auth=$TRANSCEND_API_KEY --sombraAuth=$SOMBRA_INTERNAL_KEY --statuses=COMPILING,ENRICHING --actions=ACCESS,ERASURE \
 --transcendUrl=https://api.us.transcend.io

Increase the concurrency (defaults to 20)

yarn tr-request-restart --auth=$TRANSCEND_API_KEY --statuses=COMPILING,ENRICHING --actions=ACCESS,ERASURE --concurrency=100

Restart specific requests by ID

yarn tr-request-restart --auth=$TRANSCEND_API_KEY --statuses=COMPILING,ENRICHING --actions=ACCESS,ERASURE --requestIds=c3ae78c9-2768-4666-991a-d2f729503337,342e4bd1-64ea-4af0-a4ad-704b5a07cfe4

Restart requests that were submitted before a specific date.

yarn tr-request-restart --auth=$TRANSCEND_API_KEY --statuses=COMPILING,ENRICHING --actions=ACCESS,ERASURE --createdAt=2022-05-11T00:46

Restart requests and place everything in silent mode submitted before a certain date

yarn tr-request-restart --auth=$TRANSCEND_API_KEY --statuses=COMPILING,ENRICHING --actions=ACCESS,ERASURE --markSilent=2022-12-05T00:46

Send email receipts to the restarted requests

yarn tr-request-restart --auth=$TRANSCEND_API_KEY --statuses=COMPILING,ENRICHING --actions=ACCESS,ERASURE --sendEmailReceipt=true

Copy over all enriched identifiers from the initial request. Leave false to restart from scratch with initial identifiers only

yarn tr-request-restart --auth=$TRANSCEND_API_KEY --statuses=COMPILING,ENRICHING --actions=ACCESS,ERASURE --copyIdentifiers=true

Skip queued state of request and go straight to compiling

yarn tr-request-restart --auth=$TRANSCEND_API_KEY --statuses=COMPILING,ENRICHING --actions=ACCESS,ERASURE --skipWaitingPeriod=true

@height
Copy link

height bot commented Dec 6, 2022

This pull request has been linked to 1 task:

  • T-8986 ability to bulk restart requests matching a filter, with the option to run against different data silos (unlink task)

💡Tip: Add "Close T-8986" to the pull request title or description, to a commit message, or in a comment to mark this task as "Done" when the pull request is merged.

@michaelfarrell76 michaelfarrell76 force-pushed the michaelfarrell76/cli-restart-requests branch from 39c3982 to c279839 Compare December 6, 2022 08:38
@michaelfarrell76 michaelfarrell76 force-pushed the michaelfarrell76/cli-restart-requests branch from c279839 to e1017bd Compare December 6, 2022 08:38
// eslint-disable-next-line no-await-in-loop
} = await makeGraphQLRequest(client, REQUESTS, {
first: PAGE_SIZE,
offset,
Copy link
Member

Choose a reason for hiding this comment

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

We should be using cursor based pagination here using something like createdAt to avoid stressing out our DB on deep pages, similar to the Salesloft issue we caused, all those moons ago. An example we have in our codebase: https://github.com/transcend-io/main/blob/ceacc7b526a62c89f524ffb58ac7ae4f421d1f59/frontend-services/admin-dashboard/src/PrivacyRequests/ExportToCsv/index.tsx#L134

Copy link
Member Author

Choose a reason for hiding this comment

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

oh good callout. this repo has this pagination in a future place, ill make a ticket to refactor these all, but im gonna merge this for now to unblock testing. refactoring this will require new testing.

});
const requests = allRequests.filter(
(request) =>
new Date(request.createdAt) < createdAt &&
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: Would use moment

@michaelfarrell76 michaelfarrell76 merged commit 9665142 into main Dec 6, 2022
@delete-merged-branch delete-merged-branch bot deleted the michaelfarrell76/cli-restart-requests branch December 6, 2022 17: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.

None yet

3 participants