@enact-load/cli
v0.2.0
Published
Local Enact load-testing CLI
Readme
Enact CLI
This package supplies the enact executable for local run, validation, report,
history GUI, scaffold, offline load planning and sequential matrix workflows. Use enact --help for
the supported commands.
validate, plan, run and matrix accept --dotenv PATH to explicitly load
a Node-format .env file relative to the current directory. Existing environment
variables win; there is no automatic discovery. Missing/unreadable files fail.
Use secrets: { token: { env: TOKEN } } for credentials rather than interpolating
them into reportable configuration strings. Keep .env files out of source control.
Local browser workloads select environment: browser or environment: mixed in their configuration
and run with enact run run.yaml. Install the exact optional automation peer
and its managed Chromium explicitly:
npm install --save-exact [email protected]
npx --no-install playwright-core install chromium
enact validate run.yaml
enact run run.yamlUse full Chromium, not --only-shell, and install the platform's Playwright
system dependencies. If using PLAYWRIGHT_BROWSERS_PATH, use the same value for
installation and execution. Validation does not launch a browser or contact the
target; run startup checks the pinned package/binary before workload admission.
Neither command installs packages or downloads browsers.
Saved reports include optional identity.browserRuntimes entries when native
browser startup has verified the automation package and live Chromium version.
Each entry records the worker ID, Playwright version, Chromium version and
managed revision; all six export formats retain this evidence. Process IDs,
executable paths and private connection endpoints are excluded. Entries may
remain in failed/partial runs; a verified launch is not a successful business
goal. Older reports and HTTP-only runs may omit this field.
Mixed runs assign HTTP and browser populations to separate, fixed worker owners
under one coordinator. Set simulation.workers to at least two and select each
population's execution binding; browser populations also select a browser profile.
HTTP request/body budgets apply only to HTTP workers; browser process/context
grants are separate. Named HTTP bindings also work in HTTP-only local runs.
See the hybrid FileSpace configuration.
The local dashboard keeps HTTP request latency separate from browser logical action duration, with browser-only settled counts, failure rate and P95. Browser duration excludes session setup, queues, failure cleanup and diagnostic capture; it is not a browser network waterfall. Live and saved overview charts retain this distinction, and Print / Save PDF labels the run's execution mode. Saved history/report views do not reopen the model or target.
CLI runs and matrix trials enable chunked history by default: 8 MiB per chunk,
five-minute rotation and a 1 GiB history budget. Customize these limits with
report.history, or set report.history: false to disable chunked history.
The canonical report and browser diagnostic files remain separate.
Browser/mixed dashboards offer Execution kind, Execution binding and Browser profile under Advanced options. Binding/profile suggestions come from retained population metadata. Filters combine across metrics, retained agents and activity without merging HTTP and browser latency; they also carry into current-view Print / Save PDF. Checks remain run-wide. HTTP-only dashboards keep their existing controls.
Browser/mixed runs default to bounded failure screenshots, rolling traces and detailed browser evidence. Journey capture and read-only Inspector availability also default to enabled; viewing starts only when requested. To opt out:
report:
output_dir: ./results
browser_diagnostics: false
capture_journeys: false
inspector:
enabled: falseScreenshots contain unredacted target pixels; traces contain unredacted page
text, potentially including credentials or personal data. Detailed evidence
redacts recognized credentials but may retain other sensitive application data.
browser_diagnostics: true restores all browser capture defaults; explicit
object-form policies preserve their category flags and acknowledgement requirements.
HTTP response_diagnostics remains independent. Structured projection
redaction does not make these files safe; captured runs explicitly set
privacy.visualArtifacts: unredacted. Review diagnostics before sharing.
Capture uses a fixed clip of at most 1280 by 720 CSS pixels and no native file writer. The limits are 8 MiB per artifact, 32 MiB per agent and 128 MiB per run. The current implementation conservatively reserves 8 MiB per attempt, with at most four grants per agent and seven per run, shared by screenshots and traces. Failed retention attempts spend their grants; clean, unretained trace recordings return theirs after session disposal. Failure retention prioritizes the trace before an optional screenshot. This keeps capture within 56 MiB per run and leaves room for existing exports and history within the publication file limit. Owned diagnostic files have private permissions and digest-bound references in all six report formats. Disabled, unavailable and quota-truncated diagnostics are explicit; an invalid/truncated PNG is never published. Saved readers check sizes/digests and warn about missing/corrupt optional diagnostics without rewriting business results or reopening the model/target.
rolling_trace: true starts an Enact-owned ten-second rolling action/substep
timeline before dispatch. It retains failure evidence as
browser-diagnostic-N.trace.json, in enact-browser-trace-v1 format.
The live ring holds at most 1 MiB of encoded events and 1,024 records;
retained JSON is at most 2 MiB. Whole oldest records are evicted on saturation,
with explicit truncated coverage. Page-text previews run before dispatch,
periodically at one-second intervals and before retention. Each preview returns
at most 16,384 UTF-16 code units, visits at most 4,096 text nodes with a 10 ms
in-page traversal fence, and has a 250 ms host wait bounded by the original
deadline. An unavailable preview marks partial evidence and stops further
preview requests for that recording.
These are bounded page-text previews, not full DOM/network replay or native Playwright Trace Viewer archives. Native tracing and video recording remain disabled; neither offers this bounded recording contract.
Browser execution uses owned local processes, isolated account contexts and
explicit profile origin grants. The restricted profile supports HTTP/1.1 without
embedded frames; HTTP/2, QUIC, workers, WebSockets, WebRTC and WebTransport are
unsupported. TLS verification remains enabled. Browser/mixed matrices,
target viewport streaming and manual takeover are not supported. The optional
--ui web dashboard is a run monitor, not a target browser viewport.
Persistent server execution does not accept browser workloads.
The SDK remains @enact-load/sdk. Local CLI production dependencies do not contain
AWS SDKs; hosted server/launcher/executor applications belong to @enact-load/cloud.
MIT-licensed; see the included LICENSE. This package is configured for public npm releases.
enact plan run.yaml --latency 100ms --requests-per-agent 5 --think-time 1500ms
estimates unconstrained load from explicit whole-agent assumptions without target
requests or resolving secrets. --format json produces machine-readable output.
runHttpLoopback from @enact-load/cli/testing runs the production CLI against an
owned ephemeral target. Supply an absolute model path, finite max_requests
(at most 10,000), explicit loopback auth permission, config factory and expected
routes. It returns header-name-only receipts and a decoded report, then cleans
up temporary storage. This live helper is separate from portable SDK fixtures.
Route path accepts an exact string, RegExp, or synchronous
(path: string) => boolean for generated per-run paths. All match the received
path including base-path prefix and query; predicates receive no headers.
Methods remain exact and routes are tried in order. Regex state is reset for
each match without changing the supplied regex. Invalid routes fail upfront;
throwing predicates or non-boolean returns reject the helper and clean up rather
than returning a misleading 404.
