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

feat(appellate): Adds guarding logic for missing pacer_doc_id #412

Merged
merged 5 commits into from
Jan 27, 2025

Conversation

ERosendo
Copy link
Contributor

@ERosendo ERosendo commented Jan 21, 2025

This PR adds a check to ensure that the pacer_doc_id is available before attempting to retrieve the PDF. If the pacer_doc_id is missing, the code will exit early to prevent unintended modifications to the page and incorrect GET requests.
Screen Recording 2025-01-21 at 8 59 35 PM

This PR also updates the karma.config.js file to fix some failing tests

Fixes freelawproject/recap#388

This commit adds a check to ensure that the pacer_doc_id is available before attempting to retrieve the PDF.
If the pacer_doc_id is missing, the code will exit early to prevent unnecessary page modifications.
@ERosendo ERosendo added the no changelog Override Check Changelog Action. label Jan 21, 2025
@ERosendo ERosendo force-pushed the 388-feat-add-fallback-for-doc-id branch from 87ee8ad to f768729 Compare January 22, 2025 00:09
@ERosendo ERosendo force-pushed the 388-feat-add-fallback-for-doc-id branch from f768729 to a5bde97 Compare January 22, 2025 00:16
@ERosendo ERosendo marked this pull request as ready for review January 22, 2025 01:06
@ERosendo ERosendo removed the no changelog Override Check Changelog Action. label Jan 22, 2025
@ERosendo ERosendo requested a review from mlissner January 22, 2025 01:06
Copy link
Member

@mlissner mlissner left a comment

Choose a reason for hiding this comment

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

Seems simple enough, and LGTM. Let's see what Elisa thinks!

@mlissner mlissner requested a review from elisa-a-v January 22, 2025 01:41
@mlissner mlissner assigned elisa-a-v and unassigned mlissner Jan 22, 2025
Copy link
Contributor

@elisa-a-v elisa-a-v left a comment

Choose a reason for hiding this comment

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

When following the steps described here to get docs from this docket, I got this page:
image

and the doc button brought me here:
image

I then selected the second attachment and the URL didn't include the doc ID (https://ecf.ca4.uscourts.gov/docs1/004110098892?caseId=null&recapAttNum=2), but the GET request did include it in the query params so that works!

Sadly, I noticed despite getting a 200 status response, the results list was empty, even though we have the docket, the docket entry and the RECAPDocument for that attachment (as seen in CL). Well, upon closer inspection I realized this part is actually fine, since we don't have the PDF for that RECAPDocument.

image
image

I then bought the document and could see it in the browser, but the POST request failed with a 400 status, because there was no pacer_doc_id in the payload:
image

I did not try to reproduce the issue with the live extension so as not to add to the DB issue 😅 so I'm not entirely sure this is a consequence of this PR or not, what do you think @ERosendo ?

@mlissner mlissner assigned ERosendo and unassigned elisa-a-v Jan 23, 2025
@ERosendo
Copy link
Contributor Author

Hey @elisa-a-v Thanks for your feedback! You have a great eye for catching cases that can break the code.

Your detailed report helped me identify an issue where the extension was incorrectly adding caseId=null to the attachment URLs.

Commit a538050 resolves this. I've tested the extension with the specific case you mentioned in your comment, and it successfully retrieved the document as expected.

Screen Recording 2025-01-24 at 12 20 16 PM

@ERosendo ERosendo requested a review from elisa-a-v January 24, 2025 16:40
@ERosendo
Copy link
Contributor Author

I also believe adding support for this new page in the future would be beneficial. However, it falls outside the scope of this current PR, which is focused on fixing the GET request triggering the db performance issue.

@ERosendo ERosendo assigned elisa-a-v and unassigned ERosendo Jan 24, 2025
@elisa-a-v
Copy link
Contributor

Following the same steps as before and with the same docket, I could actually RECAP the doc successfully when clicking the doc icon in the attachment page:
image
This was the payload sent in the POST request after buying the doc:
Screenshot from 2025-01-27 15-43-05

But when I viewed the document by unselecting the other attachment and clicking "View Selected", I got a 400 status error response for the POST request.
image

Screenshot from 2025-01-27 15-43-08

So the issue actually persists, but only for this specific flow.

It seems to me like this might be related to these changes?

@elisa-a-v elisa-a-v assigned ERosendo and unassigned elisa-a-v Jan 27, 2025
@ERosendo
Copy link
Contributor Author

@elisa-a-v Thanks for the steps you outlined in your most recent comment! I followed them, but it seems we don't have enough data to upload the file on the document purchase page.

To address this, I made a small adjustment to the logic we introduced in #402. This change will make the extension return early in cases where the document ID can be retrieved. This way, we avoid adding unnecessary buttons or elements that might confuse users into thinking the extension is trying to upload the document.

I reviewed the GET requests and confirmed that the extension correctly sends the doc_id and avoids triggering the same problematic database query.

I think the problem with the combined PDF page should be included in issue #389 (freelawproject/recap#389), which aims to add support for the Orders/Judgments section.

@ERosendo ERosendo assigned elisa-a-v and unassigned ERosendo Jan 27, 2025
Copy link
Contributor

@elisa-a-v elisa-a-v left a comment

Choose a reason for hiding this comment

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

Nice, I think the early return is the right call here.

I say we should merge this and dig deeper into the other stuff whenever we get to freelawproject/recap#389

@elisa-a-v elisa-a-v merged commit 5a76859 into main Jan 27, 2025
8 checks passed
@elisa-a-v elisa-a-v deleted the 388-feat-add-fallback-for-doc-id branch January 27, 2025 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Extension is not adding the pacer_doc_id filter to GET request
3 participants