Repository navigation
Open
Conversation
… enhanced error handling
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The alpha-runtime integration spans transport lifecycle, cancellation, diagnostics, configuration, and interactive execution, warranting final human review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds Wire runtime support for local Universal API execution while preserving builtin and legacy HTTP modes.
Changes:
- Adds Wire connection, validation, lifecycle, metadata, and execution support.
- Refactors diagnostics, output handling, REPL streams, and runtime cleanup.
- Expands documentation, tests, benchmarks, examples, and CI race coverage.
| File | Description |
|---|---|
README.md |
Documents Wire usage and constraints. |
pkg/runtime/wire_endpoint.go |
Validates local Wire endpoints. |
pkg/runtime/wire_benchmark_test.go |
Benchmarks Wire operations. |
pkg/runtime/unversioned_server_test.go |
Provides legacy handshake fixture. |
pkg/runtime/uapi_metadata_test.go |
Tests metadata and cancellation. |
pkg/runtime/transport.go |
Manages physical transport lifecycle. |
pkg/runtime/source_test.go |
Tests source execution and cleanup. |
pkg/runtime/source_resources.go |
Owns runtime resources. |
pkg/runtime/source_factory.go |
Constructs builtin, Wire, or legacy runtimes. |
pkg/runtime/source_execution.go |
Executes canonical source runtimes. |
pkg/runtime/scripted_runtime_test.go |
Adds runtime test double. |
pkg/runtime/runtime.go |
Routes source execution through the new factory. |
pkg/runtime/runtime_test.go |
Tests Wire factory restrictions. |
pkg/runtime/round_trip_func_test.go |
Adds HTTP transport test helper. |
pkg/runtime/remote.go |
Preserves response-close errors. |
pkg/runtime/remote_version_test.go |
Tests remote version cleanup. |
pkg/runtime/options.go |
Adds Wire options and validation. |
pkg/runtime/metadata.go |
Exposes embedded runtime metadata. |
pkg/runtime/incompatible_handshake_test.go |
Tests incompatible handshakes. |
pkg/runtime/close_func_test.go |
Adds cleanup test helper. |
pkg/runtime/builtin.go |
Adapts builtin execution to UAPI. |
pkg/runtime/builtin_benchmark_test.go |
Expands builtin benchmarks. |
pkg/repl/write_func_test.go |
Adds writer test helper. |
pkg/repl/repl.go |
Adds context-aware, stream-injected REPL execution. |
pkg/repl/read_func_test.go |
Adds reader test helper. |
pkg/repl/metadata_test.go |
Tests REPL metadata behavior. |
pkg/repl/lifecycle_test.go |
Tests REPL cancellation and disconnects. |
pkg/repl/compatibility_test.go |
Covers builtin and legacy REPL behavior. |
pkg/config/store.go |
Loads Wire and explicit configuration state. |
pkg/config/runtime_metadata_test.go |
Tests unbound environment configuration. |
pkg/config/flags.go |
Defines Wire configuration keys. |
Makefile |
Formats example sources. |
internal/testutil/wirehost/version_runtime.go |
Overrides fixture version retrieval. |
internal/testutil/wirehost/tracked_connection.go |
Tracks fixture connections. |
internal/testutil/wirehost/listener.go |
Tracks accepted TCP clients. |
internal/testutil/wirehost/host.go |
Implements the Wire test host. |
internal/diagnostics/recoverable.go |
Classifies recoverable query failures. |
internal/diagnostics/portable_format.go |
Formats portable diagnostic spans. |
internal/diagnostics/diagnostics.go |
Unifies native and portable diagnostics. |
internal/diagnostics/diagnostics_test.go |
Tests diagnostic rendering. |
go.sum |
Updates dependency checksums. |
go.mod |
Adds Wire/UAPI dependencies and upgrades Ferret. |
examples/wire-host/main.go |
Adds a local Wire host example. |
cmd/internal/version/wire_test.go |
Tests runtime version selection. |
cmd/internal/version/version.go |
Reports selected runtime metadata. |
cmd/internal/version/failing_writer_test.go |
Adds output-failure helper. |
cmd/internal/testutil/testutil.go |
Isolates command configuration tests. |
cmd/internal/run/wire_test.go |
Tests Wire run modes and diagnostics. |
cmd/internal/run/run.go |
Preserves output alongside execution errors. |
cmd/internal/run/result_test.go |
Tests output and joined errors. |
cmd/internal/run/failing_close_reader_test.go |
Adds reader cleanup helper. |
cmd/internal/run/array_diagnostics_test.go |
Compares builtin and Wire diagnostics. |
cmd/internal/repl/wire_test.go |
Tests Wire REPL reuse. |
cmd/internal/repl/repl.go |
Passes Cobra IO streams to the REPL. |
cmd/internal/execution/wire_test.go |
Tests Wire option precedence and rejection. |
cmd/internal/execution/runtime_options.go |
Validates assembled runtime options. |
cmd/internal/execution/flags.go |
Registers Wire selection flags. |
cmd/internal/diagnostics/diagnostics.go |
Supports caller-selected diagnostic writers. |
cmd/internal/debug/debug_test.go |
Tests early Wire rejection. |
.github/workflows/build.yml |
Adds tests and race detection to CI. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+97
to
+99
| if ctxErr := connectCtx.Err(); ctxErr != nil { | ||
| err = errors.Join(err, ctxErr) | ||
| } |
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.

This pull request introduces comprehensive support for the Wire runtime in the Ferret CLI, enabling execution against a Universal API runtime via a local TCP endpoint. It adds new configuration flags, updates documentation, and includes extensive testing for Wire-specific behaviors and error handling. The PR also refactors diagnostics output handling and simplifies result writing for command execution. Below are the most important changes:
Wire Runtime Integration and Configuration:
--runtime,--runtime-endpoint,--runtime-connect-timeout) and environment variable overrides, with validation and precedence logic. Wire mode strictly rejects explicit browser and policy configuration. [1] [2] [3]README.mdwith detailed instructions and behavioral notes for using the Wire runtime, including example commands, configuration, and security caveats.Testing for Wire Runtime:
Diagnostics and Output Handling:
PrintErrorTofunction for improved testability and flexibility.run.goto print available output even on error, join multiple errors (execution, copy, close), and direct all error output through the new diagnostics function. [1] [2] [3]Build and Test Pipeline:
Makefile's formatting targets to include theexamplesdirectory.Command Behavior Consistency:
These changes collectively provide robust, well-documented, and thoroughly tested support for executing Ferret scripts via the Wire Universal API, while maintaining clear boundaries with builtin and legacy runtimes.