Skip to content

fix(checkin): parse Cloudflare analytics failures at the boundary - #706

Merged
harlan-zw merged 1 commit into
mainfrom
fix/checkin-cloudflare-failures
Nov 18, 2026
Merged

harlan-zw merged 1 commit into
mainfrom
fix/checkin-cloudflare-failures

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Follow-up to the logged findings on #704. No GitHub issue.

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

The check-in's Cloudflare collectors hid why a read failed:

  • The Workers collector parsed JSON before it checked the status, so an HTML error page surfaced as a JSON.parse error without the status.
  • A 200 response whose GraphQL errors carried no message passed as data.
  • The Analytics Engine collector reported only the status and dropped the API's message.

Each response is now parsed once into its rows or a failure reason (parseWorkersResponse, parseAnalyticsEngineResponse). The reason keeps the status and the API's message, capped at 300 characters. The skilld.operations prompt also says to compute Worker rates over workers.window when it is clamped, never over gapHours.

🤖 AI disclosure: Harlan Agent Kit modified this description. My AI open-source policy.

The Workers collector parsed JSON before it checked the status, so a
proxy error page lost the status. It passed a 200 response whose errors
carried no message. The Analytics Engine collector dropped the API's
message. Each response is now parsed once into rows or a bounded reason.

The operations prompt also says Worker rates use the Workers window,
which can be shorter than the baseline gap.
@harlan-zw

Copy link
Copy Markdown
Collaborator Author

Agent check (Harlan Agent Kit), run by hand because CI cannot reach Cloudflare:

  • A live collector run on this head with --since 2026-10-11T00:30:48.064Z read both APIs through the new parsers. skilld.analytics passed with 270 command copies. skilld.workers warned with a clamped window and its outcomes.

@harlan-zw

Copy link
Copy Markdown
Collaborator Author

🤖 Harlan Agent Kit Agent assessment of head 1a47935.

The Service Review was stopped for this head because the review engine is down. An independent read-only subagent reviewed the diff. This is not a Service READY.

No blocker found (confidence 95/100). Logged follow-ups, none above 80:

  • Impact 20: the Analytics Engine parser copies any non-2xx body into the reason, so a 401 JSON envelope or a 502 HTML page shows raw. The Workers parser drops HTML. Take errors[].message from JSON and drop HTML.
  • Impact 10: no test covers errors: null with data, which is likely Cloudflare's success shape.
  • Impact 5: the 300-character cut can split an emoji.
  • Impact 5: readBoundedResponseText throws on a body over 2 MiB before the parser sees the status. This predates the PR.

@harlan-zw
harlan-zw merged commit 0bd3210 into main Nov 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant