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

HackParser integration #413

Merged
merged 25 commits into from
Oct 21, 2024
Merged

HackParser integration #413

merged 25 commits into from
Oct 21, 2024

Conversation

jsmilliken
Copy link
Contributor

Integrate with the HackParser service.

The three functional changes are:

  • Allow users to upload a PDF during the request form
  • When a request form is submitted:
    • Download the uploaded PDF
    • Upload the PDF to the HackParser S3 bucket
    • Store the name of the PDF as an additional column when finished
  • When the user accepts a review:
    • Respond with presigned URLs to the original PDF & code extracted by HackParser

Each of these functional points have been made fail-proof, so if the HackParser service causes any errors, they will be logged, but not result in a crash of Hacker Rank Queue.


The actual HackParser integration is controlled by via the HACK_PARSER_BUCKET_NAME, when provided it's the name of the bucket. When not provided, the integration is fully disabled - not even allowing users to upload PDFs, and fully disabling the relevant code branches.


This PR enables the HackParser integration in dev only - there will be another PR in the future to enable it in prod when HackParser is ready.


Aside from the integration changes, the style of requestReview.test.ts was changed to call the callback for each test within the test block compared to the previous approach of within the beforeEach.

This change was made as the input to the callback was no longer the same for every test - in order to test if a review does not upload a PDF, etc - resulting in some new tests having to call the callback twice and make abnormal asserts.

@jsmilliken jsmilliken marked this pull request as ready for review October 9, 2024 23:28
jest.config.js Show resolved Hide resolved
src/services/HackParserService.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@kylehoehns kylehoehns left a comment

Choose a reason for hiding this comment

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

🚀

charlie-map and others added 19 commits October 18, 2024 03:29
Temporarily disable test coverage threshold
Re-enable testing threshold
Remove uncessary node-fetch
Add logging of errors to console.
Add error handling to HackParser integration
Fix edge case around code results block being added when there are just plain results
Add remaining tests
Revert getReviewByThreadId addition
Improve cleanup of environment variable changes during testing
Normalize style of requestReview test to reduce uncessary duplicate executions
Add assertion helper to acceptRequestReview
Remove duplicagte test from acceptRequestReview
@jsmilliken jsmilliken force-pushed the feature/s3-signed-clean-code-urls branch from d8241ef to e27b100 Compare October 18, 2024 08:33
@jsmilliken jsmilliken merged commit 2b318eb into main Oct 21, 2024
2 checks passed
@jsmilliken jsmilliken deleted the feature/s3-signed-clean-code-urls branch October 21, 2024 18:24
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