interaction-skills: verifying speculation-rules prerender under CDP#485
interaction-skills: verifying speculation-rules prerender under CDP#485clawdloblaw wants to merge 1 commit into
Conversation
Chrome disables prerendering while a debugger is attached (PrerenderingDisabledByDevTools), so activation can never be observed from the harness. Document the Preload-domain recipe to verify rules registered instead, and when a failure reason is real. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017J8nADRf3KW9G9A1QTdAh8
✅ Skill review passedReviewed 1 file(s) — no findings. |
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="interaction-skills/prerendering.md">
<violation number="1" location="interaction-skills/prerendering.md:24">
P2: The documentation states that `Preload.ruleSetUpdated` firing means the `<script type=speculationrules>` "parsed correctly," but the CDP `RuleSet` object in that event includes optional `errorType`/`errorMessage` fields that are populated on parse or validation failures. The event fires even when the rule set is malformed (e.g. `SourceIsNotJsonObject`, `InvalidRulesSkipped`). Relying solely on the event's presence can lead to false confidence that rules are valid. Consider adding a note to inspect `e["params"]["ruleSet"].get("errorType")` and clarifying that the event firing indicates the rule set was *registered*, not necessarily that it parsed without errors.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
| print(p["key"]["url"], p.get("status"), p.get("prerenderStatus")) | ||
| ``` | ||
|
|
||
| - `Preload.ruleSetUpdated` fires → the `<script type=speculationrules>` parsed correctly. |
There was a problem hiding this comment.
P2: The documentation states that Preload.ruleSetUpdated firing means the <script type=speculationrules> "parsed correctly," but the CDP RuleSet object in that event includes optional errorType/errorMessage fields that are populated on parse or validation failures. The event fires even when the rule set is malformed (e.g. SourceIsNotJsonObject, InvalidRulesSkipped). Relying solely on the event's presence can lead to false confidence that rules are valid. Consider adding a note to inspect e["params"]["ruleSet"].get("errorType") and clarifying that the event firing indicates the rule set was registered, not necessarily that it parsed without errors.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At interaction-skills/prerendering.md, line 24:
<comment>The documentation states that `Preload.ruleSetUpdated` firing means the `<script type=speculationrules>` "parsed correctly," but the CDP `RuleSet` object in that event includes optional `errorType`/`errorMessage` fields that are populated on parse or validation failures. The event fires even when the rule set is malformed (e.g. `SourceIsNotJsonObject`, `InvalidRulesSkipped`). Relying solely on the event's presence can lead to false confidence that rules are valid. Consider adding a note to inspect `e["params"]["ruleSet"].get("errorType")` and clarifying that the event firing indicates the rule set was *registered*, not necessarily that it parsed without errors.</comment>
<file context>
@@ -0,0 +1,32 @@
+ print(p["key"]["url"], p.get("status"), p.get("prerenderStatus"))
+```
+
+- `Preload.ruleSetUpdated` fires → the `<script type=speculationrules>` parsed correctly.
+- `Preload.prerenderStatusUpdated` with your target URLs → Chrome accepted the candidates.
+- Status `Failure` + `PrerenderingDisabledByDevTools` → rules are fine; they will prerender
</file context>
Field-tested: speculation-rules prerendering can never be observed activating while the harness (any CDP debugger) is attached — Chrome reports
PrerenderingDisabledByDevToolsfor every candidate andactivationStartstays 0. Easy to misread as broken rules on the page.This skill documents the observer effect and the
PreloadCDP domain recipe (Preload.enable+drain_events()) to verify that rules parsed and candidates registered, plus which failure reasons are real vs. harness-induced.🤖 Generated with Claude Code
Summary by cubic
Adds a concise guide to verify speculation‑rules prefetch/prerender under CDP. Explains that DevTools disables prerendering and shows how to validate rules via the
Preloaddomain instead.interaction-skills/prerendering.mdwith steps to usePreload.enableand drain CDP events to confirm rule parsing and candidate registration.Preload.ruleSetUpdated/Preload.prerenderStatusUpdated, and thatPrerenderingDisabledByDevToolsis harness-induced, not a site bug.Written for commit ee40411. Summary will update on new commits.