Skip to content

Use miniflare's handleStructuredLogs option instead of handleRuntimeStdio for processing workerd output#13131

Merged
dario-piotrowicz merged 1 commit intomainfrom
dario/DEVX-2250/vitest-structured-logs
Mar 31, 2026
Merged

Use miniflare's handleStructuredLogs option instead of handleRuntimeStdio for processing workerd output#13131
dario-piotrowicz merged 1 commit intomainfrom
dario/DEVX-2250/vitest-structured-logs

Conversation

@dario-piotrowicz
Copy link
Copy Markdown
Member

@dario-piotrowicz dario-piotrowicz commented Mar 30, 2026

Fixes https://jira.cfdata.org/browse/DEVX-2250

Note

Disclaimer, this change doesn't make much of a difference, the only benefit here is consistency with Wrangler and the Vite plugin, as well as maybe potential benefits down the line (such as for example if we wanted to start using a logger in vitest-pool-workers)

I just had this old Jira ticket for it so to clean it up I just asked Claude to implement this and then simply reviewed and tested the changes (most of the changes here as made by Claude).


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: mostly internal change

A picture of a cute animal (not mandatory, but encouraged)


Open with Devin

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 30, 2026

🦋 Changeset detected

Latest commit: 3a1d99d

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

✅ All changesets look good

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 30, 2026

After thorough review, here's my assessment:

  1. The core change is clean: switching from handleRuntimeStdio (raw stream processing) to handleStructuredLogs (structured JSON log processing). This is correct and aligns with how wrangler and vite-plugin-cloudflare already work.

  2. The symbolizerWarning constant is now dead code in the sense that miniflare's wrapStructuredLogsHandler already filters it via isInternal(). However, having it in ignoreMessages is purely redundant (not buggy) — it's a defense-in-depth measure. Not worth flagging.

  3. The unused import type { Readable } from "node:stream" was correctly removed.

  4. The WorkerdStructuredLog type is correctly imported from miniflare.

  5. The handleStructuredLogs function properly routes error/warn to stderr and everything else to stdout, with the ignoreMessages filter applied first.

  6. The test correctly uses __console (the original workerd console saved before Vitest patches it) to verify that output routing works end-to-end.

  7. The changeset is appropriate — patch for a bug fix/internal improvement.

  8. The formatting changes are just oxfmt reformatting — not worth flagging per review rules.

No logic bugs, no security issues, no backward compatibility concerns, no incorrect API behavior.

LGTM

github run

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 30, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13131

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13131

miniflare

npm i https://pkg.pr.new/miniflare@13131

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13131

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13131

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13131

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13131

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13131

wrangler

npm i https://pkg.pr.new/wrangler@13131

commit: 3a1d99d

@dario-piotrowicz dario-piotrowicz marked this pull request as ready for review March 30, 2026 22:14
@dario-piotrowicz dario-piotrowicz requested a review from a team as a code owner March 30, 2026 22:14
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Mar 30, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Mar 31, 2026
@dario-piotrowicz dario-piotrowicz merged commit 65acf66 into main Mar 31, 2026
52 of 57 checks passed
@dario-piotrowicz dario-piotrowicz deleted the dario/DEVX-2250/vitest-structured-logs branch March 31, 2026 21:02
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants