Skip to content

Commit 8c48bcd

Browse files
committed
Document benchmark safety planning
Update the benchmark manual and CLI help to describe discovery-aware dry runs, DNS-backed target classification, and the narrower unsafe public-target override. Link deployment guidance to fedify bench so staging and CI checks are part of production preparation. #744 #784 Assisted-by: Codex:gpt-5.5
1 parent d63f8ec commit 8c48bcd

4 files changed

Lines changed: 37 additions & 7 deletions

File tree

CHANGES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,13 @@ To be released.
286286
throughput, success rate, and errors, reading server-side metrics from the
287287
target's stats endpoint. Benchmarks are described by a YAML or JSON
288288
scenario suite validated against a published JSON Schema, with an `expect`
289-
block per scenario that gates a run for CI. [[#744], [#783]]
289+
block per scenario that gates a run for CI. The command refuses public
290+
non-`benchmarkMode` targets without an explicit unsafe override, supports
291+
discovery-aware `--dry-run` planning, and ships with a local benchmark
292+
fixture used by the scenario tests. [[#744], [#783], [#784]]
290293

291294
[#783]: https://github.com/fedify-dev/fedify/issues/783
295+
[#784]: https://github.com/fedify-dev/fedify/issues/784
292296

293297
### @fedify/fixture
294298

docs/manual/benchmarking.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ The `# yaml-language-server:` line gives editors autocomplete and validation
151151
against the [published schema].
152152
Override the file's target with `--target`, choose the output with
153153
`--format`/`--output`, and inspect a run without sending anything with
154-
`--dry-run`.
154+
`--dry-run`. A dry run still probes the target's benchmark stats endpoint and
155+
resolves scenario discovery, such as WebFinger and actor inbox lookup, so the
156+
printed plan shows the concrete destinations a real run would use. It does
157+
not send benchmark load.
155158

156159
An `inbox` scenario's `recipient` may be a single value or a list. With a
157160
list, deliveries are rotated across the recipients (and across the synthetic
@@ -241,10 +244,22 @@ belongs in a controlled environment, not a shared CI runner.
241244
### Safety
242245

243246
`fedify bench` runs without friction against a loopback or private target, or
244-
any target that advertises benchmark mode. A public target that does not
245-
advertise benchmark mode is refused unless you pass `--allow-unsafe-target`,
246-
which is mandatory (never prompted) in CI and any non-interactive context. Use
247-
`--dry-run` to print the plan without sending anything.
247+
any target that advertises benchmark mode. Hostnames are classified from their
248+
resolved addresses when possible, and DNS failures are treated as public so the
249+
gate stays conservative. A public target that does not advertise benchmark
250+
mode is refused unless you pass `--allow-unsafe-target`, which is mandatory
251+
(never prompted) in CI and any non-interactive context.
252+
253+
The unsafe override is deliberately narrow. It must be paired with an
254+
explicit `--target` on the command line, and every scenario must set its load
255+
(`rate` or `concurrency`) and `duration` explicitly, either in the scenario or
256+
in suite defaults. This prevents a public run from falling back to built-in
257+
defaults by accident.
258+
259+
Use `--dry-run` as the first step against an unfamiliar target. It performs
260+
the benchmark-mode probe and discovery requests needed to print the planned
261+
WebFinger resources and inbox destinations, but it does not send signed inbox
262+
deliveries or other benchmark load.
248263

249264
### Local targets over HTTP
250265

docs/manual/deploy.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,17 @@ operations across your infrastructure. For production:
12871287

12881288
[OpenTelemetry]: https://opentelemetry.io/
12891289

1290+
### Benchmarking before production
1291+
1292+
Before changing queue backends, federation handlers, or signature-related
1293+
configuration, run [`fedify bench`](./benchmarking.md) against a local or
1294+
staging target that enables `benchmarkMode`. The benchmark command drives
1295+
signed inbox deliveries and WebFinger lookups, reports latency, throughput,
1296+
success rate, and errors, and can gate CI with `expect` thresholds. Do not
1297+
enable `benchmarkMode` on production servers; for an unfamiliar target, start
1298+
with `--dry-run` to resolve discovery and inspect the planned destinations
1299+
without sending benchmark load.
1300+
12901301
### Error reporting
12911302

12921303
For error aggregation, the pattern most Fedify applications use is a

packages/cli/src/bench/command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const benchCommand = command(
7575
dryRun: withDefault(
7676
flag("--dry-run", {
7777
description:
78-
message`Print the normalized plan without contacting the target or \
78+
message`Resolve discovery and print the benchmark plan without \
7979
sending load.`,
8080
}),
8181
false,

0 commit comments

Comments
 (0)