Skip to content

docs(cli): Reject sentry commands in fragment code blocks - #1639

Merged
BYK merged 1 commit into
mainfrom
byk/strict-fragment-command-check
Oct 23, 2026
Merged

BYK merged 1 commit into
mainfrom
byk/strict-fragment-command-check

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

check:fragments only failed on headings named "Examples", so example blocks under other headings slipped through, like ## Using Attribute Keys in #1559 (comment). This PR makes the check look at the code instead of the heading.

Now any shell code block (bash/sh/shell/console/zsh or unlabeled) in a command fragment that runs a sentry command fails check:fragments. That includes nested blocks, and commands after a $ prompt, VAR=value, |, or &&. To keep a real workflow, sample output, or cross-command guide, put an explicit opt-out marker on the line directly above the block:

<!-- allow-commands: multi-step CI release workflow -->

The reason is required. A marker without a reason, on a block with no commands, or not directly above a code block also fails, so markers can't go stale quietly. generate-command-docs strips the markers, so they don't end up in the docs site or the committed skill files.

Existing violations on main:

  • Moved to docs.examples: local --open, local -f ai, local --format json, local run --open, the agent-stream local run --format json, and the event view attachment download.
  • Dropped: log list --json | jq, sourcemap upload --allow-empty and local -f error -f log already existed as examples.
  • Rewritten as prose: the send-event alias note.
  • Marked:
    • release workflow
    • multi-account examples in auth.md
    • org list sample output
    • the global --json/--web sections in index.md
    • the multi-terminal fixture walkthrough in local.md
    • the daemon-session walkthrough in local.md

The subcommand-coverage hint used to say "add a heading or code example". It now points to docs.examples.

#1559's current attribute.md gets flagged by this check, so it will need to move its examples into attribute list's docs.examples once this lands.

via BYK.

--

View Junior Session in Sentry

check:fragments only flagged headings named "Examples", so example
blocks under topical headings (like "Using Attribute Keys" in #1559)
slipped through. Now any shell code block in a command fragment that
runs a `sentry` command fails the check unless it carries an explicit
`<!-- allow-commands: <reason> -->` marker on the line above. Markers
without a reason, or on blocks without commands, also fail, and
generate-command-docs strips markers so they don't reach the docs or
skill files.

Existing violations are moved to docs.examples (local, local run,
event view), dropped where an identical example already existed (log
list, sourcemap upload, local -f), rewritten as prose, or marked as
workflows or sample output.

The subcommand-coverage hint now points to docs.examples instead of
suggesting code examples in the fragment.

Co-Authored-By: BYK <burak.kaya@sentry.io>
@vercel

vercel Bot commented Oct 23, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Oct 23, 2026 9:29pm UTC

Request Review

@github-actions github-actions Bot added the risk: low PR risk score: low label Oct 23, 2026
@BYK
BYK merged commit fbaa949 into main Oct 23, 2026
29 checks passed
@BYK
BYK deleted the byk/strict-fragment-command-check branch October 23, 2026 21:45
sentry-junior Bot added a commit that referenced this pull request Oct 23, 2026
The block shows attribute keys used by span list and explore, so it
cannot move into attribute list's docs.examples. Mark it with
allow-commands to satisfy the fragment check added in #1639.
betegon pushed a commit that referenced this pull request Oct 25, 2026
The block shows attribute keys used by span list and explore, so it
cannot move into attribute list's docs.examples. Mark it with
allow-commands to satisfy the fragment check added in #1639.

This branch was previously deployed

1 inactive deployment
Preview — 32e50516 Deployed Oct 23, 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