Repository navigation
Conversation
Fix tools/validate-refs.py cache filtering so that URLs returning valid HTTP status codes (200, 202, 204, 301, 302, 303, 307, 308) or domain hosts in ALLOW_UNREACHABLE are correctly recognized as cached. This reduces validate-refs.py execution time from ~27.6s to ~0.35s when .ref-cache.json is populated, eliminating 50 redundant outbound HTTP network calls on every local check and CI run. Also add unit tests in tools/validate-refs-test.py and integrate into Makefile test target. Co-authored-by: mjmirza <34001140+mjmirza@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Closing: fails the required PR security check. Branch kept for recovery; reopen after the security check is addressed (or apply the security-reviewed label if the tools/ change is confirmed benign). |
Understood. Acknowledging that changes to tools/ trigger the security check gate requiring the security-reviewed label. |
Problem Reproduction
Running
python3 tools/validate-refs.py --stricttook ~27.6s on every execution despite.ref-cache.jsonbeing present and checked in. The script made 50 outbound HTTP requests every run for URLs with non-200/301/302 statuses or hosts listed inALLOW_UNREACHABLE(such asdl.acm.orgorwww.oreilly.comwhich block HEAD requests).Root Cause
tools/validate-refs.pypreviously checked cache hit eligibility usingstr(cache.get(u)) in {"200", "301", "302"}.This ignored:
validate-refs.pyconsiders valid.ALLOW_UNREACHABLEwhose non-success response statuses (e.g. 403) are expected and cached in.ref-cache.json.Solution
VALID_STATUSESandis_cached(u, cache)intools/validate-refs.pyto check if a URL is cached either via a valid HTTP status or anALLOW_UNREACHABLEhost.tools/validate-refs-test.pycovering URL cleaning, fence stripping, cache verification, and probing retries.python3 tools/validate-refs-test.pytoMakefileunder thetest:target.Before / After Measurement
PR created automatically by Jules for task 7824429893525823169 started by @mjmirza