M12.9: NFR-15 latency bench + matrix completion#4
Merged
Conversation
Adds the NFR-15 enforcement gate and rounds out the acceptance matrix
to cover the directives PRD §5.8.1 calls out by name.
benches/ssh_config_latency.rs (new):
- Criterion harness with two scenarios:
* resolve_typical_user_config: a representative ~30-line user config
spanning every directive Anvil currently honors. Median ~283 µs
on this Windows host.
* resolve_no_match: worst single-file walk (every Host block
inspected, no match → only Global directives returned).
- Hard-fail enforce_budget(): runs 32 cold resolves outside Criterion,
asserts median <= 5 ms, and panics with an actionable message if
exceeded. Surfaces NFR-15 regressions as a CI failure rather than
a Criterion warning.
Cargo.toml: registers the new bench harness.
tests/ssh_config_matrix/*.yaml (new):
- 04_proxy_jump.yaml — ProxyJump captured raw (M13 will spawn).
- 05_proxy_command.yaml — ProxyCommand re-joined with single spaces.
- 06_connect_timeout.yaml — ConnectTimeout / ConnectionAttempts.
- 07_multi_identity.yaml — IdentityFile (multi) accumulates.
- 08_global_then_specific.yaml — Global User wins via first-occurrence
rule even when followed by a more specific Host block.
- 09_specific_then_global.yaml — canonical layout with per-host
overrides at the top and Host * defaults at the bottom.
Tests: existing matrix_walks_pass still green; total now 153 lib +
6 YAML fixtures + 1 matrix harness test + 6 integration tests, 0
failures.
Plan: M12.9 of let-us-plan-on-bright-cosmos.md. No version bump:
benches and matrix YAMLs are dev-only, never shipped in the
published crate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the NFR-15 enforcement gate and rounds out the acceptance matrix for M12.9.
NFR-15 latency bench
benches/ssh_config_latency.rsis a Criterion harness with two scenarios:resolve_typical_user_config— a representative ~30-line user config exercising every directive Anvil currently honors (HostName, User, Port, multi-IdentityFile, IdentitiesOnly, StrictHostKeyChecking, UserKnownHostsFile, the four algorithm directives, ConnectTimeout, ConnectionAttempts, ProxyJump, ProxyCommand, plus a multi-pattern Host with negation).resolve_no_match— worst single-file walk: every Host block inspected, no match found, only Global directives returned.After the Criterion measurement, an
enforce_budget()step runs 32 cold resolves outside the statistical pipeline and asserts the median is ≤ 5 ms per PRD NFR-15. Hard-fails with an actionable message if exceeded — surfaces regressions as a CI failure rather than a Criterion warning.Local result on a Windows host (cold): median 283 µs for
resolve_typical_user_config, 226 µs forresolve_no_match. 17× under the budget.Matrix completion
Six new YAML fixtures under
tests/ssh_config_matrix/cover the directives PRD §5.8.1 calls out by name:04_proxy_jump.yaml—ProxyJumpcaptured raw.05_proxy_command.yaml—ProxyCommandre-joined with single spaces.06_connect_timeout.yaml—ConnectTimeout(seconds →Duration) +ConnectionAttempts.07_multi_identity.yaml— multipleIdentityFilelines accumulate in source order.08_global_then_specific.yaml— globalUserwins via first-occurrence-rule against a later per-host override.09_specific_then_global.yaml— canonical layout: per-host overrides at the top,Host *defaults at the bottom; per-host wins.The existing
matrix_walks_passharness picks them up automatically.Versioning
No version bump: benches and matrix YAMLs are dev-only — never shipped in the published crate's runtime tree. The published surface of
anvil-sshis unchanged.Test plan
cargo fmt --all -- --checkclean.cargo clippy --all-targets --all-features -- -D warningsclean.cargo test --lib --tests --lockedgreen: 153 lib + 1 matrix harness + 6 integration, 0 failures.cargo bench --bench ssh_config_latencycompletes; the embeddedenforce_budget()step does not panic.🤖 Generated with Claude Code