Skip to content

Fix broken Python/YAML code snippets across 5 doc pages - #21074

Open
workprentice[bot] wants to merge 1 commit into
masterfrom
snippet_sweep_20260822
Open

Fix broken Python/YAML code snippets across 5 doc pages#21074
workprentice[bot] wants to merge 1 commit into
masterfrom
snippet_sweep_20260822

Conversation

@workprentice

@workprentice workprentice Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

A parser-verified sweep of every fenced code block under content/docs/** (Python via ast.parse, YAML via yaml.safe_load, JSON via json.loads, Go/TypeScript/C#/Java via a delimiter-balance heuristic) found five real, copy-paste-breaking syntax defects. Illustrative snippets using ... elisions, narrative placeholders, or intentional excerpt fragments were excluded as false positives; each defect below was independently confirmed against the real parser before being fixed.

Fixes #21073.

Changes

  • deployments/concepts/webhooks.md: the Python Webhook example called pulumi_service.Webhook(...) after importing pulumi_pulumiservice, and used key: value colon syntax instead of Python keyword arguments (key=value).
  • iac/concepts/functions/resource-methods.md: the get_kubeconfig function stub was missing its trailing colon and body.
  • iac/languages-sdks/python/python-blocking-async.md: missing comma between the stdout= and stderr= keyword arguments to create_subprocess_shell; also tightened the adjacent is not 0 int-literal comparison to != 0 and fixed an uncalled stdout.decode bound-method reference to stdout.decode() in the same snippet.
  • iac/get-started/gcp/create-component.md: the website={...} dict literal in the complete GcpStorageWebsite listing used stray backslash-escaped braces (\{ / \}) instead of plain { / }.
  • iac/get-started/terraform/convert-hcl.md: the converted Pulumi YAML program had vpcSecurityGroupIds: [${web-sg.id}], an unquoted interpolation inside a YAML flow sequence, which YAML parses as an (invalid) flow mapping opener; quoted it as ["${web-sg.id}"].

Verification

  • Each fixed snippet re-parsed individually with the real parser (ast.parse for Python, yaml.safe_load for the YAML snippet) to confirm it is now syntactically valid.
  • Re-ran the full repository-wide sweep after the fix: zero remaining hits of this defect class in the five files touched.
  • node ./scripts/lint/lint-markdown.js: 1846 files parsed, 0 errors.
  • ./scripts/prettier.sh --check on the five changed files: all pass.

🧠 This PR was created by workprentice.

Parser-verified sweep of every fenced code block under content/docs/**
(ast.parse for Python, yaml.safe_load for YAML) found five copy-paste-
breaking syntax defects, fixed here:

- deployments/concepts/webhooks.md: wrong module name
  (pulumi_service -> pulumi_pulumiservice) and colon syntax instead of
  Python keyword arguments.
- iac/concepts/functions/resource-methods.md: function stub missing
  its trailing colon and body.
- iac/languages-sdks/python/python-blocking-async.md: missing comma
  between keyword arguments, plus the adjacent is-not/int-literal
  comparison and an uncalled bound method in the same snippet.
- iac/get-started/gcp/create-component.md: stray backslash-escaped
  braces in a dict literal.
- iac/get-started/terraform/convert-hcl.md: unquoted interpolation in
  a YAML flow sequence.

Fixes #21073.
@github-actions github-actions Bot added review:triaging Claude Triage is currently classifying the PR domain:docs PR touches technical docs review:in-progress Claude review is currently running and removed review:triaging Claude Triage is currently classifying the PR labels Aug 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pre-merge Review — Last updated 2026-08-22T14:16:25Z

Tip

Summary: A five-file copy-editing sweep that repairs code snippets a reader would otherwise paste and watch fail: a Python example in the deployments webhooks page that used pulumi_service instead of the imported pulumi_pulumiservice and colon-style key/value pairs instead of keyword arguments; a Python method signature in the resource-methods page missing its trailing colon and body; markdown-escaped braces (\{ / \}) leaking into a rendered GCP component snippet; an unquoted ${web-sg.id} inside a YAML flow sequence in the Terraform conversion guide; and four asyncio bugs in the Python blocking/async page (missing argument comma, is not 0 identity comparison, and an uncalled stdout.decode). Each change is a strict correctness improvement over what was there, and the failure mode that would block a reader — a snippet that still doesn't parse or run after the "fix" — doesn't occur in any of them. Verification covered per-snippet syntax review, the EKS Python SDK signature against pulumi/pulumi-eks, Python identity-vs-equality and coroutine semantics, and a sibling sweep for the same broken patterns elsewhere in the docs.

Review confidence:

Dimension Level Notes
mechanics HIGH
facts HIGH
cross-sibling consistency HIGH
Investigation log
  • Cross-sibling reads: 7 of 7 siblings
  • External claim verification: 4 of 5 claims verified (0 unverifiable, 1 contradicted) · 4 specialists (numerical, cross-reference, capability, framing); 0 cross-specialist corroborations · routed: 0 inline, 4 Pass 1, 1 Pass 2 (verified 0, contradicted 1, unverifiable 0), 0 Pass 3.
  • Cited-claim spot-checks: 1 of 1 cited claims fetched and compared
  • Frontmatter sweep: ran on body + meta_desc
  • Temporal-trigger sweep: ran (recency words present in diff; spot-check in-review)
  • Code execution: not run (no static/programs/ change)
  • Code-examples checks: not run (no fenced code blocks in content files)
  • Editorial-balance pass: not run (not under content/blog/)
🚨 Outstanding ⚠️ Low-confidence 💡 Pre-existing ✅ Resolved
0 0 1 0

🔍 Verification trail

5 claims extracted · 4 verified · 0 unverifiable · 1 contradicted · 1 detector finding
  • L74-81 in content/docs/deployments/concepts/webhooks.md "The Pulumi Service Python SDK package is named pulumi_pulumiservice, and its Webhook resource can be constructed with active, display_name…" → ❌ contradicted (evidence: The cited source URL https://example.com/webhook returns HTTP 404, so it cannot support the claim as written.; source: https://example.com/webhook)
  • L51-54 in content/docs/iac/concepts/functions/resource-methods.md "The get_kubeconfig method has a Python signature with parameters profile_name: Optional[pulumi.Input[str]] = None and role_arn…" → ✅ verified (evidence: The pulumi-eks Python SDK source (sdk/python/pulumi_eks/cluster.py) defines def get_kubeconfig(self, *, profile_name: Optional[pulumi.Input[_builtins.str]] = None, role_arn: Optional[pulumi.Input[_builtins.str]] = None) ->…; source: gh search code --owner pulumi "get_kubeconfig role_arn" (pulumi/pulumi-eks:sdk/python/pulumi_eks/cluster.py))
  • L155 in content/docs/iac/languages-sdks/python/python-blocking-async.md "In Python, using is not 0 to compare an integer return code is unreliable/incorrect and != should be used instead for value comparison." → ✅ verified (evidence: The doc's example code literally contains if res.returncode is not 0: (line 118). In Python, is/is not test object identity, not value equality; relying on it for integer comparison is unreliable because it depends on CPython's…; source: repo:content/docs/iac/languages-sdks/python/python-blocking-async.md (line 118: if res.returncode is not 0:))
  • L157 in content/docs/iac/languages-sdks/python/python-blocking-async.md "stdout.decode without parentheses returns a bound method object rather than invoking the decode operation, so stdout.decode() (with parentheses) is…" → ✅ verified (evidence: This is standard Python semantics: stdout.decode (no parens) accesses the bound method object itself, while stdout.decode() calls it to perform the decode. This is a well-established Python language behavior, not a Pulumi-specific…; source: Python language semantics (attribute access vs. method call))
  • L159-160 in content/docs/iac/languages-sdks/python/python-blocking-async.md "Calling an async function directly without the await keyword returns a coroutine object rather than executing the function's body to completion." → ✅ verified (evidence: Source file itself states: "Calling an async function directly (without the await keyword) returns a coroutine" — this matches standard Python async semantics (calling a coroutine function returns a coroutine object; the body only…; source: repo:content/docs/iac/languages-sdks/python/python-blocking-async.md (lines 159-163); general Python async/await language semantics)
  • L1 in content/docs/iac/concepts/functions/resource-methods.md "frontmatter menu.concepts.parent: functions does not exist in the concepts menu" → 🚩 flagged (frontmatter: menu-parent)

🚨 Outstanding in this PR

No outstanding issues.

⚠️ Low-confidence

No low-confidence findings.

📋 Triaged verifier findings

I double-checked these and realized they weren't real findings — click to expand
  • [L74-81] content/docs/deployments/concepts/webhooks.md"The Pulumi Service Python SDK package is named pulumi_pulumiservice, and its Webhook resource can be constructed with active, display_name…"Spurious: the verification step treated https://example.com/webhook as the claim's source and marked it contradicted because that URL 404s. It isn't a citation — it's the placeholder payload_url value inside the example snippet itself. The underlying claim holds: the Python package is pulumi_pulumiservice (matching the import pulumi_pulumiservice line directly above), and this PR's change from pulumi_service.Webhook(...) with colon-style pairs to pulumi_pulumiservice.Webhook(...) with keyword arguments is correct Python.

💡 Pre-existing issues in touched files (optional)

  • [L1] content/docs/iac/concepts/functions/resource-methods.md"frontmatter menu.concepts.parent: functions does not exist in the concepts menu"Pre-existing: the page's frontmatter carries a second, legacy concepts: menu block (parent: functions, weight: 3) alongside the live iac: block whose parent: iac-concepts-functions resolves correctly. The dangling parent predates this PR, which only edits a fenced Python block at L50-54 and doesn't touch frontmatter. Worth cleaning up separately — the concepts: block appears to be a leftover from the /docs/concepts//docs/iac/concepts/ reorganization.

✅ Resolved since last review

No items resolved since the last review.

📜 Review history

  • 2026-08-22T14:16:25Z — All five snippet fixes check out; the one contradicted verdict was a placeholder URL mistaken for a citation, and the flagged menu parent is pre-existing. (203f1a6)

  • Refresh this review — comment @claude #update-review. Say what you fixed, or which finding you dispute and why; both work in the same mention.
  • Ask for anything else — comment @claude with no hashtag (questions, one-off fixes). Leaves this review untouched.

Important

Please don't hide, resolve, or delete this comment! It breaks things!

📖 How pre-merge review works — the full lifecycle, short-circuits, and escape hatches.

@github-actions github-actions Bot added review:no-blockers Claude review completed cleanly; outstanding is empty and removed review:in-progress Claude review is currently running labels Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain:docs PR touches technical docs review:no-blockers Claude review completed cleanly; outstanding is empty

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken code snippets: Python/YAML syntax errors across 5 doc pages (get-started, concepts, deployments, esc)

2 participants