Skip to content

Explore deterministic profiling gates for Crabbox runs #280

Description

@zozo123

Problem

Crabbox is good at running a repository's checks in disposable environments, but performance regression gates are still mostly outside its contract. Teams either rely on noisy wall-clock benchmarks on shared CI runners, maintain dedicated benchmarking machines, or skip perf gates because they are too flaky to trust.

This came up while reviewing the closed WASI provider PR (#211). A general WASI provider is probably not a fit for Crabbox's default workload: most repos need a shell, toolchains, subprocesses, sockets, and package managers. But deterministic profiling/perf gates may be a concrete capability where a restricted runtime is not a limitation; it is the feature.

Use case

A repo wants a CI check like:

crabbox run --profile perf -- go test ./parser -bench BenchmarkParse --bench-budget instructions=5000000

or, for wasm-compilable targets:

crabbox run --provider wasi --profile perf --fuel-budget 5000000 -- ./parser.test.wasm

The important outcome is not merely running WASI. The outcome is a reproducible run artifact that can say: this PR increased instruction count, allocations, CPU samples, or another agreed performance metric beyond budget.

Why Crabbox

Crabbox already owns the pieces that make this useful as a product surface:

  • disposable execution environments;
  • normalized run summaries and timing output;
  • artifact capture/publishing;
  • provider-specific execution without making callers learn each backend;
  • policy-style gates that can fail CI.

A profiling gate would turn performance evidence into a first-class run result instead of a pile of provider-specific logs.

Possible shape

Start with a narrow, testable MVP rather than a broad profiler abstraction:

  • Add a profiling/perf evidence mode for crabbox run that records bounded artifacts and a small JSON summary.
  • Support one deterministic metric first, likely instruction/fuel counts for wasm-compilable test binaries where the number is stable enough to gate on.
  • Treat WASI as an implementation detail or specialized target, not as a general replacement for Linux/container providers.
  • Allow later backends to add native profilers (perf, pprof, Instruments, async-profiler, provider timing) behind the same evidence contract if there is demand.

Non-goals

Open questions

  • Is deterministic instruction/fuel metering valuable enough to justify a first profiling gate?
  • Which real repo/workload should be the proving case?
  • Should this be modeled as a provider capability, a run evidence feature, or both?
  • What artifact schema is small enough to review and stable enough for CI?

If the answer is yes, #211 can be treated as prior art for the runtime plumbing, but the product ask should be narrower: reproducible performance evidence and budget enforcement for Crabbox runs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low-risk cleanup, docs, polish, ergonomics, or speculative feature.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:securityThis issue is about security boundaries, credentials, authz, sandboxing, or sensitive data.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions