loadam 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,7 +26,7 @@ That's it. One spec → a load test, a contract suite, a drift check, and an MCP
26
26
 
27
27
  Both are compiled from the same **Intermediate Representation (IR)** built from your spec.
28
28
 
29
- > **What's new in 0.3.0** — measured accuracy: smoke tests now reach 100% of operations with real IDs on the benchmark (up from 91.8%), and never send made-up IDs. The contract suite is rewritten for Schemathesis 4 with stateful tests that catch use-after-delete, and `loadam contract --run` puts the results in your HTML report. Correct anything loadam infers wrong with `loadam.config.json`. See the [CHANGELOG](CHANGELOG.md#030---2026-12-05) for the full list.
29
+ > **What's new in 0.4.0**: load tests now work on APIs behind a login. loadam finds the login call in your spec, renews tokens before they expire, gives each virtual user its own account with `--users`, sends credentials only where the spec asks for them, and stops with exit code 2 when the credentials are wrong. The HTML report is redesigned: it says why a run failed and has a table of every endpoint you can filter, search and sort. See the [CHANGELOG](CHANGELOG.md#040---2026-12-05) for the full list.
30
30
 
31
31
  ---
32
32
 
@@ -84,7 +84,7 @@ Set `LOADAM_TARGET` once per shell to drop the `--target` flag from every invoca
84
84
  <p align="center">
85
85
  <img src="https://raw.githubusercontent.com/DesmondSanctity/loadam/main/.github/assets/report-screenshot.png" alt="loadam HTML report" width="720">
86
86
  <br>
87
- <sub><i>The single-file HTML report — branded header, per-endpoint sidebar, filter chips, threshold panel.</i></sub>
87
+ <sub><i>The single-file HTML report: the verdict and why, key numbers against their thresholds, latency percentiles, then every endpoint.</i></sub>
88
88
  </p>
89
89
 
90
90
  ## Commands
@@ -138,7 +138,7 @@ loadam report latest --open # one-file HTML report (charts, dark mode)
138
138
  loadam clean --older-than 7d --yes # prune old runs (dry run without --yes)
139
139
  ```
140
140
 
141
- The HTML report is a single self-contained file (no external CDNs, no JS dependencies) and is safe to drop into a CI artefact store, gh-pages, or Slack. It includes a per-endpoint sidebar with live p95 and status-code distribution, filter chips (All / Failed / Flaky / Passed), and a three-tier overall status (passed · flaky · failed) so you can tell at a glance whether a run is genuinely broken or just noisy.
141
+ The HTML report is a single self-contained file (no external CDNs, no JS dependencies) and is safe to drop into a CI artefact store, gh-pages, or Slack. It opens with the verdict and the reason a run failed (the threshold that broke, with the measured value, and the endpoints that failed), then the key numbers, latency percentiles against your p95 limit, and a table of every endpoint you can filter, search and sort, with its pass rate, p95 and status codes. It works on a phone, in light or dark.
142
142
 
143
143
  ## How accurate is it?
144
144
 
@@ -150,6 +150,7 @@ Measured, not assumed. The [`bench/`](bench/) suite runs loadam against referenc
150
150
  | Requests using a made-up path ID / body reference | 0% / 0% |
151
151
  | Drift check: planted mismatches found, false findings | 100%, 0 |
152
152
  | Contract tests: planted bugs found, false alarms on correct APIs | 6/6, 0 |
153
+ | Load test on APIs with 8-second tokens: requests rejected for auth | 0 |
153
154
  | Real APIs (PokeAPI, FakeRESTApi, Petstore v3): failures caused by loadam | 0 (PokeAPI 102/102) |
154
155
 
155
156
  ```bash
@@ -164,6 +165,24 @@ When loadam can't tell from the spec which resource a field points at (say `Tran
164
165
 
165
166
  See [bench/README.md](bench/README.md) for how each metric is scored.
166
167
 
168
+ ## Gated endpoints
169
+
170
+ APIs behind a login work without extra setup. loadam finds the login operation in the spec, and each virtual user logs in and fetches a new token before the old one expires. Public operations get no credentials, and a wrong password stops the run before any load is sent (exit code 2).
171
+
172
+ ```bash
173
+ export API_USER=me@example.com API_PASS=…
174
+ loadam test ./openapi.yaml --mode load # logs in, renews tokens
175
+ loadam test ./openapi.yaml --mode load --users users.csv # one account per VU
176
+ ```
177
+
178
+ If loadam can't tell which operation logs in, declare it in `loadam.config.json`:
179
+
180
+ ```json
181
+ { "auth": { "login": { "operation": "POST /auth/login", "body": { "email": "${API_USER}", "password": "${API_PASS}" }, "token": "data.token" } } }
182
+ ```
183
+
184
+ See the [gated endpoints guide](https://github.com/DesmondSanctity/loadam/blob/main/website/src/content/docs/docs/guides/gated-endpoints.mdx) for cookie sessions, token expiry and user pools.
185
+
167
186
  ## Why loadam
168
187
 
169
188
  Most teams have an OpenAPI spec sitting in a repo and **none** of the rigs that should fall out of it. They wire each one by hand, badly, and then drift. Loadam treats the spec as the source of truth and emits everything once: load, contract, drift, agent. One shape of input, four shapes of output, zero hand-rolled boilerplate.
@@ -200,7 +219,7 @@ packages/
200
219
 
201
220
  loadam handles CRUD-style specs end-to-end, including nested resources, wrapped responses, and specs with 100+ operations (PokeAPI's 102 pass the smoke test). Heavy polymorphism (`oneOf`, discriminators) may still need hand edits to the generated files.
202
221
 
203
- | | Now (0.3) | Planned |
222
+ | | Now (0.4) | Planned |
204
223
  | ------------------------- | --------------------- | ---------------------------- |
205
224
  | OpenAPI 3.x | ✅ | |
206
225
  | Postman / HAR / curl | curl only | Postman + HAR |
@@ -208,10 +227,11 @@ loadam handles CRUD-style specs end-to-end, including nested resources, wrapped
208
227
  | Schemathesis contract | ✅ | |
209
228
  | Drift report | ✅ | |
210
229
  | MCP server (stdio + HTTP) | ✅ read-only default | per-op `--writes` opt-in |
211
- | Auth | bearer, apiKey, basic, OAuth2 client credentials¹ | OAuth2 PKCE, AWS sigv4, mTLS |
230
+ | Auth | bearer, apiKey, basic, OAuth2 client credentials¹, login flows² | OAuth2 PKCE, AWS sigv4, mTLS |
212
231
  | Spec scale | 100+ ops | ~600 ops + polymorphism |
213
232
 
214
233
  ¹ k6 test, contract suite, and `diff`. The generated MCP server leaves OAuth2 for you to wire up.
234
+ ² A login operation in the spec (or in `loadam.config.json`) that returns a token or a session cookie.
215
235
 
216
236
  ## Examples
217
237