Skip to content

fix(samples): make code samples parse on six page pairs - #2628

Merged
bruno-andrade-azion merged 4 commits into
mainfrom
fix/mm-16258-code-sample-fixes
Nov 16, 2026
Merged

bruno-andrade-azion merged 4 commits into
mainfrom
fix/mm-16258-code-sample-fixes

Conversation

@bruno-andrade-azion

@bruno-andrade-azion bruno-andrade-azion commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What & why

Related issue: MM-16258
Pages affected:

  • /en/documentation/guides/application-security/access-and-compliance/configure-user-session-timeout/ · /pt-br/documentacao/guias/seguranca-de-aplicacoes/acesso-e-compliance/configurar-user-session-timeout/
  • /en/documentation/guides/application-security/access-and-compliance/unlock-account-lockout-policy/ · /pt-br/documentacao/guias/seguranca-de-aplicacoes/acesso-e-compliance/desbloquear-account-lockout-policy/
  • /en/documentation/platform/data-stream/templates-and-payload/ · /pt-br/documentacao/plataforma/data-stream/templates-e-payload/
  • /en/documentation/devtools/runtime/api-reference/handlers/ · /pt-br/documentacao/devtools/runtime/api-reference/handlers/
  • /en/documentation/guides/application-development/integrations/send-event-to-endpoint/ · /pt-br/documentacao/guias/desenvolvimento-de-aplicacoes/integracoes/send-event-to-endpoint/
  • /en/documentation/platform/ai-inference/troubleshooting/ · /pt-br/documentacao/plataforma/ai-inference/solucao-de-problemas/

The code-block lint from #2623 parses the samples on every page. On today's main it reports 16 findings in 12 files. This PR clears all 16, on six page pairs, so the Code blocks check on #2623 goes green once this PR is on main. The changes are to code blocks, plus two lead-in sentences on the AI Inference troubleshooting page that introduce the block they split into two. No frontmatter or link changes.

JSON responses that did not parse

  • Session timeout guide: both responses, after GET and after PUT, never closed their outer }. Each gets its closing brace.
  • Unlock guide: the lockout object ended with a trailing comma, which JSON does not allow. The comma is gone, and so is the ... line inside the result. The sibling logs guide already shows the response this way.

