Skip to content

fix: parse cron observability events (#440) - #458

Open
agent-think[bot] wants to merge 1 commit into
mainfrom
fix/issue-440-1787236208
Open

fix: parse cron observability events (#440)#458
agent-think[bot] wants to merge 1 commit into
mainfrom
fix/issue-440-1787236208

Conversation

@agent-think

@agent-think agent-think Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Requested by @mattzcarey

Closes #440

What was wrong

apps/workers-observability/src/types/workers-logs.types.ts required $workers.outcome for every telemetry event. The Workers Observability API legitimately omits that field (as well as the already-optional timing fields) for eventType: "cron", so the V4 response parser rejected the entire events response before query_worker_observability could return it.

There was no existing PR for #440, and main still contained the required field when this change was prepared.

What changed

  • make $workers.outcome optional, matching the upstream event shape while preserving validation when it is present
  • document cron rather than scheduled as an example $metadata.origin value
  • add a regression fixture that parses the full V4 response shape for a cron event with no outcome or timing fields
  • add a patch changeset for workers-observability

Testing

  • Confirmed the new regression test fails before the schema change with the reported expected string, received undefined error at $workers.outcome.
  • pnpm exec prettier --check apps/workers-observability/src/types/workers-logs.types.ts apps/workers-observability/src/workers-logs.types.spec.ts .changeset/fuzzy-jobs-observe.md — passed
  • pnpm --filter workers-observability check:lint — passed
  • pnpm --filter workers-observability check:types — passed
  • pnpm --filter workers-observability test — passed (2 files, 9 tests)
  • pnpm exec changeset status — passed

Demo

Demo URL (expires after 60 mins): https://issue-440-cron-observability-demo.palm-pepperberry.workers.dev

Open the page and press Parse cron event; it displays PASS and the parsed cron event even though outcome, cpuTimeMs, and wallTimeMs are absent. The demo runs the packed workers-observability schema from this branch (plus its packed workspace dependency).

🤖 generated by the pr-agent — please review carefully

@mattzcarey

Copy link
Copy Markdown
Collaborator

@agent-think did you check the open api spec

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.

query_worker_observability fails to parse cron-triggered Worker events ($workers.outcome is absent)

1 participant