Skip to content

SDK design improvements: fold operator surface into @benchsdk/runner and add ergonomics/observability - #375

Open
dtice25 wants to merge 35 commits into
masterfrom
devin/1787847959-benchsdk-operator-runner
Open

SDK design improvements: fold operator surface into @benchsdk/runner and add ergonomics/observability#375
dtice25 wants to merge 35 commits into
masterfrom
devin/1787847959-benchsdk-operator-runner

Conversation

@dtice25

@dtice25 dtice25 commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR implements the SDK-design improvements we discussed: @benchsdk/runner is now the canonical operator package, @benchsdk/client is a compatibility re-export shim, and a set of ergonomics/observability/validation fixes round out the surface.

Breaking

  • TaskStepOptions.concurrency is renamed to parallelInvocations to avoid ambiguity with config.concurrency (max in-flight tasks). The old field is still accepted and logs a one-time deprecation warning.
  • runWorker is now a free function: runWorker(client, options). The legacy createBenchmarkClient().runWorker(options) spelling is preserved in @benchsdk/client.

Added

  • runBenchmarkWorker(options) one-shot operator helper in @benchsdk/runner — run a single participant's worker without a *.bench.ts file.
  • bench check <file.bench.ts> CLI command validates env vars, API connectivity, participant availability, and scoring weights before a run.
  • validateBenchmarkConfig(config) returns structured { field, message }[]; defineBenchmarkConfig throws BenchmarkConfigError with the same shape.
  • defineOnComplete(handler) helper for typed onComplete callbacks.
  • RunWorkerOptions.processKey now defaults to os.hostname().
  • RunWorkerOptions.onTelemetryError / BenchmarkReporterConfig.onTelemetryError callbacks expose heartbeat/log-upload/artifact telemetry failures.
  • TaskError now includes step, timeoutMs, and participant context for step timeouts.

Fixed

  • Worker telemetry failures now emit console.warn by default instead of failing silently.
  • Step timeout diagnostics now include the step name, configured timeout, and participant name.
  • @benchsdk/client public API contract test now derives the expected type/value surface from @benchsdk/runner rather than a hand-maintained list.

Package boundaries

  • @benchsdk/client now depends only on @benchsdk/runner and re-exports its entire surface. createBenchmarkClient is a thin wrapper that attaches the legacy runWorker method.
  • @benchsdk/runner re-exports the low-level worker/API primitives (runWorker, BenchmarkReporter, createBenchmarkClient, etc.) so operators can import from one package.

Verification

  • pnpm typecheck passes.
  • pnpm --filter @benchsdk/runner test passes (96 tests).
  • pnpm --filter @benchsdk/client test passes (122 tests).
  • pnpm exec bench run examples/*.bench.ts --dry-run and pnpm exec bench check examples/*.bench.ts --dry-run pass for all examples.

Link to Devin session: https://app.devin.ai/sessions/f67b6ba526fe43619684b90f0d19e045
Open in Devin Desktop: https://app.devin.ai/desktop/session/f67b6ba526fe43619684b90f0d19e045?variant=devin
Requested by: @dtice25


Devin Review

… bench check, telemetry observability, config validation, and diagnostics

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@open-cla

open-cla Bot commented Aug 27, 2026

Copy link
Copy Markdown

Contributor License Agreement

All contributors are covered by a CLA.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1787847959-benchsdk-operator-runner branch from 4094563 to d43f867 Compare August 27, 2026 17:01
…and improved error pretty-printing

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

dtice25 and others added 2 commits August 27, 2026 18:37
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

dtice25 and others added 8 commits September 3, 2026 15:02
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

Devin Review found 1 new potential issue.

🐛 1 issue in files not directly in the diff

🐛 Scale image build loses dependencies

pnpm install --frozen-lockfile cannot link the omitted runner workspace required by @benchsdk/client. The runner also requires the omitted CLI workspace, so scale image builds stop before bundling.

9 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

dtice25 and others added 2 commits September 8, 2026 17:54
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

- runCheck now validates task export, parses providers with parseCliArgs, forwards --config, and supports --base-url/--api-key.

- runBenchmarkFile strips --base-url/--api-key before passing flags to runBenchmark.

- validateBenchmarkConfig enforces compositeScore defaultMetric requires scoring/onScore.

- Telemetry error callbacks are wrapped in try/catch; system-metrics upload errors are reported via handleTelemetryError.

- shiftFlag rejects missing values so control flags are not consumed.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1787847959-benchsdk-operator-runner branch from 1d0f630 to 3935de3 Compare September 8, 2026 19:43
dtice25 and others added 2 commits September 8, 2026 19:50
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

dtice25 and others added 3 commits September 8, 2026 20:03
… --dry-run

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… original error

- Stop splicing pending records before a successful send; on API failure the
  batch is kept so the next flush can retry.
- Track the original flush error and rethrow it from the final flush so
  runWorker still fails with BenchmarkApiError.
- Remove the lowercase-slug regex from benchmarkSlug validation so existing
  benchmarks using DAILY_BENCH_SLUG env values (uppercase/underscores) are not
  rejected.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Add README for @benchsdk/cli documenting auth/config, env vars, and commands.
- Make printData honor --format table for objects and add unit tests.
- Re-export resolveAuth/createApiClient/AuthError/CliAuth from @benchsdk/runner.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

…dard

- @benchsdk/cli printData now prints 'No results.' for empty objects.
- @benchsdk/runner validates bench.config.ts/.benchrc values and removes apiKey from project config in favor of apiKeyEnv.
- @benchsdk/worker invokes onTelemetryError for completeWorker/failWorker failures in the normal completion path.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

dtice25 and others added 2 commits September 8, 2026 21:15
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

… and bench check flag parsing

- validateBenchmarkConfig no longer crashes when phases/participants/shapes entries are null or primitives

- bench check now uses shiftFlag for --base-url/--api-key with required-value semantics

- add regression tests for malformed phases, participants, shapes, and valueless check flags

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

dtice25 and others added 3 commits September 8, 2026 22:01
…requiredEnvVars

- Make BaseParticipant.requiredEnvVars optional and normalize missing/non-array values to an empty list.

- Add unit tests for filterParticipantsByEnv and selectParticipants.

- Update changeset.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ics 'importing' status

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

… and reject --config consuming flags

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant