Skip to content

httpSteps: run .http files as Synthetics steps, and export them as monitors - #43

Merged
Mpdreamz merged 1 commit into
mainfrom
feature/http-steps
Nov 10, 2026
Merged

Mpdreamz merged 1 commit into
mainfrom
feature/http-steps

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

Adds httpSteps to @nullean/journeys/synthetics, which runs a .http request file as a Synthetics journey with one step per request, and makes journeys export-synthetics export .http files that have @monitor.

Stacked on #42: its base is that branch, so retarget to main once #42 merges.

Why

An endpoint with no page, such as the docs MCP server, has no journey to write. Its checks are already .http files for dotnet test (nullean/snapshots, with # @expect and # @readonly since #48 and #49), and a monitor should run the same file.

What

  • A TypeScript subset of Nullean.HttpFileParser, not the .NET tool at export time. The plan allowed exporting JSON from the .NET parser. That would make a Node package need a .NET tool, and the monitor would still need a runner, while the full parser is about 3,000 lines. The subset (about 600 lines) reads requests, headers, inline bodies, ### names, file variables, {{ }} references (variables, $processEnv, $env, $secret, $guid, $uuid, $timestamp, $isoTimestamp, $randomInt, and name.response.body… and name.response.headers…), @readonly, @expect, @no-redirect and @timeout. Everything else (file bodies, environments, $datetime, JetBrains scripts, cURL, GraphQL) is refused with a reason and a line, with Nullean.HttpFileParser's wording.
  • The same meaning as dotnet test. A 404 is a response. @expect status 200|2xx, header … ~ … and json $.a[*].b equals|contains … give the .NET messages. A read-only run sends only GET, HEAD and OPTIONS, plus requests marked # @readonly.
  • Directives. @tags, @requires, @monitor, @alert and @mutates go in the comments before the first request, using the journey grammar (MetadataBuilder is now exported from parse.ts). Nullean.HttpFileParser reads them as plain comments, so the same file still runs in dotnet test.
  • Export. *.http.journey.ts with httpSteps({ request, step, params }, …), the same context embedding, readOnly: true, and an error when two sources would share a monitor id.
  • Step names are the request line as written, variables unresolved, so a secret never reaches Kibana.

docs/journeys/playwright.md documents it, including what is refused, and DECISIONS.md records the choices.

Verify

cd js/journeys && npm ci && npm run build && npm test

test/http.test.ts covers parsing, the refusals and every message, JSONPath, and running against a local server through Playwright's real request context: ordered requests, variables, a response value passed to the next request, expectations, read-only, run headers, @no-redirect. export-live.test.ts now also runs an .http monitor under the real @elastic/synthetics CLI, passing, and failing at the request whose @expect does not hold. I broke the read-only refusal, the status check, equals and the response memory in turn, and each made a test fail.

Not tested: a push to Kibana. Gaps: the .NET and TypeScript parsers are not yet run against shared fixtures; the TS tests restate the .NET messages. JSON numbers compare as JavaScript reads them (1.0 is 1). Exported .http monitors still start a browser, because a Synthetics journey does.

@Mpdreamz
Mpdreamz changed the base branch from feature/export-synthetics to main November 10, 2026 13:27
…nitors

A monitor for an endpoint with no page, such as an MCP server, is a .http file. httpSteps runs one step per
request on Playwright's request context, with the @expect and @readonly semantics and messages of
Nullean.HttpFileParser, on a TypeScript subset of its parser that refuses what a monitor cannot run. The
exporter writes a .http file that has @monitor to *.http.journey.ts, read-only like any other monitor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Mpdreamz
Mpdreamz merged commit 435b7e7 into main Nov 10, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant