Summary
Since pet can be run as a JSONRPC server (via pet server), we should have dedicated end-to-end performance tests that exercise the server from a client perspective and measure discovery latency across platforms.
Current State
What exists:
- CI integration tests in
.github/workflows/pr-check.yml across Windows, macOS (x86_64/aarch64), and Linux
- Discovery validation tests in
crates/pet/tests/ci_test.rs that verify discovered environments are correct
- Sample JSONRPC client in
docs/sample.js demonstrating client connection
- Telemetry infrastructure (
RefreshPerformance struct) that tracks timing breakdown by locator
What's missing:
The existing tests validate correctness but don't systematically test performance from a client perspective.
Proposed E2E Performance Tests
Test Categories
-
Server Cold Start Performance
- Measure time from process spawn to first successful JSONRPC response
- Test with various
configure payloads (empty workspace, large workspace, many environment directories)
-
Discovery Latency Tests
- Full machine scan (
refresh with no filters)
- Workspace-scoped discovery (
refresh with searchPaths)
- Kind-specific discovery (
refresh with searchKind)
- Measure and assert on P50/P95/P99 latencies
-
Resolve Performance
- Cold resolve (no cache)
- Warm resolve (with
cacheDirectory populated)
- Batch resolution patterns
-
Concurrent Request Handling
- Multiple
refresh requests (should serialize per existing REFRESH_LOCK)
- Multiple
resolve requests in parallel
- Mixed workload patterns
-
Platform-Specific Baselines
- Windows (x86_64, aarch64)
- macOS (x86_64, aarch64)
- Linux (x86_64, musl, gnu)
Implementation Options
| Approach |
Pros |
Cons |
| Rust integration tests |
Native, can share code with existing tests |
Harder to simulate realistic JSONRPC client |
| Node.js test harness |
Matches VS Code Python extension usage pattern |
Separate test infrastructure |
| Criterion benchmarks |
Rust-native, regression detection built-in |
Doesn't test full server spawn path |
| Hyperfine CLI benchmarks |
Simple, cross-platform |
Limited to CLI, not JSONRPC server |
Suggested Metrics
- Discovery duration (returned in
RefreshResult.duration)
- Time-to-first-environment (elapsed time until first
environment notification)
- Total environments discovered per unit time
- Server startup latency
- Memory usage during discovery (if feasible)
CI Integration
- Add performance test job to
pr-check.yml or separate workflow
- Store results as artifacts for comparison
- Consider GitHub Actions benchmark action for regression detection
- Run on representative matrices (at minimum: Windows, Ubuntu, macOS)
Acceptance Criteria
References
- JSONRPC API spec:
docs/JSONRPC.md
- Sample client:
docs/sample.js
- Existing tests:
crates/pet/tests/ci_test.rs
- Performance telemetry:
crates/pet-core/src/telemetry/refresh_performance.rs
Summary
Since
petcan be run as a JSONRPC server (viapet server), we should have dedicated end-to-end performance tests that exercise the server from a client perspective and measure discovery latency across platforms.Current State
What exists:
.github/workflows/pr-check.ymlacross Windows, macOS (x86_64/aarch64), and Linuxcrates/pet/tests/ci_test.rsthat verify discovered environments are correctdocs/sample.jsdemonstrating client connectionRefreshPerformancestruct) that tracks timing breakdown by locatorWhat's missing:
The existing tests validate correctness but don't systematically test performance from a client perspective.
Proposed E2E Performance Tests
Test Categories
Server Cold Start Performance
configurepayloads (empty workspace, large workspace, many environment directories)Discovery Latency Tests
refreshwith no filters)refreshwithsearchPaths)refreshwithsearchKind)Resolve Performance
cacheDirectorypopulated)Concurrent Request Handling
refreshrequests (should serialize per existingREFRESH_LOCK)resolverequests in parallelPlatform-Specific Baselines
Implementation Options
Suggested Metrics
RefreshResult.duration)environmentnotification)CI Integration
pr-check.ymlor separate workflowAcceptance Criteria
pet serverand communicate via JSONRPCReferences
docs/JSONRPC.mddocs/sample.jscrates/pet/tests/ci_test.rscrates/pet-core/src/telemetry/refresh_performance.rs