docs: make shell examples pasteable and gate unquoted placeholders #3209
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3209"
general
weight: 0.35
lalitadithya
Summary
Shell examples in
docs/used bare<placeholder>arguments that bash reads as redirection, so the commands could not be pasted. This converts all 216 of them (144 lines, 21 files) to an assignment line plus a quoted expansion, and addsmake check-docs-shelltomake lintand the merge gate so new ones cannot land.Motivation / Context
kubectl delete namespace <namespace>is a syntax error when pasted, andkubectl get pods <name> -n defaultruns with its output written to a file named-nwhenever a file callednameexists. The obvious fix, a bare${NAMESPACE}, is worse: an unset variable expands to nothing andkubectl deleteorhelm uninstallruns with an argument missing. The issue asks for a conversion that stays fail-closed, plus a lint so the count does not drift back up.Fixes: #2266
Related: N/A
Type of Change
Component(s) Affected
cmd/aicr,pkg/cli)cmd/aicrd,pkg/server)pkg/recipe)pkg/bundler,pkg/component)pkg/collector,pkg/snapshotter)pkg/validator)pkg/errors,pkg/k8s)docs/,examples/)tools/check-docs-shell,tools/mdx/check-docs-shell.mjs),Makefile,.github/workflows/merge-gate.yamlImplementation Notes
Conversion form. Every converted block assigns each variable in the same block before its first use, with a
# replace with ...comment, and quotes every expansion ("${NAMESPACE}","snapshot-rbac-${RUN_ID}/"). No block relies on a variable from an earlier block. Values that come from the output of an earlier step (run IDs, security group IDs, a replacement pod, thecopyTopath) are assigned right after that step, and the comment says where to read them.Example values. For anything that deletes, uninstalls, drains, taints, labels, patches, applies, pushes, or opens network access, the example value cannot plausibly match a real resource:
my-namespace,my-release,my-gpu-node,sg-0123456789abcdef0, and an obviously synthetic0123456789abcdef...signer and digest for evidence pointers. A block pasted without editing fails with NotFound instead of acting on something real. Read-only commands use realistic values.Not converted.
aicr verify <bundle-dir> [flags]) and flag fragments are grammar, not commands, so their fences are nowtext. All 17 synopsis blocks incli-reference.mdwere relabelled so the page stays consistent.consoletranscripts, placeholders in comments, and quoted placeholders in untouched blocks are left alone. In blocks that were converted anyway, quoted placeholders were converted too so one block uses one style. The exception is--overridesJSON ineks-dynamo-networking.md, which keeps quoted placeholders with a comment saying to replace them, because parametrizing it needs escaped JSON.docs/design/are point-in-time records and are not amended. The gate skips that directory by default.One correction.
aicr verify ./bundles/<bundle-dir>is nowaicr verify ./bundles.aicr bundle -o ./bundleswrites the bundle and itsattestation/directly into./bundles; there is no subdirectory.The gate.
tools/check-docs-shellreuses thecheck-docs-yamldriver and the pinned MDX parser intools/mdx, so it finds the same fences Fern renders, including fences inside MDX components.tools/mdx/check-docs-shell.mjslexes eachbash/sh/shell/zshblock and reports any<that bash would treat as an operator and that closes like a placeholder (<name>,<a|b>,</path/x.yaml>,<your cluster name>) atfile:line:col. It models quotes, escapes, comments,${...}, arithmetic, and command substitution, including$(...)inside double quotes and inside heredocs with an unquoted delimiter. Real redirections such as<file,< file,<in >out,<in 2>err,<(cmd), and<<EOFpass.docs/withgit ls-files --cached --others --exclude-standard, so a new page is checked before it is added, and a gitignored local scratch file cannot failmake lintwhen CI would pass.make lintand the merge-gatedocs-mdxjob, which runs on docs-only PRs and is aggregated by the requiredgatecheck.Follow-ups, not in this PR. Bare placeholders remain in
demos/*.mdandkwok/README.md, which are outsidedocs/and not published. The Rekor block insupply-chain-verification.mdstill relies on${DIGEST}from that page's setup section, as it did before.Testing
make qualifypassed in a clean worktree: coverage 85.1% against the 83% floor,make lint(including the new gate, MDX, MDX parse, and YAML gates), e2e, scan, api-diff, and openapi-diff.tools/check-docs-shell_test.shruns undermake test. It pins the inert constructs, every reported shape with its line and column, the git-aware scan (ignored, untracked, and deleted-but-tracked files), MDX-nested fences with and without parser recovery, and fail-closed handling of a missing root, a failingfind, a failinggit ls-files, an unreadable file, and zero shell blocks.${...}, ANSI-C, or heredoc handling, treating unquoted heredoc bodies as inert, and scanning ignored files.bash -n, and a scan confirms no variable is used before its assignment in the same block.make check-docs-mdx,make check-docs-mdx-parse, andmake check-docs-yamlpass.No Go source changed, so the coverage gate does not apply.
Risk Assessment
Rollout notes: The new lint fails any future docs change that adds an unquoted
<placeholder>to a shell block. The error output shows the assign-then-quote fix, anddocs/contributor/tests.mddocuments the gate. Nothing changes at runtime.Checklist
make testwith-race)make lint)git commit -s -S) — GPG signing info