Repository navigation
fix(browser): classify page script errors before keyword matches - #160
Conversation
An evaluation error's text comes from the page, so a script that throws "TimeoutError" or quotes the allowed-domains refusal was classified as a retryable timeout or a policy block. Check the evaluation-error prefix right after the stale-ref prefixes, before any substring match.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): fix(browser): classify page script errors before keyword matches. Tiny Sweeper completed its review; deterministic results follow. Review snapshot
Completeness: Complete Features
TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
Summary
reply::classifymaps an engine error message to the error a caller acts on, and it ran its substring checks ("timeout", "is not in the allowed domains list", "not visible", …) before theEvaluation errorprefix check. An evaluation error carries text the page controls, so a page script that throwsTimeoutError: slowcame back as a retryableTimeout, and one whose message quotes the allowed-domains refusal came back asBlockedByPolicy. The page could steer the caller's recovery path.Fix: move the
starts_with("evaluation error")check to right after the two stale-ref prefix checks, before any substring match. This is a reorder only; no message the engine produces itself changes class.Related issue
None.
API or behavior changes
No API change. A page script error now always classifies as
PageError, never asTimeout,BlockedByPolicy,NoSuchElement,BrowserUnavailableorInvalidInput.Validation
Commands actually run, with their outcome:
cargo fmt --all -- --check: rustfmt run on the touched files only; CI runs the full checkcargo clippy --all-targets --all-features -- -D warnings: left to CIcargo build --all-targets --all-features: left to CIcargo test --all-features: only the reply tests were run locally (below); CI runs the suiteCARGO_INCREMENTAL=0 cargo test -p tinycomputer-browser --lib -- page_script_error_text_cannot_change engine_messages_mapFAILED. 1 passed; 1 failed, withEvaluation error: TimeoutError: slow became Timeout { … }.-- reply::):ok. 5 passed; 0 failed.Tests
New
reply_tests::page_script_error_text_cannot_change_the_error_class: fiveEvaluation error: …messages whose page text matches the timeout, domain-refusal, missing-element, browser-unavailable and invalid-input keywords all classify asPageError. The existing message table is unchanged and still passes.Documentation
Not needed; a comment at the check says why it comes first.
Checklist
#[allow(...)],#[ignore], or relaxed lints.envcontents in the diff or the description