-
Notifications
You must be signed in to change notification settings - Fork 47
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
10504 dxox: Case Deadlines, Correspondences, and Worksheets #5520
Draft
pixiwyn
wants to merge
123
commits into
ustaxcourt:staging
Choose a base branch
from
flexion:10504-dxox
base: staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 34 commits
Commits
Show all changes
123 commits
Select commit
Hold shift + click to select a range
e8420a8
10391 - starting work to refactor work items
codyseibert 16f12f6
10391 - refactoring the qc inbox to use postgres instead of elasticse…
codyseibert 5c74ea9
10391 - refactoring a few more methods
codyseibert f59ff36
10391: sort prop fields in seed data
jtdevos c2eb549
Merge branch '10391-work-item-refactor' of https://github.com/flexion…
jtdevos e000047
10491 - refactoring more work items
codyseibert 51b188d
Merge branch '10391-dynamo-migrations-kysely-aurora-rds-tokens' of gi…
pixiwyn 50887b3
10491: Refactor out duplicate case details
pixiwyn 15f86d2
10491: join with case
pixiwyn 3879a0d
10491: covert remaining dynamodb functions
pixiwyn 1159aa5
10491: fix lint errors
pixiwyn 34676fc
Merge branch '10391-dynamo-migrations-kysely-aurora-rds-tokens' of gi…
pixiwyn 0f98fef
Merge branch '10391-dynamo-migrations-kysely-aurora-rds-tokens' of gi…
pixiwyn b4f8c99
10491 - trying to fix work items
codyseibert 13b715a
10491: add mocks + use in api test
pixiwyn 49fea39
10491: fix workitems mock import name
pixiwyn 23ae202
10491: fix mocks path
pixiwyn 4b3c9cf
10491 - fetching work items when doing queryFull
codyseibert d630e0f
Merge branch '10391-dynamo-migrations-kysely-aurora-rds-tokens' of gi…
pixiwyn 604212f
10491: refactor to use prefix
pixiwyn 1a060ac
10491: fix shared tests
pixiwyn b88f8c9
10491: fix linting errors
pixiwyn 4e1e5a7
10491: update broken mock
pixiwyn e6368ca
10491: fix mocks
pixiwyn 69a625e
10491: remove unnecessary tests + add mock values
pixiwyn 0df7f78
10491: fix shared tests
pixiwyn a1a39c9
10491: update association if workItems and add mock
pixiwyn abc2f20
10491: add additional mocks
pixiwyn 508e7ad
10491: add default returnValue
pixiwyn ec2e952
10491: fix shared tests
pixiwyn 0ba8e15
10491: fix api tests
pixiwyn 058cd40
Merge branch 'staging' of github.com:ustaxcourt/ef-cms into 10491-wor…
pixiwyn ac16041
10491: fix more tests
pixiwyn 5ed20d2
fixing some integration tests
codyseibert 31eab83
Merge branch '10491-work-item-refactor' of github.com:flexion/ef-cms …
codyseibert aa5651f
10491: fix sentWorkItemsExpireAfterNDays.test.ts
pixiwyn c16b3b4
Merge branch '10491-work-item-refactor' of github.com:flexion/ef-cms …
pixiwyn 2685218
10491 - fixing integration test
codyseibert b5919db
10491: fix api tests
pixiwyn 3575038
10491 - fixing more integration tests
codyseibert 1ec0f19
Merge branch '10491-work-item-refactor' of github.com:flexion/ef-cms …
codyseibert 4495d6d
10491: fix api tests
pixiwyn 6f92426
Merge branch '10491-work-item-refactor' of github.com:flexion/ef-cms …
pixiwyn 663d6ae
10491: fix api tests
pixiwyn 0208f12
10491 - fixing more integration tests
codyseibert 0e8fb91
10491 - fixing more integration tests
codyseibert 9bf112d
10491: fix remaining tests (hopefully?)
pixiwyn bc09c44
10491: fix last test
pixiwyn 4d4787e
10504: start case correspondence + deadline
pixiwyn b1f6ade
10504: add additional case deadline queries
pixiwyn a0a6557
10504: remove old case deadline queries
pixiwyn 8af8edd
10504: add seed data
pixiwyn 3d157ab
10504: fix error with docket number
pixiwyn 1da7c2d
10504: add correspondence seed
pixiwyn d13d26c
10491: add case correspondence
pixiwyn 98dcdf6
10504: add case worksheets
pixiwyn 2747950
10492: resolve conflicts
pixiwyn f0252e3
10491: update spell check
pixiwyn a0e67e2
Merge branch 'staging' of github.com:ustaxcourt/ef-cms into 10504-dxox
pixiwyn 41c118c
10491-work-item-refactor: fix failing tests and type errors
Mwindo 9471803
10504-dxox: remove case-dealine| and fix correspondence mock file and…
Mwindo 68c798b
10504-dxox: add mocks.jest.ts files, and fix updateCaseAndAssociation…
Mwindo d22ec53
10504-dxox: fix updatePetitionerInformationInteractor.test.ts
Mwindo ddeea43
10504-dxox: fix CaseDeadline.test.ts, getCaseDeadlnesInteractor.test.…
Mwindo b13ad2d
10504-dxox: fixing a whole lotta api tests
Mwindo 8cc25ac
10504-dxox: fix shared test
Mwindo fecdc98
10504-dxox: fix more API tests
Mwindo 016287e
10504-dxox: fix a few more tests, undo a change to MOCK_CASE (which w…
Mwindo 81af9d7
10504-dxox: fix more tests, and some types
Mwindo db2846a
10504-dxox: remove dynamo persistence from client test application co…
Mwindo a09c769
10504-dxox: fix failing scripts test
Mwindo 739a7d7
10504-dxox: fix failing integration test
Mwindo cba4b8c
10504-dxox: null check in caseWorksheet mapper
Mwindo 3fbe127
10504-dxox: fix integration tests failing for timezone reasons
Mwindo 3df68d9
10504-dxox: fix more timezone format mismatches in tests
Mwindo 54c0cab
10504-dxox: change createCaseDeadline to upserCaseDeadline, and relat…
Mwindo 891ae7a
10504-dxox: fix script test and api tests
Mwindo 967414b
10504-dxox: remove numberOfPages, which looks like it was a spurious …
Mwindo 86cca87
10504-dxox: remove numberOfPages from migration
Mwindo bcab627
10504-dxox: WIP using upsertCaseCorrespondences instead of upsertCase…
Mwindo 00458dc
10504-dxox: WIP, make stream processors for deadlines, correspondence…
Mwindo f687585
10504-dxox: fix incorrect keys in processStreamUtilities; replace ups…
Mwindo 60114d3
10504-dxox: update some tests after the previous refactor
Mwindo 037f5b8
10504-dxox: add deletition scripts, add validation for judge id to Ca…
Mwindo 830ab53
10504-dxox: add tests to new stream processors, and update postgres d…
Mwindo fcbf4ba
10504-dxox: fix validateCaseWorksheetAction.test, and avoid passing …
Mwindo fee1eaf
10504-dxox: add 'so far' to deletion scripts
Mwindo 7ecc01b
10504-dxox: update postgres run-once scripts to have correct HOW TO R…
Mwindo 4d63bd8
10504-dxox: merge in staging, and re-add docketNumber in Case assignC…
Mwindo 88c1362
10504-dxox: remove docketNumber in assignCorrespondences since it see…
Mwindo c387e5a
10504-dxox: remove unused import
Mwindo d206648
10504-dxox: readd docketNumber in assignCorrespondences, which is nec…
Mwindo 49a723a
10491-dxox: add delete script for work items; todo, delete script for…
Mwindo 8c7b54d
10491-dxox: add delete scripts for outboxes
Mwindo 38d4183
10491-work-items: update delete scripts
Mwindo b86bed9
10504-dxox: update delete script
Mwindo aa2df5b
Merge branch 'staging' of github.com:ustaxcourt/ef-cms into 10491-wor…
pixiwyn 14920cd
Merge branch 'staging' into 10504-dxox
pixiwyn f62ed84
10504-dxox: update overlooked delete scripts and add CIRCLE_BRANCH var
Mwindo f7cabd7
10504-dxox: experiment to prevent creating lots of db connections
Mwindo e0693cd
Merge remote-tracking branch 'ustc/staging' into 10504-dxox
Mwindo 68f04f8
10504: Reuse existing connection if possible
pixiwyn 8200d45
10504-dxox: fix type error
Mwindo 2f511b0
10504-dxox: fix processCaseCorrespondenceEntries and processCaseWorks…
Mwindo 58aa324
10504-dxox: fix typo gs1pk to gsi1pk, fix failing test, and improve t…
Mwindo 5aeba6f
10504-dxox: fix entityName typo
Mwindo 2833a46
10491-dxox: change saveWorkItem to upsertWorkItems for consistency wi…
Mwindo 768602a
10491-dxox: upsert work items into postgres and add test; also, use g…
Mwindo e74c2fe
10491-dxox: fix overlooked renames
Mwindo 2ecea56
10491-dxox: upsert last in processWorkItemEntries to prevent latency …
Mwindo f58a675
10491-dxox: add indices to work-items and restructure queries slightl…
Mwindo 3125857
10504-dxox: add indices
Mwindo dc7e93a
10504-dxox: merge 10491
Mwindo 9b3a8e5
10504: update lock file
Mwindo be2371e
10504-dxox: fix up delete scripts slightly
Mwindo a6a8c77
10504-dxox: fix sks in delete scripts
Mwindo 7ea0166
10491: return workItem when submitting paper filing
pixiwyn 44a059e
10491: add test for new optional work item and work item id
pixiwyn 43a4436
Merge branch 'staging' of github.com:ustaxcourt/ef-cms into 10491-wor…
pixiwyn 81b76f1
10491: update package lock file
pixiwyn 9ab7121
10491: fix broken tests
pixiwyn 4d9d161
Merge branch '10491-work-item-refactor' into 10504-dxox after changes…
Mwindo c14d6fc
10504-dxox: fix finalBriefDueDate issue
Mwindo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
check Correspondence works now with docketNumber (added to the entity) and update validation? | ||
|
||
-- | ||
|
||
Is docketNumber in Case assignCorrespondences necessary? Were there some old cases, maybe, onto which we directly stored correspondences? | ||
|
||
|
||
-- | ||
|
||
check CaseWorksheet works now with judgeUserId (added to the entity) and update validation? | ||
|
||
-- | ||
|
||
entityName: "CaseWorksheet" in updateCaseWorksheetAction is silly | ||
|
||
-- | ||
|
||
add missing tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
scripts/run-once-scripts/postgres-migration/batch-delete-dynamo-items.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { | ||
BatchWriteCommand, | ||
DynamoDBDocumentClient, | ||
} from '@aws-sdk/lib-dynamodb'; | ||
|
||
export async function batchDeleteDynamoItems( | ||
itemsToDelete: { DeleteRequest: { Key: { pk: string; sk: string } } }[], | ||
client: DynamoDBDocumentClient, | ||
tableNameInput: string, | ||
): Promise<number> { | ||
const BATCH_SIZE = 25; | ||
const RETRY_DELAY_MS = 5000; // Set the delay between retries (in milliseconds) | ||
let totalItemsDeleted = 0; | ||
|
||
for (let i = 0; i < itemsToDelete.length; i += BATCH_SIZE) { | ||
const batch = itemsToDelete.slice(i, i + BATCH_SIZE); | ||
|
||
const batchWriteParams = { | ||
RequestItems: { | ||
[tableNameInput]: batch, | ||
}, | ||
}; | ||
|
||
try { | ||
let unprocessedItems: any[] = batch; | ||
let retryCount = 0; | ||
const MAX_RETRIES = 5; | ||
|
||
// Retry logic for unprocessed items | ||
while (unprocessedItems.length > 0 && retryCount < MAX_RETRIES) { | ||
const response = await client.send( | ||
new BatchWriteCommand(batchWriteParams), | ||
); | ||
|
||
totalItemsDeleted += | ||
unprocessedItems.length - | ||
(response.UnprocessedItems?.[tableNameInput]?.length || 0); | ||
|
||
unprocessedItems = response.UnprocessedItems?.[tableNameInput] ?? []; | ||
|
||
if (unprocessedItems.length > 0) { | ||
console.log( | ||
`Retrying unprocessed items: ${unprocessedItems.length}, attempt ${retryCount + 1}`, | ||
); | ||
batchWriteParams.RequestItems[tableNameInput] = unprocessedItems; | ||
retryCount++; | ||
|
||
// Add delay before the next retry | ||
await new Promise(resolve => setTimeout(resolve, RETRY_DELAY_MS)); | ||
} | ||
} | ||
|
||
if (unprocessedItems.length > 0) { | ||
console.error( | ||
`Failed to delete ${unprocessedItems.length} items after ${MAX_RETRIES} retries.`, | ||
); | ||
} | ||
} catch (error) { | ||
console.error('Error in batch delete:', error); | ||
} | ||
} | ||
return totalItemsDeleted; | ||
} |
63 changes: 63 additions & 0 deletions
63
scripts/run-once-scripts/postgres-migration/delete-case-correspondences.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* HOW TO RUN | ||
* | ||
* TABLE_NAME=testing npx ts-node --transpileOnly scripts/postgres/delete-case-correspondences.ts | ||
*/ | ||
|
||
import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb'; | ||
import { DynamoDBClient, ScanCommandInput } from '@aws-sdk/client-dynamodb'; | ||
import { requireEnvVars } from '../../../shared/admin-tools/util'; | ||
import { getDbReader } from '../../../web-api/src/database'; | ||
import { isEmpty } from 'lodash'; | ||
import { batchDeleteDynamoItems } from './batch-delete-dynamo-items'; | ||
|
||
const caseCorrespondencePageSize = 10000; | ||
const dynamoDbClient = new DynamoDBClient({ region: 'us-east-1' }); | ||
const dynamoDbDocClient = DynamoDBDocumentClient.from(dynamoDbClient); | ||
|
||
requireEnvVars(['TABLE_NAME']); | ||
|
||
const tableNameInput = process.env.TABLE_NAME!; | ||
|
||
const getCaseCorrespondencesToDelete = async (offset: number) => { | ||
const caseCorrespondences = await getDbReader(reader => | ||
reader | ||
.selectFrom('dwCaseCorrespondence') | ||
.select(['docketNumber', 'correspondenceId']) | ||
.orderBy('correspondenceId') | ||
.limit(caseCorrespondencePageSize) | ||
.offset(offset) | ||
.execute(), | ||
); | ||
return caseCorrespondences; | ||
}; | ||
|
||
let totalItemsDeleted = 0; | ||
|
||
async function main() { | ||
let offset = 0; | ||
let caseCorrespondencesToDelete = | ||
await getCaseCorrespondencesToDelete(offset); | ||
|
||
while (!isEmpty(caseCorrespondencesToDelete)) { | ||
const dynamoItemsToDelete = caseCorrespondencesToDelete.map(cd => ({ | ||
DeleteRequest: { | ||
Key: { | ||
pk: `case|${cd.docketNumber}`, | ||
sk: `correspondence${cd.correspondenceId}`, | ||
}, | ||
}, | ||
})); | ||
totalItemsDeleted += await batchDeleteDynamoItems( | ||
dynamoItemsToDelete, | ||
dynamoDbDocClient, | ||
tableNameInput, | ||
); | ||
console.log(`Total case correspondences deleted: ${totalItemsDeleted}`); | ||
offset += caseCorrespondencePageSize; | ||
caseCorrespondencesToDelete = await getCaseCorrespondencesToDelete(offset); | ||
} | ||
console.log('Done deleting case correspondences from Dynamo'); | ||
} | ||
|
||
main().catch(console.error); |
62 changes: 62 additions & 0 deletions
62
scripts/run-once-scripts/postgres-migration/delete-case-deadlines.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* HOW TO RUN | ||
* | ||
* TABLE_NAME=testing npx ts-node --transpileOnly scripts/postgres/delete-case-deadlines.ts | ||
*/ | ||
|
||
import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb'; | ||
import { DynamoDBClient } from '@aws-sdk/client-dynamodb'; | ||
import { requireEnvVars } from '../../../shared/admin-tools/util'; | ||
import { getDbReader } from '../../../web-api/src/database'; | ||
import { isEmpty } from 'lodash'; | ||
import { batchDeleteDynamoItems } from './batch-delete-dynamo-items'; | ||
|
||
const caseDeadlinePageSize = 10000; | ||
const dynamoDbClient = new DynamoDBClient({ region: 'us-east-1' }); | ||
const dynamoDbDocClient = DynamoDBDocumentClient.from(dynamoDbClient); | ||
|
||
requireEnvVars(['TABLE_NAME']); | ||
|
||
const tableNameInput = process.env.TABLE_NAME!; | ||
|
||
const getCaseDeadlinesToDelete = async (offset: number) => { | ||
const caseDeadlines = await getDbReader(reader => | ||
reader | ||
.selectFrom('dwCaseDeadline') | ||
.select(['docketNumber', 'caseDeadlineId']) | ||
.orderBy('caseDeadlineId') | ||
.limit(caseDeadlinePageSize) | ||
.offset(offset) | ||
.execute(), | ||
); | ||
return caseDeadlines; | ||
}; | ||
|
||
let totalItemsDeleted = 0; | ||
|
||
async function main() { | ||
let offset = 0; | ||
let caseDeadlinesToDelete = await getCaseDeadlinesToDelete(offset); | ||
|
||
while (!isEmpty(caseDeadlinesToDelete)) { | ||
const dynamoItemsToDelete = caseDeadlinesToDelete.map(cd => ({ | ||
DeleteRequest: { | ||
Key: { | ||
pk: `case|${cd.docketNumber}`, | ||
sk: `case-deadline|${cd.caseDeadlineId}`, | ||
}, | ||
}, | ||
})); | ||
totalItemsDeleted += await batchDeleteDynamoItems( | ||
dynamoItemsToDelete, | ||
dynamoDbDocClient, | ||
tableNameInput, | ||
); | ||
console.log(`Total case deadlines deleted: ${totalItemsDeleted}`); | ||
offset += caseDeadlinePageSize; | ||
caseDeadlinesToDelete = await getCaseDeadlinesToDelete(offset); | ||
} | ||
console.log('Done deleting case deadlines from Dynamo'); | ||
} | ||
|
||
main().catch(console.error); |
62 changes: 62 additions & 0 deletions
62
scripts/run-once-scripts/postgres-migration/delete-case-worksheets.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* HOW TO RUN | ||
* | ||
* TABLE_NAME=testing npx ts-node --transpileOnly scripts/postgres/delete-case-worksheets.ts | ||
*/ | ||
|
||
import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb'; | ||
import { DynamoDBClient } from '@aws-sdk/client-dynamodb'; | ||
import { requireEnvVars } from '../../../shared/admin-tools/util'; | ||
import { getDbReader } from '../../../web-api/src/database'; | ||
import { isEmpty } from 'lodash'; | ||
import { batchDeleteDynamoItems } from './batch-delete-dynamo-items'; | ||
|
||
const caseWorksheetPageSize = 10000; | ||
const dynamoDbClient = new DynamoDBClient({ region: 'us-east-1' }); | ||
const dynamoDbDocClient = DynamoDBDocumentClient.from(dynamoDbClient); | ||
|
||
requireEnvVars(['TABLE_NAME']); | ||
|
||
const tableNameInput = process.env.TABLE_NAME!; | ||
|
||
const getCaseWorksheetsToDelete = async (offset: number) => { | ||
const caseWorksheets = await getDbReader(reader => | ||
reader | ||
.selectFrom('dwCaseWorksheet') | ||
.select(['docketNumber']) | ||
.orderBy('docketNumber') | ||
.limit(caseWorksheetPageSize) | ||
.offset(offset) | ||
.execute(), | ||
); | ||
return caseWorksheets; | ||
}; | ||
|
||
let totalItemsDeleted = 0; | ||
|
||
async function main() { | ||
let offset = 0; | ||
let caseWorksheetsToDelete = await getCaseWorksheetsToDelete(offset); | ||
|
||
while (!isEmpty(caseWorksheetsToDelete)) { | ||
const dynamoItemsToDelete = caseWorksheetsToDelete.map(cd => ({ | ||
DeleteRequest: { | ||
Key: { | ||
pk: `case|${cd.docketNumber}`, | ||
sk: `case-worksheet|${cd.docketNumber}`, | ||
}, | ||
}, | ||
})); | ||
totalItemsDeleted += await batchDeleteDynamoItems( | ||
dynamoItemsToDelete, | ||
dynamoDbDocClient, | ||
tableNameInput, | ||
); | ||
console.log(`Total case worksheets deleted: ${totalItemsDeleted}`); | ||
offset += caseWorksheetPageSize; | ||
caseWorksheetsToDelete = await getCaseWorksheetsToDelete(offset); | ||
} | ||
console.log('Done deleting case worksheets from Dynamo'); | ||
} | ||
|
||
main().catch(console.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just the script that was used for
delete-messages.ts
. I moved it here so it could be reusable.