Skip to content

Generate the Synthetics monitors in docs-journeys without Node, and drop push - #4804

Merged
Mpdreamz merged 3 commits into
mainfrom
feature/journeys-native-export
Nov 10, 2026
Merged

Mpdreamz merged 3 commits into
mainfrom
feature/journeys-native-export

Conversation

@Mpdreamz

Copy link
Copy Markdown
Member

docs-journeys export synthetics now writes the whole Synthetics project itself, with no Node, npm or npx, and push is 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 in docs-internal-workflows is written against the output described below.

Prompt summary: The tool should not need npm. Generate the monitor files natively with @nullean/journeys as the runtime import, and do validation and the push outside the tool, in docs-internal-workflows, with npm.

Why

export ran npx @nullean/journeys and npm install, and push ran @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 synthetics generates the monitor files in C# (MonitorExporter), a port of the npm package's export-synthetics, using the metadata parsers the tool already has (Nullean.Cdp.Journeys, and the standalone Nullean.HttpFileParser for .http monitors). The output folder holds:

journeys/**/<name>.journey.ts   (and <name>.http.journey.ts)
synthetics.config.ts
package.json
package-lock.json               # embedded in the binary, generated once with `npm install --package-lock-only --ignore-scripts`
manifest.json

manifest.json lists exactly the journeys that must register, with the names Synthetics reports as journey.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-empty to accept it). A re-export removes only generated files it no longer produces.

What the caller runs

npm ci --ignore-scripts
npx elastic-synthetics --dry-run --reporter json journeys   # compare journey.name with manifest.json
npx @elastic/synthetics push --yes                          # SYNTHETICS_API_KEY in the environment

Removed

push, Npx.cs, every npx/npm call, the Windows cmd.exe handling, and the [NotInParallel("npx")] workaround that only existed for them.

Tests

The new DocsJourneysExportConformanceTests exports a fixture set (with and without @monitor, @requires met and unmet, feature blocks, @mutates, paging on and off, escaping, a .http monitor) with this generator and with npx @nullean/[email protected] export-synthetics, and requires the files to be byte for byte the same. It skips when npx or the registry is unavailable, and runs in the CI shard that has both. Other tests cover the manifest, the lockfile against the pins in package.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

mise run journeys -- --treenode-filter "/*/*/DocsJourneysExport*Tests/*"
dotnet publish src/tooling/docs-journeys -c Release -r osx-arm64    # no AOT or trim warnings

I ran a real export against https://docs-demo.elastic.dev and checked the files against the npm exporter's with diff -r: identical. In that output, npm ci --ignore-scripts installs from the embedded lockfile, and elastic-synthetics --dry-run registers exactly the manifest's four journeys. Changing a generator rule (the readOnly flag, the backtick escape, @mutates handling, 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.

…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]>
@Mpdreamz
Mpdreamz requested a review from a team as a code owner November 10, 2026 17:36
@Mpdreamz
Mpdreamz requested a review from akira28 November 10, 2026 17:36
@reakaleek

Copy link
Copy Markdown
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]>
@github-actions

Copy link
Copy Markdown
Contributor

@Mpdreamz
Mpdreamz merged commit 4e22662 into main Nov 10, 2026
42 checks passed
@Mpdreamz
Mpdreamz deleted the feature/journeys-native-export branch November 10, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants