Skip to content

🧪 Add error path test for pdf_extract::extract_text#47

Open
badMade wants to merge 1 commit into
mainfrom
jules-pdf-extract-error-test-2389079918942033131
Open

🧪 Add error path test for pdf_extract::extract_text#47
badMade wants to merge 1 commit into
mainfrom
jules-pdf-extract-error-test-2389079918942033131

Conversation

@badMade
Copy link
Copy Markdown
Owner

@badMade badMade commented Apr 24, 2026

🎯 What: The extract_text function handles filesystem reads but lacked test coverage for when the file is missing or inaccessible.
📊 Coverage: Adds the extract_text_returns_error_for_missing_file test to cover the error path natively.
Result: Enhanced test coverage providing better confidence against regressions when modifying file loading logic.


PR created automatically by Jules for task 2389079918942033131 started by @badMade

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings April 24, 2026 03:45
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a regression test to cover the filesystem error path of pdf_extract::extract_text when the target PDF file cannot be read (e.g., missing file).

Changes:

  • Add extract_text_returns_error_for_missing_file unit test validating that extract_text returns an error for an unreadable/missing path.
  • Assert the returned error string includes the expected "failed to read PDF:" prefix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +552 to +555
let path = Path::new("/path/that/does/not/exist.pdf");

// when
let result = extract_text(path);
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

This test hard-codes an absolute Unix-style path ("/path/that/does/not/exist.pdf"), which can be non-portable and potentially flaky (e.g., different path semantics on Windows, or the path unexpectedly existing in some environments). Prefer constructing a definitely-nonexistent path under std::env::temp_dir() (and ensure the file does not exist) so the failure mode is consistent across platforms.

Suggested change
let path = Path::new("/path/that/does/not/exist.pdf");
// when
let result = extract_text(path);
let path = std::env::temp_dir().join(format!(
"clawd-missing-{}-{}.pdf",
std::process::id(),
"extract-text-test"
));
let _ = std::fs::remove_file(&path);
// when
let result = extract_text(&path);

Copilot uses AI. Check for mistakes.
@badMade badMade marked this pull request as ready for review April 26, 2026 21:38
@badMade
Copy link
Copy Markdown
Owner Author

badMade commented Apr 27, 2026

@claude code review

@badMade
Copy link
Copy Markdown
Owner Author

badMade commented Apr 27, 2026

@codex code review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@badMade
Copy link
Copy Markdown
Owner Author

badMade commented Apr 30, 2026

@gemini-code-assist, what are the steps and line numbers to make this fix?

@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@badMade
Copy link
Copy Markdown
Owner Author

badMade commented Apr 30, 2026

@copilot, make changes based on:

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub
[Your team has set up Codex to review pull requests in this repo](...

See: #47 (comment)

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.

2 participants