High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix: scrape forwards the HTTP crawler's pre-render recommendations, so the report calls an enriched 2012-char page thin and advises enrichment it already did (PIN-205)
Luigi Agosti076f9b649866
diff --git a/internal/scrape/run.go b/internal/scrape/run.goindex 4764dbfb..d41193c7 100644--- a/internal/scrape/run.go+++ b/internal/scrape/run.go@@ -328,19 +328,22 @@ func fromSeaportalGroups(groups []seaportal.PageGroup) []PageGroup {// here rather than a silent divergence with nothing failing.const ThinContentChars = 160-// forwardableRecommendations are the upstream recommendations that survive the browser-// phase, matched on the stable noun in each.+// regeneratedRecommendations are the upstream recommendations this package rebuilds+// from the final pages, matched on the stable phrase in each — the errors/4xx line and+// the thin-content line.//// THE RULE, recorded where the choice is made, so the next upstream recommendation is// classified rather than guessed at: a recommendation derived from PAGE CONTENT must be// regenerated after enrichment, because the browser phase changes exactly that; one// derived from CRAWL SCOPE is forwarded, because the browser phase changes nothing about-// which URLs were sampled. Both sitemap lines are scope; the errors and thin-content-// lines are content, and both are regenerated below from the final pages.+// which URLs were sampled. Both sitemap lines are scope and forward by matching nothing+// here; the errors and thin-content lines are content, and both are regenerated below+// from the final pages.//// An unrecognised recommendation is FORWARDED, since dropping advice that is still true-// is the worse failure. Classify a new one here when it appears.-var forwardableRecommendations = []string{"sitemap"}+// is the worse failure — which is why this list names what is DROPPED, so a new upstream+// line takes the forwarding default until it is classified here.+var regeneratedRecommendations = []string{"extractable text", "returned errors"}// summarize rolls the FINAL pages up. Every field including the prose comes from this one// slice: the recommendations used to be carried in verbatim from the HTTP crawl, so the@@ -424,12 +427,12 @@ func contentChars(p Page) int {}func regeneratedLocally(rec string) bool {- for _, forwardable := range forwardableRecommendations {- if strings.Contains(rec, forwardable) {- return false+ for _, phrase := range regeneratedRecommendations {+ if strings.Contains(rec, phrase) {+ return true}}- return true+ return false}// clampConcurrency normalizes a requested concurrency into [1, MaxConcurrency].diff --git a/internal/scrape/run_test.go b/internal/scrape/run_test.goindex 49592a78..5ee17048 100644--- a/internal/scrape/run_test.go+++ b/internal/scrape/run_test.go@@ -713,3 +713,25 @@ func TestPreviewCountsWithheldBodiesByTheirRecordedLength(t *testing.T) {t.Errorf("preview counted withheld bodies as thin: %q", thinRec)}}++func TestAnUnrecognisedInheritedRecommendationIsForwardedNotDropped(t *testing.T) {+ unknown := "robots.txt disallows 3 of the discovered paths; consider --ignore-robots"+ crawl := crawlAdvising([]string{unknown},+ seaportal.PageObject{URL: "https://example.com/", Status: 200, Markdown: longMarkdown},+ )++ report, err := Run(context.Background(), Input{URL: "https://example.com"}, RunOptions{NoBrowser: true}, crawl, nil)+ if err != nil {+ t.Fatalf("Run: %v", err)+ }++ found := false+ for _, rec := range report.Summary.Recommendations {+ if rec == unknown {+ found = true+ }+ }+ if !found {+ t.Errorf("an inherited recommendation matching neither the regenerated phrases nor the sitemap lines was silently swallowed; the recorded rule says unrecognised advice FORWARDS, since dropping advice that is still true is the worse failure\n got %v", report.Summary.Recommendations)+ }+}