pub trait BenchmarkCases: Sized + Serialize {
// Required method
fn benchmark_cases(ctx: &CaseContext<'_>) -> Vec<NamedCase<Self>>;
// Provided method
fn benchmark_cases_json(ctx: &CaseContext<'_>) -> Vec<NamedCase<Value>> { ... }
}Expand description
Representative inputs of a capability’s input type. Implemented once per input type;
the capability! macro requires it, so a new capability without a benchmark case is a
compile error, not a coverage report.
use majordomus_cli::capability::{BenchmarkCases, NamedCase, CaseContext};
#[derive(serde::Serialize)]
struct Input { limit: u64 }
impl BenchmarkCases for Input {
fn benchmark_cases(_: &CaseContext<'_>) -> Vec<NamedCase<Self>> {
vec![NamedCase::new("default", Input { limit: 10 })]
}
}Required Methods§
Sourcefn benchmark_cases(ctx: &CaseContext<'_>) -> Vec<NamedCase<Self>>
fn benchmark_cases(ctx: &CaseContext<'_>) -> Vec<NamedCase<Self>>
The cases, in a stable order. An empty list means “nothing to benchmark in this repository”, which the coverage check reports as missing.
Provided Methods§
Sourcefn benchmark_cases_json(ctx: &CaseContext<'_>) -> Vec<NamedCase<Value>>
fn benchmark_cases_json(ctx: &CaseContext<'_>) -> Vec<NamedCase<Value>>
The cases as JSON, the shape every runner serialises from.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl BenchmarkCases for AnalysisInput
impl BenchmarkCases for AnnounceInput
impl BenchmarkCases for ArtifactsInput
impl BenchmarkCases for AttachInput
impl BenchmarkCases for CapabilitiesInput
impl BenchmarkCases for ChangelogInput
impl BenchmarkCases for ClassifyInput
impl BenchmarkCases for CommandFilter
impl BenchmarkCases for CommandRequest
impl BenchmarkCases for CompileInput
impl BenchmarkCases for CompletionInput
impl BenchmarkCases for DescribeInput
impl BenchmarkCases for DetachInput
impl BenchmarkCases for DevMilestoneInput
impl BenchmarkCases for DevTaskInput
impl BenchmarkCases for DirectoriesInput
impl BenchmarkCases for EconomicsCheckInput
impl BenchmarkCases for EconomicsExplainInput
impl BenchmarkCases for EconomicsQuery
impl BenchmarkCases for EconomicsRunsQuery
impl BenchmarkCases for Empty
impl BenchmarkCases for EntityInput
impl BenchmarkCases for EnvironmentInput
impl BenchmarkCases for EvidenceClaimInput
impl BenchmarkCases for EvidenceRecordInput
impl BenchmarkCases for EvidenceReportInput
impl BenchmarkCases for EvidenceStampInput
impl BenchmarkCases for EvidenceTestInput
impl BenchmarkCases for majordomus_cli::capability::builtin::environment::ExplainInput
impl BenchmarkCases for majordomus_cli::devcontext::ExplainInput
impl BenchmarkCases for GetDeploymentInput
impl BenchmarkCases for GetInput
impl BenchmarkCases for GraphInput
impl BenchmarkCases for HistoryInput
impl BenchmarkCases for InspectInput
impl BenchmarkCases for IntentBindingInput
impl BenchmarkCases for IntentExplainInput
impl BenchmarkCases for IntentPreflightInput
impl BenchmarkCases for IntentProposeInput
impl BenchmarkCases for IntentRealizationInput
impl BenchmarkCases for IntentRecordInput
impl BenchmarkCases for KnowledgeRecordInput
impl BenchmarkCases for ListInput
impl BenchmarkCases for McpProjectionInput
impl BenchmarkCases for ModelsFilter
impl BenchmarkCases for NextInput
impl BenchmarkCases for ObservatoryEventsInput
impl BenchmarkCases for ObserveInput
impl BenchmarkCases for PackPlanInput
impl BenchmarkCases for PackVerifyInput
impl BenchmarkCases for PlanIssueFilter
impl BenchmarkCases for PlanMilestoneFilter
impl BenchmarkCases for PlanPreviewInput
impl BenchmarkCases for PlanRecordInput
impl BenchmarkCases for PlanTransitionInput
The benchmark cases of the one capability here that writes.
Every case is a refusal, and that is deliberate rather than a gap. A case is executed —
by majordomus bench against this repository, and by the HTTP and MCP suites against a
fixture — so a case that moved an issue would change the plan every time the suite ran,
and a measurement whose cost is a changed record is not a measurement. The runner states
the principle that makes this sound: “a refusal is an answer, and answering is the work
a benchmark exists to measure”, and only Internal is fatal.
The refusal path is also the honest thing to time: it builds the plan, resolves the issue and evaluates the guard, which is everything the write path does except the two syscalls at the end.
The refusal must be a refusal and not a lookup miss. An earlier version named an issue
that could not exist, which answered 404 rather than 422, and tests/http_serve.rs holds
every route to answering its own cases — 200, or 422 for a command that turns a caller
down. Choosing the move from the record keeps the case inside that contract.
So a plan with no issue yields no case, and the handler is not bent to make one: naming
an issue the plan does not have is NotFound whether or not the plan holds other issues,
and a 422 that appeared only when the plan is empty would make the same request’s answer
depend on records it never named. The descriptor declares the requirement conditional on
BenchmarkPrecondition::PlanHoldsAnIssue instead, and coverage reports it inapplicable in
such a repository — and missing, as before, in one whose plan holds an issue.
impl BenchmarkCases for PreflightInput
impl BenchmarkCases for QualityInput
impl BenchmarkCases for majordomus_cli::why::Query
impl BenchmarkCases for majordomus_cli::mesh::page::Query
impl BenchmarkCases for ReasoningExplainInput
impl BenchmarkCases for ReasoningRecordInput
impl BenchmarkCases for ReasoningStatusInput
impl BenchmarkCases for RecoverOrphansInput
The benchmark cases of the capability that sweeps.
Every case is a check, and that is deliberate rather than a gap. A case is executed —
by majordomus bench against this repository, and by the HTTP and MCP suites against a
fixture — so a case that swept would delete this repository’s stray files every time the
suite ran, and a measurement whose cost is a changed store is not a measurement. The
check path is also the honest thing to time: it walks every store, stats every candidate
and reads every publish temp, which is everything the sweep does except the unlink at
the end.
Two cases rather than one because case 92 refuses a declared parameter that no case ever
sets, and because the two thresholds measure different work: the generous one classifies
every stray, the tight one classifies none of them as Live and so reads every file.