Skip to content

test: expand coverage for parsers, models, and service internals#9

Merged
ya-luotao merged 2 commits into
mainfrom
claude/test-coverage-analysis-ytgcrd
Jun 17, 2026
Merged

test: expand coverage for parsers, models, and service internals#9
ya-luotao merged 2 commits into
mainfrom
claude/test-coverage-analysis-ytgcrd

Conversation

@ya-luotao

Copy link
Copy Markdown
Owner

Broaden the suite from ~131 to 278 examples, targeting units that
previously had no direct specs:

  • DockerfileParser instruction translation (FROM/RUN/COPY/ENV/CMD, multi-stage
    rejection, line continuations, user/workdir defaults)
  • Response models: ProcessResult, SandboxInfo, EntryInfo/FilesystemEvent, and
    the template/build models (from_hash key normalization, enum mapping)
  • Configuration env-var precedence and validation
  • SandboxHelpers credential/lifecycle/template resolution and envd-version guard
  • Sandbox/Snapshot paginators (token termination, metadata encoding)
  • Error hierarchy and CommandExitError message building
  • WatchHandle, ReadyCmd, DefaultBuildLogger
  • BaseService auth-header/version helpers and EnvdHttpClient error mapping
  • LiveStreamable pid extraction; CommandHandle synchronous/error/disconnect paths

Also wire in opt-in SimpleCov (COVERAGE=true) with branch coverage and a
minimum-coverage gate in spec_helper. Baseline ~82% line / ~60% branch.

https://claude.ai/code/session_01CA6xkCPou4FqQPfFkQVGDz

claude added 2 commits June 16, 2026 19:29
Broaden the suite from ~131 to 278 examples, targeting units that
previously had no direct specs:

- DockerfileParser instruction translation (FROM/RUN/COPY/ENV/CMD, multi-stage
  rejection, line continuations, user/workdir defaults)
- Response models: ProcessResult, SandboxInfo, EntryInfo/FilesystemEvent, and
  the template/build models (from_hash key normalization, enum mapping)
- Configuration env-var precedence and validation
- SandboxHelpers credential/lifecycle/template resolution and envd-version guard
- Sandbox/Snapshot paginators (token termination, metadata encoding)
- Error hierarchy and CommandExitError message building
- WatchHandle, ReadyCmd, DefaultBuildLogger
- BaseService auth-header/version helpers and EnvdHttpClient error mapping
- LiveStreamable pid extraction; CommandHandle synchronous/error/disconnect paths

Also wire in opt-in SimpleCov (COVERAGE=true) with branch coverage and a
minimum-coverage gate in spec_helper. Baseline ~82% line / ~60% branch.

https://claude.ai/code/session_01CA6xkCPou4FqQPfFkQVGDz
from_connect_response's guard delegated non-Hash input to from_hash,
which indexes the value with string keys and raised on nil/String/Array.
Return an empty, successful ProcessResult instead, and cover it with a
regression spec.

https://claude.ai/code/session_01CA6xkCPou4FqQPfFkQVGDz

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR substantially expands the SDK’s spec coverage across parsers, models, and service internals, while also adding optional SimpleCov instrumentation and tightening a small edge-case in ProcessResult.from_connect_response to avoid crashes on invalid inputs.

Changes:

  • Add opt-in SimpleCov (via COVERAGE=true) with branch coverage and a minimum coverage gate.
  • Add/expand unit specs for parsers, models, error classes, and service helper internals (paginators, auth helpers, event streaming, etc.).
  • Fix E2B::Models::ProcessResult.from_connect_response to return an empty successful result for non-Hash input instead of raising.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.

Show a summary per file
File Description
spec/spec_helper.rb Adds opt-in SimpleCov startup and minimum coverage thresholds before requiring e2b.
spec/e2b/template_spec.rb Tightens error message assertions to exact substring checks.
spec/e2b/template_logger_spec.rb Adds unit coverage for DefaultBuildLogger and E2B.default_build_logger.
spec/e2b/services/watch_handle_spec.rb Adds coverage for polling/stop behavior and RPC parameter passing.
spec/e2b/services/live_streamable_spec.rb Adds coverage for PID extraction and disconnect behavior.
spec/e2b/services/envd_http_client_spec.rb Adds coverage for RpcResponse#success? and error/message mapping.
spec/e2b/services/command_handle_spec.rb Adds coverage for delegation, materialized results, exit parsing, and disconnect semantics.
spec/e2b/services/base_service_spec.rb Adds coverage for auth header/user resolution and envd-version gates.
spec/e2b/sandbox_helpers_spec.rb Adds coverage for credential/domain/template/lifecycle helpers and envd-version guard.
spec/e2b/ready_cmd_spec.rb Adds coverage for ready command builders and timeout clamping.
spec/e2b/paginator_spec.rb Adds coverage for paginator token termination and query encoding.
spec/e2b/models/template_models_spec.rb Adds coverage for template/build model from_hash normalization and parsing.
spec/e2b/models/sandbox_info_spec.rb Adds coverage for key mapping, time parsing, and helper methods.
spec/e2b/models/process_result_spec.rb Adds coverage for parsing, streaming accumulation, exit parsing, and non-Hash input behavior.
spec/e2b/models/entry_info_spec.rb Adds coverage for enum mapping and timestamp parsing for entry/filesystem models.
spec/e2b/errors_spec.rb Adds coverage for error hierarchy, metadata fields, and CommandExitError messages.
spec/e2b/dockerfile_parser_spec.rb Adds coverage for Dockerfile instruction translation and constraints (incl. multi-stage rejection).
spec/e2b/configuration_spec.rb Adds coverage for env-var precedence, defaults, debug mode, and validation.
lib/e2b/models/process_result.rb Fixes from_connect_response to safely handle non-Hash input by returning an empty result.
e2b.gemspec Adds simplecov as a development dependency.
CLAUDE.md Documents running specs with coverage enabled and the coverage floor.
CHANGELOG.md Notes the ProcessResult.from_connect_response fix and internal test/coverage additions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ya-luotao ya-luotao merged commit 637cfa8 into main Jun 17, 2026
7 checks passed
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.

3 participants