test: expand coverage for parsers, models, and service internals#9
Merged
Conversation
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
There was a problem hiding this comment.
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_responseto 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Broaden the suite from ~131 to 278 examples, targeting units that
previously had no direct specs:
rejection, line continuations, user/workdir defaults)
the template/build models (from_hash key normalization, enum mapping)
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