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

updated synonymGroups table-stream with tests #2505

Merged

Conversation

Courey
Copy link
Contributor

@Courey Courey commented Jul 31, 2024

Description

This change is to modify the synonymGroups table-stream to match the format we decided at our in person team meeting. It includes full test coverage.

Related Issue(s)

Resolves #2504

Testing

Table-streams are not able to run locally because the architect sandbox uses dynalite which does not support table-streams. So this has not been run. However, there are 3 tests to cover each of the three actions possible, MODIFY, INSERT, and REMOVE.

I would appreciate someone with dev access helping me test this on the dev server to ensure that it works properly.

@Courey Courey requested a review from lpsinger July 31, 2024 21:18
Copy link

codecov bot commented Jul 31, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 6.13%. Comparing base (cfd0c49) to head (bb5d779).
Report is 21 commits behind head on main.

Files Patch % Lines
app/table-streams/synonyms/index.ts 90.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #2505      +/-   ##
========================================
+ Coverage   5.26%   6.13%   +0.86%     
========================================
  Files        158     164       +6     
  Lines       3912    4042     +130     
  Branches     419     440      +21     
========================================
+ Hits         206     248      +42     
- Misses      3705    3792      +87     
- Partials       1       2       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Courey Courey force-pushed the courey/update_synonymGroups_table-stream branch from 2afb096 to dda7f95 Compare August 1, 2024 14:01
Copy link
Member

@lpsinger lpsinger left a comment

Choose a reason for hiding this comment

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

I think that there are some logical errors here. For example, your handler for removal of a DynamoDB record deletes the item in the OpenSearch index. However, it ought to update the item in OpenSearch with the remaining event names that still correspond to the same UUID.

app/table-streams/synonyms/index.ts Outdated Show resolved Hide resolved
app/table-streams/synonyms/index.ts Outdated Show resolved Hide resolved
app/routes/synonyms/synonyms.lib.ts Show resolved Hide resolved
app/routes/synonyms/synonyms.lib.ts Show resolved Hide resolved
@Courey Courey requested a review from lpsinger August 1, 2024 20:38
Copy link
Member

@lpsinger lpsinger left a comment

Choose a reason for hiding this comment

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

Would you please address the remaining outstanding comments from my first review?

@Courey Courey requested a review from lpsinger August 2, 2024 14:33
@Courey Courey force-pushed the courey/update_synonymGroups_table-stream branch from 1b45261 to 94beda4 Compare August 6, 2024 18:44
app/table-streams/synonyms/index.ts Outdated Show resolved Hide resolved
app/table-streams/synonyms/index.ts Outdated Show resolved Hide resolved
sandbox-search.js Outdated Show resolved Hide resolved
formatting

additional test

cleaning up

additional testing with adjustments

removed dynamodb calls and adjusted mocks

adds additional test for no duplicate eventId

adjusting logic so that nothing happens if there is no data to save instead of creating a new synonym group

cleaning up tests

bailing if somehow there is no data for the group

using dynamodb as source of truth again and updating tests
@Courey Courey force-pushed the courey/update_synonymGroups_table-stream branch from 94beda4 to bb7f969 Compare August 7, 2024 14:53
@Courey Courey requested a review from lpsinger August 7, 2024 14:53
app/table-streams/synonyms/index.ts Outdated Show resolved Hide resolved
app/table-streams/synonyms/index.ts Outdated Show resolved Hide resolved
app/table-streams/synonyms/index.ts Outdated Show resolved Hide resolved
@Courey Courey requested a review from lpsinger August 8, 2024 15:54
@@ -11,13 +11,23 @@ export default async function () {
const text = await readFile('sandbox-seed.json', { encoding: 'utf-8' })
const { circulars, synonyms } = JSON.parse(text)

const groupedSynonyms = synonyms.reduce((accumulator, synonym) => {
Copy link
Member

Choose a reason for hiding this comment

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

I was thinking something more along the lines of https://lodash.com/docs/#groupBy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is there a reason or is it just preference?

Copy link
Member

Choose a reason for hiding this comment

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

It's terser and it's more obvious what the code does. I think it is more idiomatic. I would have suggested Object.groupBy, but it is a relatively recent addition to ECMAScript and requires a newer version of Node.js than we are targeting.

sandbox-search.js Outdated Show resolved Hide resolved
sandbox-search.js Outdated Show resolved Hide resolved
sandbox-search.js Show resolved Hide resolved
@Courey Courey requested a review from lpsinger August 12, 2024 13:30
@lpsinger lpsinger merged commit d38fcda into nasa-gcn:main Aug 12, 2024
10 checks passed
Vidushi-GitHub pushed a commit to Vidushi-GitHub/gcn.nasa.gov that referenced this pull request Oct 13, 2024
Vidushi-GitHub pushed a commit to Vidushi-GitHub/gcn.nasa.gov that referenced this pull request Oct 13, 2024
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.

Update table-stream for new synonymGroups
2 participants