Blocks tagged with the wrong format

  • Data Stream payload page: the NDJSON request body, two JSON objects on two lines, was tagged json. It is now jsonl, which the lint checks one line at a time and the bar labels JSON Lines (docs(style-guide): adopt the jsonl tag for JSON Lines samples #2642, already on main). The single-line data set and the JSON array example stay json.
  • Send event to endpoint guide: the error log, a text prefix followed by an XML body, was tagged json. It is now text, as the style guide asks for output that has no language.
  • AI Inference troubleshooting: one json block held two alternative response bodies, one per line. They are two answers, not a JSON Lines stream, so each now has its own json block, formatted over several lines, as the style guide asks for. Each block has a lead-in sentence that names the request that gets it: a body without the model field, and a body that does not parse as JSON. The error strings themselves say which is which.

Signatures that were not JavaScript

  • Runtime handlers reference: the fetch and firewall blocks held a bare method signature, async fetch(request, env, ctx). Each block now shows the method inside the default export, which matches the prose ("the fetch method of the default export") and the ES Modules row in the handler shapes table. Each body is a statement the page documents, so the block parses: the fetch handler returns new Response('Hello World!'), as in the page's Example, and the firewall handler calls ctx.continue(), one of the finishing actions the page lists.

Merged main. The branch merged main, which in the meantime added the ### Parameters and ### Properties headings on the handlers pages, without conflicts.

How I checked it

  • The lint from chore(lint): check the code samples on the pages a PR changes #2623's branch over every page of this branch (2,298 files): no findings, down from 16 in 12 files on main.
  • prettier --check passes on the changed files.
  • pnpm build:local passed: the build and the frontmatter check.
  • Not verified: the samples were not run against the API, and the firewall handler was not deployed. The fetch body is the one the page's Example shows deployed.

Type of change

  • 🆕 New content (feat)
  • 🩹 Fix (fix) — typo, broken link, wrong information
  • ♻️ Content update (docs) — rewrite, expansion, upkeep
  • 🌐 Translation sync (i18n)
  • 🏗️ Platform / structure (refactor / chore) — reviewed by UXE, no content mixed in

Author checklist

  • PR title follows type(scope): summary (see GOVERNANCE.md §4)
  • Frontmatter complete: title, description, meta_tags, namespace, permalink, last_reviewed — the twelve pages have every key but last_reviewed, which no page in the repo carries yet; this PR leaves frontmatter unchanged
  • No legacy "edge-" product names in the copy — the two sentences added on the AI Inference page name no product
  • How-to/tutorial content includes at least one runnable, copy-paste-tested code block — not tested: the changed blocks are API responses, an error log, and handler samples, checked with the code-block lint and a parser, not run
  • Screenshots (if any) have alt text and follow image standards — no screenshot is added or changed
  • Internal links are relative and resolve locally — no link is added or changed
  • If any permalink changed or page moved: redirect added in this PR — no permalink changed and no page moved
  • i18n: pt-br updated in this PR or follow-up i18n issue created: — pt-br updated in this PR, with the same change on each twin
  • I ran pnpm build:local (build + frontmatter check) without errors

- Close the outer brace of the two JSON responses in the session timeout guide.
- Drop the trailing comma in the lockout response of the unlock guide.
- Tag the NDJSON request body in the Data Stream payload page as jsonl.
- Show the fetch and firewall handler signatures inside the default export, so each block is valid JavaScript.

The en and pt-br versions get the same change.
Replace the elided handler bodies with statements the page documents and
drop the '...' line from the lockout response, so every block on the four
pages parses as JavaScript or JSON.
* origin/main: (66 commits)
  docs(templates): point the remaining Deploy links to the March 2026 catalog (#2599)
  fix(architectures): point Deploy buttons at the gallery template slugs (#2614)
  fix(opennext): migrate the OpenNext guide to the v4 azion.config.js format (#2651)
  chore(main): release docs 2.5.0 (#2638)
  docs(style-guide): settle closing names, sentence caps, and the date rule (#2630)
  chore(lint): accept the use-case closing in lint-links (#2632)
  feat(guides): add end-to-end tutorials for six products (#2652)
  fix(agreements): fix the FAQ index links and move the 2016 SLA off the current page (#2633)
  fix(functions): state that the Response Phase runs only Lua functions (#2650)
  docs(architectures): keep security-modernization and bot-management as API v3 versions (#2589)
  fix(runtime): clean up unused imports and JSDoc in the Node.js API samples (#2649)
  docs(platform): retire the v3 build and deploy journey pages (#2587)
  fix(compliance): correct the SOC report cadence and PCI DSS version (#2585)
  docs(runtime): fix the azion dev port and the function size limit (#2583)
  docs(console): apply the review of the Console path convention (#2644)
  docs(workloads): review the Workloads section with the style guide and correct it from live tests (#2570)
  fix(ai-inference): review the AI Inference section and correct it from live tests (#2641)
  docs(templates): apply the review of the migrated template guides (#2645)
  docs(templates): point Deploy links to the current Marketplace catalog (MM-16236) (#2582)
  docs(orchestrator): split how-tos into API v4 and API v3 pages (#2584)
  ...
…ce error bodies

The send-event error log is a text prefix and an XML body, so it takes text.
The AI Inference troubleshooting block held two alternative responses on two
lines; each now has its own json block, formatted over several lines, with a
lead-in sentence. With these, the code-block lint reports no findings on main.
@bruno-andrade-azion bruno-andrade-azion changed the title fix(samples): make code samples parse on four page pairs fix(samples): make code samples parse on six page pairs Nov 16, 2026
@bruno-andrade-azion
bruno-andrade-azion merged commit 1d091e7 into main Nov 16, 2026
9 checks passed
@bruno-andrade-azion
bruno-andrade-azion deleted the fix/mm-16258-code-sample-fixes branch November 16, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants