ci: notify the docs retrieval index after prod deploy, and keep code indentation in static Markdown (TE-28101) - #3557
Open
chaitanyas-maker wants to merge 6 commits into
Conversation
Adds documentation-notify.yml on testmuCom, triggered by workflow_run on 'Deployment (Prod - testmucom New Bucket)' when it succeeds. - docs-retrieval-index: HMAC-SHA256 signed POST /v1/index with the deployed commit sha (TE-28101, RFC section 4.3). Retries on 409, 429 and 5xx with backoff; fails on 400, 401, 403, 404 and 413. - product-context: the same documentation-updated repository_dispatch the stage copy sends, now from the prod deploy, diffed against the previous successful deploy's commit. Needs secret DOCS_RETRIEVAL_DISPATCH_TOKEN (equal to the service's INDEX_DISPATCH_HMAC), variable DOCS_RETRIEVAL_URL and the existing PRODUCT_CONTEXT_DISPATCH_TOKEN. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
toPlainMarkdown removed every leading space and tab from every line of every fenced code block, not only the fence's own indentation. Nested YAML keys and Python bodies came out flush left, so the Markdown copies linked from llms.txt carried code that no longer means what the page shows. For example hyperexecute-yaml-version0.2.md served 'framework:' followed by an unindented 'name:'. Remove at most the fence's own indentation from each line, as CommonMark does for an indented fence. On the corpus at 21f594c, generated files with an indented code line go from 0 to 533 (556 source files have one; the rest only carry the list or JSX indentation that is correctly removed), and 534 generated files change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
scripts/check-static-md-fences.js runs after generate-static-md.js and compares every fenced code block in docs/ with its copy in static/docs/: the same non-blank lines, in order, with the same relative indentation (only the fence's own indentation may be removed). It fails on any changed line and on a source fence that is never closed or that another opening fence interrupts, and warns when a code block is missing from the generated copy. Node built-ins only. Wired as npm run check-static-md-fences and as a pull request workflow on docs and generator changes. At 21f594c with the previous commit's fix: 4,833 blocks checked, 0 changed lines, 9 unclosed or interrupted fences in 5 source docs that need fixing before this check can pass, and 13 code blocks missing from 6 generated files (a separate content-dropping defect in the generator). Without the fix the same check reports 19,493 changed lines in 531 docs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The fence-fidelity check found 9 code fences that are never closed or that another opening fence interrupts. On the site, every later fence in those pages pairs the wrong way round, so prose renders as code and code as prose. Each fix follows what the page was written to show: - kane-cli-testmd-composition.md: the two test.md examples that contain a nested yaml step block now use four-backtick outer fences, so the inner three-backtick fences stay inside the example. Four VerifiedTag lines that the badge script had inserted inside those examples and inside the path tree are removed; the tags before each example stay. - playwright-sdk.md: close the last bash block, which is the end of the page. - smartui-appium-hooks.md: close the Python full-page block and its TabItem before the Ruby tab. - smartui-build-merging.md: close the bash blocks of strategies 1 and 2 before the next strategy heading. - smartui-cli-env-variables.md: close the MacOS/Linux HTTP_PROXY block and its TabItem before the Windows tab. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…unset docs-retrieval-service is not deployed yet. Until the DOCS_RETRIEVAL_URL repository variable is set, the docs-retrieval-index job logs a notice and succeeds instead of failing after every prod deploy. Once the URL is set, a missing DOCS_RETRIEVAL_DISPATCH_TOKEN secret is still an error. The product-context job is unaffected. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
stage already has a different .github/workflows/documentation-notify.yml (the push-triggered product-context notifier). Adding a file at the same path on testmuCom would make the two branches diverge on one file, and the reviewer asked for this change to go to stage first. Replace documentation-notify.yml with docs-retrieval-index-notify.yml, which carries only the docs-retrieval-index job (workflow_run after 'Deployment (Prod - testmucom New Bucket)', HMAC-signed POST /v1/index with retries, a no-op while DOCS_RETRIEVAL_URL is unset). The product-context dispatch is dropped from this PR and stays as it is on stage. The same file is added on stage, so both branches carry identical content. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
.github/workflows/docs-retrieval-index-notify.yml(ontestmuCom). It runs onworkflow_runwhenDeployment (Prod - testmucom New Bucket)finishes withconclusion == 'success', and has one job,docs-retrieval-index. It sends an HMAC-SHA256 signedPOST /v1/indexto docs-retrieval-service with the deployed commit sha. The body is{"sha":"<40 hex>","ts":<epoch seconds>,"trigger":"deploy"}and the header isX-Signature-256: sha256=<hex>. A freshtsis signed on each attempt. It retries HTTP 409, 429, 5xx and connection failures up to 6 times (15, 30, 60, 120 and 240 seconds apart), and fails at once on 400, 401, 403, 404 and 413. It can also be run by hand (Actions, "Notify docs retrieval index after prod deploy", Run workflow) with a deployedsha.documentation-notify.yml, the pathstagealready uses for its push-triggered product-context notifier. The docs retrieval trigger is now its own file, and the product-context workflow onstageis left as it is, sostageandtestmuComdo not diverge on that file.scripts/generate-static-md.js. When it shielded fenced code blocks, it removed all leading whitespace from every code line. It now removes at most the fence's own indentation, as CommonMark does.scripts/check-static-md-fences.js, thenpm run check-static-md-fencesscript, and a pull request workflowstatic-md-fence-fidelity.yml. The check runs after the generator and compares every fenced code block indocs/with its copy instatic/docs/: the same non-blank lines, in order, with the same relative indentation. It fails on a changed line, and on a source fence that is never closed or that another opening fence interrupts. It warns (fails only with--strict) when a code block is missing from the generated copy. Node built-ins only, nonpm installneeded.kane-cli-testmd-composition.md: the two test.md examples that contain a nestedyamlstep block now use four-backtick outer fences. Four<VerifiedTag>lines that the badge script had inserted inside those examples and inside the path tree are removed (the tag before each example stays).playwright-sdk.md: closes the last bash block, which ends the page.smartui-appium-hooks.md: closes the Python full-page block and itsTabItembefore the Ruby tab.smartui-build-merging.md: closes the bash blocks of strategies 1 and 2 before the next heading.smartui-cli-env-variables.md: closes the MacOS/LinuxHTTP_PROXYblock and itsTabItembefore the Windows tab.Why
Search index trigger. The MCP
search_testmu_docstool is backed by docs-retrieval-service, which needs to know when new docs are live. A push trigger fires before the site is built and uploaded, so this usesworkflow_runon the prod deploy and skips failed or cancelled deploys.Broken code in the Markdown copies. The
.mdcopies understatic/docs/are served as<slug>.md, linked fromllms.txt, and read by AI agents and the retrieval index. The generator flattened indentation in code blocks, so YAML and Python lost their meaning. For examplehyperexecute-yaml-version0.2.mdserved:Numbers
Measured on
testmuComatf9d611a5with this branch's docs, generator run locally (1,439 generated files, 4,924 code blocks compared):Without the doc fixes the check also reports 9 unclosed or interrupted fences in 5 docs. With them it passes:
0 error(s), 13 warning(s).The committed copies under
static/docs/are not regenerated in this PR, becauseprebuildregenerates them on every build.Settings needed (names only)
DOCS_RETRIEVAL_URLDOCS_RETRIEVAL_DISPATCH_TOKENThe docs retrieval call does nothing until
DOCS_RETRIEVAL_URLis set. The service is not deployed yet. While the variable is unset,docs-retrieval-indexlogs a notice and succeeds, so it never turns a prod deploy red. Once the URL is set, a missingDOCS_RETRIEVAL_DISPATCH_TOKENis an error.Same change on
stageAs requested in review, this change is also raised against
stagein #3558, with the same workflow file, generator fix and check. Onstageonly 3 pages need fence fixes (smartui-appium-hooks.mdandsmartui-cli-env-variables.mdare already closed there).workflow_runonly fires for workflow files on the default branch, so the workflow runs only once it is ontestmuCom; onstageit is dormant. The workflows have not run on GitHub yet. Their YAML was parsed and passesactionlint, and the notify step's shell was run locally.Known issue, not fixed here
The generator drops whole regions of 6 pages, so 13 code blocks are missing from their
.mdcopies. This happens with and without this PR (probably in the tag-stripping steps), and the check reports it as warnings:deep-dive-into-hyperexecute-yaml(6 blocks)hyperexecute-background-services(2 blocks; the generated file is 13 lines, only the FAQ is left)hyperexecute-projects(2 blocks)legacy-test-platform-to-lambdatest(generated asmigrate-from-legacy-platform-to-testmu.md, 1 block)playwright-test-execution-setup(1 block)travis-ci-with-hyperexecute(1 block)🤖 Generated with Claude Code