Skip to content

fix(logger): Keep falsy causes and literal % in error messages - #1779

Merged
BYK merged 1 commit into
mainfrom
fix/logger-warden-followups
Nov 1, 2026
Merged

BYK merged 1 commit into
mainfrom
fix/logger-warden-followups

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

This fixes the Warden findings that were posted on #1773 after it merged.

  • Falsy causes: formatError showed a cause only when it was truthy, so new Error("x", { cause: 0 }) printed just x. It now shows the cause whenever the error has one (0, "", false, null, undefined), as util.inspect does.
  • An error as the first argument: formatMessage turned errors into strings before calling util.format, so an error passed first became the format string. logger.info(new Error("Failed for %s"), "extra") printed Failed for extra. The %s now stays literal and the remaining arguments are added after it, as console.log does.
  • Craft minVersion: raised from 2.33.0 to 3.5.0. The logger workspace uses {{workspaceName}} and {{packageSimpleName}}, and Craft only resolves those from 3.5.0 onward. The release workflow's getsentry/craft@v3 already installs 3.5.0. Warden said the placeholders are left unresolved, which is wrong for the release workflow, but an older local Craft would have left them as literal text without any error. This raises the minimum for every workspace in this repository.

Tests cover each falsy cause and an error message containing %s. For other output, the build is byte-identical to main across about 24,600 formatted records.

via @BYK.

--

View Session in Sentry

- Render an error's cause whenever the error has one, including `0`,
  `""`, `false`, `null`, and `undefined`, as `util.inspect` does.
  Only truthy causes were rendered.
- An error passed as the first argument is no longer read as a format
  string, so `%s` in its message stays literal instead of consuming the
  next argument, matching `console.log`.
- Require Craft 3.5.0, the first release that resolves the workspace
  placeholders the logger's release config uses. The release workflow
  already runs 3.5.0; older versions would leave them unresolved.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@vercel

vercel Bot commented Nov 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sentry-local Ready Ready Preview Nov 1, 2026 4:30pm UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 1, 2026
@BYK
BYK enabled auto-merge (squash) November 1, 2026 16:32
@BYK
BYK merged commit 02df892 into main Nov 1, 2026
36 checks passed
@BYK
BYK deleted the fix/logger-warden-followups branch November 1, 2026 16:45

This branch was successfully deployed

1 active deployment
Preview — 7d02e07a Deployed Nov 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant