Skip to content

test(cli): Cover the json-transform-uses-fields lint rule - #1816

Merged
BYK merged 2 commits into
mainfrom
fix/cli-json-transform-fields
Nov 2, 2026
Merged

BYK merged 2 commits into
mainfrom
fix/cli-json-transform-fields

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1808.

This PR started as the standalone #1808 fix: the 12 jsonTransforms that ignored --fields, plus the sentry-cli/json-transform-uses-fields lint rule. #1783 has since merged with that same fix, so after merging main the only change left is RuleTester coverage for the rule in scripts/cli-lint-rules.test.mjs.

The valid cases are inline, same-module, default-parameter and imported transforms that read fields. The invalid cases are transforms that drop fields, name it but never use it, or are same-module/jsonTransform* functions with one parameter.

--

View Session in Sentry

A jsonTransform replaces the default JSON path, including --fields
filtering, so a transform that never read its fields argument made
--fields a silent no-op. Fix the 12 commands that did:

- alert issues/metrics create and edit: drop the identity transform so
  the default path filters.
- alert issues/metrics delete, alert issues view, auth list, dashboard
  widget delete, issue merge, issue resolve, project delete: filter what
  the transform returns with the new filterFieldsIfSet helper.

Guard against new cases with the sentry-cli/json-transform-uses-fields
lint rule: an inline or same-module jsonTransform, or any top-level
jsonTransform* function, must read its second parameter.

Fixes #1808

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

vercel Bot commented Nov 2, 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 2, 2026 11:24pm UTC

Request Review

@BYK
BYK enabled auto-merge (squash) November 2, 2026 23:19
…m-fields

# Conflicts:
#	packages/cli/src/commands/alert/issues/create.ts
#	packages/cli/src/commands/alert/issues/delete.ts
#	packages/cli/src/commands/alert/issues/edit.ts
#	packages/cli/src/commands/alert/metrics/create.ts
#	packages/cli/src/commands/alert/metrics/delete.ts
#	packages/cli/src/commands/alert/metrics/edit.ts
#	packages/cli/src/commands/auth/list.ts
#	packages/cli/src/commands/dashboard/widget/delete.ts
@sentry-junior sentry-junior Bot changed the title fix(cli): Apply --fields in every custom jsonTransform test(cli): Cover the json-transform-uses-fields lint rule Nov 2, 2026
@github-actions github-actions Bot added risk: low PR risk score: low and removed risk: medium PR risk score: medium labels Nov 2, 2026
@BYK
BYK merged commit 5f1ada1 into main Nov 2, 2026
36 of 37 checks passed
@BYK
BYK deleted the fix/cli-json-transform-fields branch November 2, 2026 23:36

This branch was successfully deployed

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

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant