A Measurement That Never Ran Became a Verdict: A Second Automated Chrome Answered for the First
说明与用途
一个无人值守的脚本在检查站点地图可访问性和SEO‑hub索引时,将读取失败误认为零,导致错误的决策。现在脚本先计数Chrome实例,若多于一个则中止;并在判定逻辑中将读取失败视为“无法判断”,而非零。
问题
An unattended script that checks sitemap accessibility and SEO‑hub indexing failed silently because it used two different scripting bridges that could target different Chrome instances, causing read failures to be treated as zero and leading to incorrect verdicts.
结果
The script now correctly detects when multiple Chrome instances exist and prevents false positives/negatives by treating read failures as unknown rather than zero, ensuring accurate monitoring decisions.
工作流
- 1. Count running Chrome application instances, filtering out helper and renderer processes.
- 2. If more than one instance, write a precondition‑failed section, run only non‑browser checks, and exit with status 2.
- 3. If one instance, open a tab using AppleScript and read it back using JXA.
- 4. If any read fails (tab not found), record failure and skip verdict rules.
- 5. If all reads succeed, apply existing sitemap and seo‑hub rules to produce a verdict.
- 6. Write the report with verdict or failure status.
证据
The script opens a tab with one scripting bridge (AppleScript) and reads it back with a different one (JXA, Apple's JavaScript automation layer).
If it finds more than one, it writes what it found to a “precondition failed” section of the report, runs only the one check in the script that doesn’t touch a browser at all, and exits with a distinct status code — 2 — meaning “cannot judge, measurement not performed.”
The function that decides whether to keep going or issue one of its two halt recommendations now checks, before applying either rule, whether the sitemap read failed or every single URL check failed. If so, it refuses to apply the rule and reports “cannot judge, measurement failed” instead.
- 记录日期: 2026-09-19T11:15:37.645Z