Skip to content

Refactor Crawler.processPage for better maintainability#41

Merged
saurabhsharma2u merged 2 commits into
mainfrom
refactor-crawler-process-page-15433885897905652798
Feb 25, 2026
Merged

Refactor Crawler.processPage for better maintainability#41
saurabhsharma2u merged 2 commits into
mainfrom
refactor-crawler-process-page-15433885897905652798

Conversation

@saurabhsharma2u

Copy link
Copy Markdown
Contributor

Refactored processPage method in plugins/core/src/crawler/crawler.ts into smaller helper methods (fetchPage, handleCachedResponse, handleRedirects, handleSuccessResponse) to reduce complexity and improve readability.

Note: The original task pointed to plugins/core/src/crawler/crawl.ts, but that file is now a facade for the Crawler class. The complexity described was found in Crawler.processPage within plugins/core/src/crawler/crawler.ts, so the refactoring was applied there.

Changes:

  • Extracted fetchPage for network requests.
  • Extracted handleCachedResponse for 304 logic.
  • Extracted handleRedirects for redirect chain processing.
  • Extracted handleSuccessResponse for 200 OK processing.
  • Improved type safety by using FetchResult and GraphNode types instead of any.
  • Preserved error handling by wrapping processPage logic in a try/catch block.

PR created automatically by Jules for task 15433885897905652798 started by @saurabhsharma2u

@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.

@saurabhsharma2u
saurabhsharma2u marked this pull request as ready for review February 25, 2026 18:19
@saurabhsharma2u
saurabhsharma2u merged commit 950aa7d into main Feb 25, 2026
6 checks passed
@saurabhsharma2u
saurabhsharma2u deleted the refactor-crawler-process-page-15433885897905652798 branch February 25, 2026 18:20
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.

1 participant