Integration & round-trip contract suite - #9
Merged
Conversation
… for runtime allocation, debug, session, and transport logic.
There was a problem hiding this comment.
🟢 Approval recommended
The changes are primarily a well-scoped test-suite consolidation plus a small correctness fix for typed-nil debug errors, with no unreviewed production-risky behavior changes identified.
Pull request overview
This PR introduces a dedicated end-to-end “Universal API integration contracts” suite under test/integration/ to validate the public wire/client ↔ protobuf/gRPC ↔ wire/server boundary using an in-memory bufconn transport and hosted API spies, consolidating prior server-package adapter/transport contract coverage into a single external-consumer harness.
Changes:
- Added a reusable integration
harness(spies, recorder, coordination, and fault injection) plus comprehensive contract tests for runtime/plan/session/debugger behavior, lifecycle, cancellation, allocation/release failures, and connection loss. - Moved/removed legacy
server/*runtime_adapter*_test.gointegration-style tests in favor of the newtest/integrationsuite, and updated docs to point to the new contract coverage. - Fixed debug-event translation to avoid populating
debugger.Event.Errorwith a typed-nil (so successful stopped events keepEvent.Error == nil).
File summaries
| File | Description |
|---|---|
| test/integration/README.md | Documents the new end-to-end contract suite, harness capabilities, and how to run it. |
| test/integration/session_test.go | Adds session overlap/cancellation/reuse and completion-vs-cancel race coverage. |
| test/integration/runtime_test.go | Adds runtime/session output and options round-trip tests plus Runtime.Close ownership semantics. |
| test/integration/release_test.go | Adds contract tests for known release/close failure behavior and sibling preservation. |
| test/integration/plan_test.go | Adds compile/params/options semantics tests and plan/session durability assertions. |
| test/integration/lifecycle_test.go | Adds recursive close and concurrency independence tests (sessions/plans/descendants). |
| test/integration/errors_test.go | Adds sanitization and failure/diagnostics classification contract coverage. |
| test/integration/debugger_test.go | Adds debugger command/inspect/breakpoints/value/evaluate round-trip coverage. |
| test/integration/connection_test.go | Adds handshake unavailable, connection-loss reclamation, and watch termination coverage. |
| test/integration/cancellation_test.go | Adds cancellation propagation and cancellation-vs-allocation contract coverage. |
| test/integration/allocation_test.go | Ports lost-allocation and cleanup escalation tests to the new harness/fault model. |
| test/integration/allocation_race_test.go | Ports allocation cancellation timing and close-once semantics tests to the new harness. |
| test/integration/allocation_fixture_test.go | Introduces shared fixture utilities for allocation-oriented integration tests. |
| test/integration/harness/harness.go | Implements the core harness: server+bufconn setup, runtime creation, cleanup, expected-error handling. |
| test/integration/harness/runtime.go | Adds a hosted api.Runtime spy with option capture and compile/run recording. |
| test/integration/harness/plan.go | Adds a hosted api.Plan spy with session/debug-session creation and recording. |
| test/integration/harness/session.go | Adds a hosted api.Session spy with run/close recording and call indexing. |
| test/integration/harness/debugger.go | Adds a hosted debugger.Session spy with command/inspect/evaluate/breakpoint recording. |
| test/integration/harness/recorder.go | Adds lifecycle/call recorder with snapshots, wait-based assertions, and close-settlement checks. |
| test/integration/harness/options.go | Adds session/compile option capture plus portable-value deep cloning for snapshots. |
| test/integration/harness/failure.go | Adds RPC fault injection (lost/malformed replies, response failures, watch termination) over real RPCs. |
| test/integration/harness/coordination.go | Adds Block/Await utilities for bounded, observable coordination without sleeps/polling. |
| client/remote_debug_event.go | Prevents typed-nil assignment to debugger.Event.Error on stopped events. |
| README.md | Points readers to the new integration contract suite and how to run it. |
| AGENTS.md | Updates the testing-layer guidance to reference the new public round-trip integration suite. |
| server/runtime_optimization_presence_test.go | Adjusts optimization-presence coverage naming/scope to align with reorganized integration testing. |
| server/runtime_release_failure_test.go | (deleted) Legacy server-package integration contract replaced by test/integration/release_test.go. |
| server/runtime_allocation_fixture_test.go | (deleted) Replaced by test/integration/allocation_fixture_test.go + harness. |
| server/runtime_adapter_transport_test.go | (deleted) Replaced by test/integration/connection_test.go + harness. |
| server/runtime_adapter_session_test.go | (deleted) Replaced by test/integration/plan_test.go/session_test.go + harness. |
| server/runtime_adapter_session_fake_test.go | Removes now-unneeded helper used by deleted legacy server adapter tests. |
| server/runtime_adapter_run_test.go | (deleted) Replaced by test/integration/runtime_test.go + harness. |
| server/runtime_adapter_options_fake_test.go | Removes now-unneeded helper used by deleted legacy server adapter tests. |
| server/runtime_adapter_debugger_fake_test.go | (deleted) Replaced by test/integration/debugger_test.go + harness. |
| server/runtime_adapter_debug_test.go | (deleted) Replaced by test/integration/debugger_test.go + harness. |
| server/runtime_adapter_allocation_test.go | (deleted) Replaced by test/integration/allocation_race_test.go + harness. |
Review details
- Files reviewed: 36/36 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…onnectionLoss` utility function, update error handling logic, and introduce new test suite for validating connection loss scenarios.
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.
No description provided.