Repository navigation
Generate the Synthetics monitors in docs-journeys without Node, and drop push - #4804
Merged
Merged
Conversation
…rop push docs-journeys exported through npx and pushed through @elastic/synthetics, so the binary needed Node, the npm registry and an install on the runner, and an npm failure surfaced as its own exit code. export synthetics now writes the project itself: the monitor files, the config, package.json with a lockfile that ships inside the binary, and a manifest of the journeys that must register. The caller validates and pushes with npm. A test exports a fixture set with this generator and with @nullean/journeys 0.9.0 and requires byte-identical files. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
|
Will this still work docs-internal-workflows? |
…tainment, CI conformance - --dry-run now fails like the real run when no monitor applies. - Two sources that map to the same output file are refused. - Only the platform's directory separator becomes '/' in a source name, and each write must stay under the journeys folder. - The npm conformance test fails instead of skipping when CI is set. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A source such as `..\escape.journey` is a legal Unix file name. The export treats the backslash as part of the name, so the file lands in `out/journeys` and a sentinel next to it stays unchanged. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4804/ Sample changed pages: |
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.
docs-journeys export syntheticsnow writes the whole Synthetics project itself, with no Node, npm or npx, andpushis gone: the caller validates and pushes with npm.Affects: CLI, Deploys & previews
Stack: none; based on
main, which has the whole journeys stack (#4789 and the PRs under it). A workflow indocs-internal-workflowsis written against the output described below.Prompt summary: The tool should not need npm. Generate the monitor files natively with
@nullean/journeysas the runtime import, and do validation and the push outside the tool, indocs-internal-workflows, with npm.Why
exportrannpx @nullean/journeysandnpm install, andpushran@elastic/synthetics. So the binary needed Node and the npm registry on the runner, an install ran third-party scripts in a job that went on to hold the Synthetics API key, and an npm failure came back as npm's own exit code. The Kibana API has no project endpoint and browser monitors need a bundle, so a pure-.NET push is a much larger job; generating the files natively and leaving npm to the caller removes the risk without it.What
The export
export syntheticsgenerates the monitor files in C# (MonitorExporter), a port of the npm package'sexport-synthetics, using the metadata parsers the tool already has (Nullean.Cdp.Journeys, and the standaloneNullean.HttpFileParserfor.httpmonitors). The output folder holds:manifest.jsonlists exactly the journeys that must register, with the names Synthetics reports asjourney.name:{ "project": "elastic-co-docs-demo", "env": "demo", "monitors": [{ "name": "navigation/live/main-paths", "file": "journeys/navigation/live/main-paths.journey.ts" }] }An export that produces no monitor still fails and writes nothing (
--allow-emptyto accept it). A re-export removes only generated files it no longer produces.What the caller runs
Removed
push,Npx.cs, everynpx/npmcall, the Windowscmd.exehandling, and the[NotInParallel("npx")]workaround that only existed for them.Tests
The new
DocsJourneysExportConformanceTestsexports a fixture set (with and without@monitor,@requiresmet and unmet, feature blocks,@mutates, paging on and off, escaping, a.httpmonitor) with this generator and withnpx @nullean/[email protected] export-synthetics, and requires the files to be byte for byte the same. It skips whennpxor the registry is unavailable, and runs in the CI shard that has both. Other tests cover the manifest, the lockfile against the pins inpackage.json, stale-file removal, determinism and the error cases.Risk: the port can drift from the npm exporter. The conformance test is what guards that, so it runs in CI and not only locally.
Verify
I ran a real export against
https://docs-demo.elastic.devand checked the files against the npm exporter's withdiff -r: identical. In that output,npm ci --ignore-scriptsinstalls from the embedded lockfile, andelastic-synthetics --dry-runregisters exactly the manifest's four journeys. Changing a generator rule (thereadOnlyflag, the backtick escape,@mutateshandling, paging, the manifest path, the stale-file guard, a pin that disagrees with the lockfile) fails a test each time.Untested: the Linux build of this change (checked on macOS only), a push to a real Kibana, and the conformance test on a Windows runner.