fix(fetch): filter SPA internal API from network candidates and add render wait - #107
Merged
Conversation
…ender wait Three fixes for adaptive-fetch returning backend API JSON instead of rendered SPA content (e.g. ChatGPT conversation pages): 1. Add isSpaInternalEndpoint() filter for /backend-api/*, /backend-anon/*, /_next/data/*, /api/auth/*, /api/v[0-9]+/* URL patterns 2. Penalise network_api candidates whose text is raw JSON (-30 score) 3. Replace fixed 300ms post-navigation wait with waitForSpaContent() that polls up to 3s when visible text is under 200 chars
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes adaptive-fetch returning backend API JSON instead of rendered page content on SPA URLs (e.g. ChatGPT conversation pages).
Problem
When fetching SPA URLs like ChatGPT conversations, agbrowse returned raw
/backend-api/settings/userJSON instead of the rendered conversation text. Three root causes:isAuthEndpoint()missed SPA-internal paths (/backend-api/*,/backend-anon/*)content-scorerscored large JSON blobs highly due to text lengthChanges
isSpaInternalEndpoint()filter for/backend-api/,/backend-anon/,/_next/data/,/api/auth/,/api/v[0-9]+/. AddedwaitForSpaContent()that polls up to 3s when visible text is under 200 chars.network_apicandidates whose text is valid JSON (raw API responses, not user content).Test Results
82 tests pass across 5 affected test files. gate:typecheck passes.
Closes #97