Repository navigation
Conversation
✅ Deploy Preview for golemcloud canceled.
|
…pers Add OplogView, read-only queries over a public oplog, and OplogShape, the settled-history invariants of golem-worker-executor-tests/tests/AGENTS.md with named exceptions. Replace the local assert_settled_history and terminal_count copies under api/interruption/host, the oplog filters in websocket.rs, and the shared part of the rpc/gc_timed_cleanup.rs check. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
…elpers Add TestWorkerExecutor::restart and restart_with with Teardown, which restart an executor on the same storage with the start function that created it; within, GATE_TIMEOUT and SETTLE_TIMEOUT for waits that name what they wait for; WorkerLogEventStream::wait_for_stdout; and a typed InvocationError from invoke_agent_session with assert_worker_error!. Convert websocket.rs and agent.rs to use them. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386
Add BlobStorageDecorator and DecoratedBlobStorage to the worker-executor test utils. A decorator overrides only the blob-storage operations it changes; every other operation calls the wrapped storage, and the operations that BlobStorageBackend derives from others keep that definition over the decorator. wrap_blob_storage() gives the value of TestExecutorOverrides::wrap_blob_storage. Replace the hand-written BlobStorageBackend wrappers in oplog_unreadable.rs, hot_update.rs, tool_streaming/rdbms_drop.rs, blob_mutation_storage.rs and oplog_blob_archive.rs. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386
Add EmulatedWorkerService, an in-process golem.worker.v1.WorkerService on 127.0.0.1, and TestExecutorOverrides::with_worker_service, which points public_worker_api at it. The executor keeps its production RemoteWorkerProxy, and each start, including restart, attaches the executor to the service. The service forwards DeliverCardTransfer (after the system-only check) and ResumeWorker to the executor, records the card transfers, and can answer a delivered transfer with a lost response. It answers every failure in the response body, so the proxy never retries a call. Replace the LocalCardTransferProxy copies in the permission tests and RecordingWorkerProxy and the accepting card-transfer proxies in api/mod.rs, and remove the connect calls after each start. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386
Add EmulatedRegistryService, an in-process golem.registry.v1 server that answers BatchGetCards, CreateRuntimeCard and RevokeCard from an in-memory card store as the registry does, and TestExecutorOverrides::with_registry, which gives the executor the production CardServiceDefault over a GrpcRegistryService client at it. Replace the hand-written card services in effect_permissions.rs, agent_sdk_go/permissions.rs, agent_sdk_ts/permissions.rs and permission_cards_scala.rs. The TypeScript and Scala tests now register the initial cards of every agent type, because the production card service treats a card that the registry does not have as revoked. The Scala target's wallet now lists its live initial template card, so three expected wallet listings of the Scala scenario include "template". Tell test authors in tests/AGENTS.md to use these test doubles. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386
…er service Move the behaviour of LocalResumeProxy in fork.rs into EmulatedWorkerService, and remove LocalResumeProxy, remote_rpc_preparing_on and the wrap_worker_proxy hook. The executor keeps its production RemoteWorkerProxy for these calls. WorkerServiceOptions::component_owner makes the service answer PrepareWorker and ForkWorker and fill the owner into the start of an InvokeAgentSession. hold_after_resume and lose_resume_response hold or lose the response of a successful resume. session_evidence() gives the RemoteRpcEvidence counters (sessions is renamed session_requests), and remote_rpc() gives a production RemoteInvocationRpc at the service. The service accepts messages up to the 32 MiB default of the real worker service. with_worker_service panics when the overrides already have a worker service, so a helper cannot replace its caller's emulator. The test bodies of fork.rs do not change. worker_initialization.rs gets setup_with_worker_service, and tests/AGENTS.md names the new options. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386
The standalone owner that loses its component tool activation is rejected before acceptance, and a same-key caller of a retained startup failure gets the failure outcome. Both tests checked only the worker error, which either variant of InvocationError carries. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
Add InvocationStartBuilder (executor.invocation(&component, method)) and InvocationSession (executor.open_session(start)) to the worker-executor test DSL. The builder fills the fields that every test start repeats and sets every other field only through a named method, so a converted start sends the same fields as before. The session validates every frame in both directions, sends input, stream ends and output cancellations with the epoch and durable stream IDs of the acceptance, and reads a session to a typed SessionOutcome. Convert the hand-built InvocationStart literals and session loops of rpc.rs, agent.rs, fork.rs, api/mod.rs, hot_update.rs, invocation_context.rs, websocket_crash_probe.rs, permission_admission.rs, tool_result_delivery.rs and standalone_tool.rs, and the DSL's own invoke_and_await_target, invoke_agent_with_key and invoke_agent_session. Move id_target, key_target and start_target_id from agent.rs to the DSL. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
vigoo
force-pushed
the
test-dsl-oplog-shape
branch
from
November 27, 2026 14:38
38ed055 to
f599752
Compare
CrashCheckpointServer and PromiseCheckpointServer replace the tuple-returning start functions of tool_streaming/mod.rs. agent_env(prefix) replaces the hand-built env maps, reach(name) replaces next_*_checkpoint, and CrashCheckpoint::release() replaces sending on the release channel. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
LocalHttpServer::serve(router) binds 127.0.0.1:0, serves the router in the current tracing span and stops the server on drop. The axum stubs of the executor tests outside tool_streaming use it; helpers and fixtures that kept the server task now keep the server. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
Replace the tool_streaming deployment_state fixture and its positional arguments with the ToolDeployment builder in golem-worker-executor-test-utils. The provider name defaults to the stored component name; sites whose stored component name differs set it explicitly. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
Move InvocationStartBuilder, InvocationSession, InvocationError and assert_worker_error! to golem-test-framework, so that the executor DSL and the integration DSL build and read invocation sessions with the same code. TestUserContext opens sessions on the worker service. The reattaching session of the integration tests is now ReattachingSession. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
Replace the make_test_context function chain with a builder, share the domain environment prelude between the HTTP and MCP contexts as DomainEnvironment, and write the per-database test dependencies with per_database_test_context!. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
Replace the 15-field DeploymentCreation literals and the local deployment_creation helpers with deployment_from_plan and struct-update overrides, and build the default deployment of deploy_environment_with with it. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
Add TestExecutorOverrides::configured and TestDsl::invoke_and_await_typed (with a _with_key variant). In websocket.rs, a WebsocketTest fixture and a configurable in-process TestPeer replace the repeated setup and nine copies of a websocket server. Typed results replace raw schema value comparisons, the longest tests run their phases as named functions, related checks are grouped with labels, and the four independent cases of the replacement crash test are now four tests. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
…ion helpers Add ExecutorTest, spawn_invoke_and_await and wait_for_oplog to the executor test utilities, and use ExecutorTest in place of the websocket file's own fixture. In wasi.rs, decode results into typed values, replace hand-made restarts with restart, read oplogs through OplogView, match interrupt and guest failures by their worker error, name the timeouts, and move repeated setup into small fixtures. The longest tests now run in labeled phases. No scenario or check is removed. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
… helpers The first half of rpc.rs covers unary RPC, RPC suspension, RPC memory and durable output streams. Its tests now use the shared test DSL instead of hand-written setup, restarts, timeouts, polling loops and oplog scans. Three helpers are new. wait_for_suspended_unload waits until an agent is suspended and unloaded. OplogView::method_starts finds the starts of a method. OutputLedger records the frames of invocation sessions and checks the output wire contract on each one; four session readers use it instead of their own partial checks. The longest tests put their phases in named functions or labelled steps. Every old assertion is kept, and the rpc tests give the same results. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
…eports Convert the second half of rpc.rs: the input-stream, joined-origin, fork, revert, generated-client, kept-handle and cancellation tests. The tests use ExecutorTest, restart, within with named timeouts, spawn_invoke_and_await, wait_for_oplog and OplogView instead of hand-written setup, spawns, timeouts and oplog scans. OutputLedger checks the output wire contract in the TypeScript guest-ABI and Effect websocket tests. The generated client and reflection reports decode into structs that mirror the guest types. KeptHandle and TsCancelledCall hold the setup shared by the kept-handle and cancellation tests, and scenario loops run each case in a named function. The joined-origin tests match PreviousInvocationFailed instead of its text. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
…t DSL RpcDecorator gives each Rpc method the wrapped Rpc and forwards to it by default, so a test double overrides only the methods it changes. The four hand-written Rpc wrappers in the rpc submodules, and RecordingRpc and FailingRpc, now implement it instead of forwarding every method by hand. Also add TestWorkerExecutor::abort_and_restart for the crash window that aborts a running invocation and restarts the executor, TestWorkerExecutor::committed_oplog, and OplogView::last_index_of and OplogView::invocation_starts. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
The eight tests files under rpc/ now use ExecutorTest, the restart and crash-window helpers, within with named timeouts, and OplogView instead of hand-written setup, restarts, polls and oplog scans. rpc.rs gets helpers the submodules share: snapshot_every_nth_invocation, expect_snapshot_loaded and expect_snapshot_rejected, stored_create_requests, agent_caller, is_rpc_not_found, KeptHandle::keep_with, and TsPromiseId, a derived schema type for TypeScript promise IDs. The duplex websocket crash probe is split into a test with a crash and one without. The completed-invocation cache repair test and the input GC scenario name their phases. The kept-handle deletion tests match the typed invocation error instead of its formatted text. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
…he test DSL StoredOplogView queries the stored oplog that stored_oplog returns: the counts of pending, started and finished invocation entries, the positions of one invocation's entries, and the Create requests. TestWorkerExecutor::send_create_worker and send_prepare_worker send a CreateWorkerRequest and decode the response into its success record or the typed WorkerExecutorError. CALL_TIMEOUT (20 s) joins GATE_TIMEOUT and SETTLE_TIMEOUT. It replaces the local TERMINAL_TIMEOUT of the rpc tests, and the rpc tests read Create requests through StoredOplogView. Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386 Co-authored-by: Amp <amp@ampcode.com>
The worker initialization tests and their invocation receipt and create config admission submodules now use ExecutorTest, restart, within with named timeouts, StoredOplogView and the typed create senders instead of hand-written setup, restarts, timeouts, oplog counts and response decoding. InitializationTest replaces the setup functions that returned tuples. system_create_request builds the create requests, and ConstructorGate waits for the promise index that a constructor prints and completes it. The self-call test ran two independent cases in one loop. It is now two tests: constructor_self_call_is_rejected and constructor_self_schedule_survives_restart. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386
…st DSL TestExecutorOverrides::with_environment_state gives the executor an environment state service, as with_registry and with_worker_service do for their services. TestEnvironmentStateService::deploy_tools and remove_tools publish or remove the tool deployment of a component, keyed by its environment, ID and revision. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386
The tool discovery tests now use DiscoveryTest for their setup, typed calls on HostApiAgent instead of invoke and decode chains, DynamicTool for the one-import MCP fixture, OplogView queries instead of hand-written oplog scans, restart and abort_and_restart instead of dropping and starting the executor, and typed WorkerExecutorError matches for executor failures. The HTTP limit test ran three independent cases in a loop. It is now three tests that call one case function. The three longest tests name their phases as functions and stay single tests, because their final counters cover every phase. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a217cc-8783-7629-823d-c51f30cad386
This branch has not been deployed
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 change adds helpers to the worker-executor test DSL and converts the first tests to use them. It is the start of the readability refactor of the worker-executor and integration test suites. The behaviour of the tests does not change.
The change has eight commits. The first commit adds the oplog-shape helpers. The second commit adds the lifecycle, wait and error helpers. The next three commits add test doubles at the boundaries where the executor leaves its process: blob storage, the worker service and the registry. The sixth commit moves the remote fork, resume, preparation and session paths of the tests to the emulated worker service. The seventh commit adds two typed error checks. The last commit adds the invocation request builder and the raw session helper.
The branch is rebased on
mainafter #4717. #4717 addedgolem_test_framework::dsl::oplog_shape::assert_settled_oplog, which checks the same rules asOplogShape. The first commit removes it and converts its callers (see below).Oplog-shape helpers
Helpers
OplogViewis an extension trait on the slice ofPublicOplogEntryWithIndexthatget_oplogreturns. It only selects entries and never asserts:starts_of(function)gives theStartentries of a host function.call(start)gives aCallRecordwith theStart,End,Cancelled,CompletionDeliveredandCompletionDiscardedentries of one call.invocation(id)gives the started, terminal and settled entries of one invocation.describe()gives a compact rendering for assertion messages.OplogShapechecks the settled-history rules ofgolem-worker-executor-tests/tests/AGENTS.mdin one place:AgentInvocationStartedand exactly one terminal.Starthas exactly one terminal.Start,EndorCancelledof an invocation comes after itsAgentInvocationSettled, or after its terminal when it writes noSettled.AgentInvocationStartedhas its terminal before the next one.A test must name each documented exception, with the call or invocation that it applies to:
crashed_during,left_incomplete_on_drop,settled_by_later_invocationorin_flight. If a test names an exception that does not occur, the check fails. Thus a stale exception cannot hide a regression. The optionsno_background_work,forbidandinvocationskeep the stricter checks that local copies made.assert_settledpanics with#[track_caller].ensure_settledreturns an error, for a test that must run its own cleanup after a failure.Conversions
assert_settled_historycopies underapi/interruption/host/**now callOplogShape. Each copy keeps the entries that it forbade before. Each copy also forbidsAgentInvocationFailednow, because the old copies required anAgentInvocationFinished.terminal_countcopies underapi/interruption/host/**now usecall(start).terminal_count().websocket.rs, the hand-written oplog filters now usecall(start), anddescribe_oplognow usesdescribe().rpc/gc_timed_cleanup.rs, the terminal and positional part ofassert_settled_historynow usesOplogShape. The checks specific to that file stay: nowasm-rpc::dropcall, everySpanClosednames an upsertStart, and the history has a finished invocation.assert_settled_oplogintool_streamingnow callOplogShape, andassert_settled_oplogis removed. Its one rule thatOplogShapedid not have moves intoOplogShape: aStartthat names its invocation, throughdriver,invocation_idorparent_start_index, must end before the terminal of that invocation, also when another invocation started between them.OplogShape. Four tests ofrpc/gc_timed_cleanup.rsleave calls for the next invocation on purpose: cache futures, an RPC future that is never awaited, and a cache-fill destructor. These tests now name those calls withsettled_by_later_invocation. Each test already found these calls and checked that the next invocation ends them. The localassert_settled_historytakes the calls as an argument; its other callers pass none.tests/AGENTS.mdnow tells authors to use the helpers instead of a local copy.Stricter checks
These checks are stricter than the copies that they replace:
StartandEndwith the lastAgentInvocationFinishedin the oplog.OplogShapechecks the position of each entry against the terminal of its own invocation.gc_timed_cleanup.rsrequired at least one terminal perStart. It now requires exactly one, and it checks the position of eachStartand its terminal against the invocation that theStartnames.Cancelledafter its invocation settled.gc_timed_cleanup.rsandgc_heap.rsalready rejected this case.gc_heap.rsandmiddleware_acceptance.rskeep their local checks. They check things that the helper does not check: anEndwithout aStart, and span outcomes.Tests
The affected tests ran with the test files of
mainand with this change, with the same result. The tests are thewebsocket.rstests, theapi::interruption::hostp2, p3, websocket and blob filesystem families, andrpc::gc_timed_cleanup. Tests that need the managed XFS runner are ignored.These tests could not run, because their TypeScript and Effect components were not built:
websocket_echo_tswebsocket_report_loss_ts_public_wrapper_replacementwebsocket_report_loss_effect_joins_initialization_before_replacementts_snapshot_restore_replays_gc_released_clientsLifecycle, wait and error helpers
The second commit converts
websocket.rsandagent.rsto these helpers.Helpers
executor.restart(Teardown::Drop | Shutdown | Release)tears the executor down and starts a new one on the same storage, with the start function and arguments that created it. The executor records them in a private field.start_customizedand its wrappers (start,start_with_snapshot_policy, and the others),start_with_overridesandstart_with_redis_oplog_configrecord them. For other start functions,restartfails before it tears anything down.Dropisdrop(executor).Shutdownisshutdown_and_wait_for_invocation_loops()and thendrop(executor).Releaseisrelease(), which evicts the cached agents and waits until the service graph is released.restart_with(teardown, overrides)starts the new executor with other overrides. A test uses it when the restart changes the overrides on purpose.within(timeout, what, future)ingolem_test_framework::dslistokio::time::timeoutwith an error that names what the test waited for.GATE_TIMEOUT(10s) bounds a wait for a gate the test armed.SETTLE_TIMEOUT(30s) bounds a wait for a state that needs a reconstruction or a full invocation. Other waits use a named constant of their file.WorkerLogEventStream::wait_for_stdout(line, timeout)reads events until one is the stdout line.invoke_agent_sessionreturns the rejection or failure as a typedInvocationErrorinside theanyhow::Error. ItsDisplayis the same text as before, so a test that still checks the text passes.assert_worker_error!(error, pattern [if guard] [, message])checks the worker error of the invocation by its variant.Conversions
websocket.rs: every restart, everytokio::time::timeoutand the stdout loop. Every timeout keeps its value.agent.rs: the restarts, the named timeouts, and the error checks on invocation errors. The new patterns fix the variant and compare the message for equality, so they are stricter than the substring checks they replace. Errors that do not come from an invocation session keep their text check:start_agent,resume, fork, a guestResult<_, String>, and the checks of the multi-languagemethod_failure_test!macro.tests/AGENTS.mdnames the helpers.Two failure modes change, and no scenario changes:
websocket.rsthat timed out panicked throughexpect. It now returns an error that names the permit.websocket.rs, the loop locals (pool,admission) now drop before the executor. The gate and the permit are still dropped explicitly, in the same order as before.Tests
The
websocket.rstests and the Rust-fixture tests ofagent.rsran with the test files of the first commit and with this change, with the same result. Tests that need the managed XFS runner are ignored. These tests could not run, because their TypeScript, Effect and Go components were not built:websocket_echo_ts,websocket_report_loss_ts_public_wrapper_replacement,websocket_report_loss_effect_joins_initialization_before_replacement,ts_snapshot_restore_replays_gc_released_clients, and theagent.rstests on the TypeScript, Effect, Scala, MoonBit and Go fixtures.Test doubles at the executor's service boundaries
Many tests replaced or wrapped an executor service to change one or two operations. These copies were long, and some of them replaced the production code of the call that the test is about. The four commits put the test double at the boundary where the executor leaves its process. The production code on the executor's side of the boundary runs.
Blob storage:
BlobStorageDecoratorBlobStorageDecoratorfor its fault or observation state and overrides only the operations that it changes. Every other operation calls the wrapped storage. The operations thatBlobStorageBackenddefines from other operations keep that definition, built from the decorator's operations, so they reach the changed operations.wrap_blob_storage()gives the value ofTestExecutorOverrides::wrap_blob_storage.DecoratedBlobStorage<D, I>can also wrap a concrete backend, asoplog_blob_archive.rsdoes with the S3 backend.oplog_unreadable.rs,hot_update.rs,tool_streaming/rdbms_drop.rs,blob_mutation_storage.rsandoplog_blob_archive.rs. A wrapper method that did more than delegate keeps its body.Worker service:
EmulatedWorkerServiceRemoteWorkerProxy. In the executor tests nothing listened atpublic_worker_api, so the permission tests replaced the proxy withLocalCardTransferProxycopies and connected them to the executor after each start.EmulatedWorkerServiceis an in-processgolem.worker.v1.WorkerServiceon127.0.0.1.TestExecutorOverrides::with_worker_servicepointspublic_worker_apiat it. Each executor start, includingrestart, attaches the executor to the service, so the connect calls after each start go away.DeliverCardTransferwith the system-only check of the real handler, andResumeWorker, and forwards both to the executor. It records card transfers.WorkerServiceOptionschoose when it records a transfer and whether it delivers it, andlose_response_of_card_transferanswers a delivered transfer with an error.unimplemented.effect_permissions.rs,agent_sdk_ts/permissions.rs,agent_sdk_go/permissions.rs,permission_cards_scala.rs,scope_cards/moonbit.rsandapi/mod.rs, and the users of the accepting proxies inhot_update.rs,instance_layer.rsandtool_streaming/matrix_client_resource_acceptance.rs. Each setup records a transfer at the same time as the copy that it replaces.wrap_worker_proxystays in this commit, becausefork.rsstill uses it. The last commit removes it.Remote paths: the full worker-service emulator
fork.rshadLocalResumeProxy, aWorkerProxythatwrap_worker_proxyput in place of the production proxy. It forwarded resume, fork, preparation and invocation sessions to the executor in process, filled in the component owner, held or lost a resume response, and counted session requests. The last commit removes it,remote_rpc_preparing_onand thewrap_worker_proxyhook, and moves this behaviour intoEmulatedWorkerService. The executor keeps its productionRemoteWorkerProxyfor these calls.WorkerServiceOptions:component_owner(account_id)makes the service answerPrepareWorkerandForkWorker, and fill the owner into the start of anInvokeAgentSession. The real worker service finds the owner of the component; the emulated service gets it as an option. Without it,PrepareWorkerandForkWorkeranswerunimplemented.hold_after_resume(notify): the first successful resume notifies and then never answers. It is the checkpoint of the crash window between resume and its response.lose_resume_response(): the next successful resume answers the internal error "lost fork resume response".session_evidence()givesRemoteRpcEvidence(session_requests,joined_observer_acceptances,resume_attach_requests). The fieldsessionsis renamedsession_requests.remote_rpc(shard_service)gives a productionRemoteInvocationRpcover aRemoteWorkerProxyat the service, for a test that calls an agent of another executor.with_worker_servicepanics when the overrides already have a worker service, so a helper cannot silently replace the emulator of its caller.fork.rsdo not change; only its start helpers change.worker_initialization.rsgetssetup_with_worker_service, andrpc.rsreads the renamed field.Behaviour changes that no test observes:
unimplementedat once. Before, it went to the unused defaultpublic_worker_apiaddress and failed after the connect retries. The executor classifies both failures as transient and retries them in the same way.restart, the service forwards to the new executor. Before, the proxy kept the client of the first executor.Registry:
EmulatedRegistryServiceCardServiceDefault. The permission tests replaced it with hand-written card services that disagreed with production and with each other.EmulatedRegistryServiceis an in-processgolem.registry.v1.RegistryServicethat answersBatchGetCards,CreateRuntimeCardandRevokeCardfrom an in-memory store, as the registry does.TestExecutorOverrides::with_registrygives the executorCardServiceDefaultover a productionGrpcRegistryServiceclient at the service. A test adds the initial cards withadd_card.with_registryreplaces only the registry client of the card service. The executor's shared registry client also serves agent types, resource limits and the issuer lookup, which the service does not answer.effect_permissions.rs,agent_sdk_go/permissions.rs,agent_sdk_ts/permissions.rsandpermission_cards_scala.rs.scope_cards.rs,tool_runtime_bypassandrevert_replay_tailkeep their own card services, because they inject faults and gates at the card-service level.Behaviour changes:
kinds-plain=template,kinds-lent=scope,templateandreceiver-kinds=template. The Go and TypeScript scenarios already expected the template card in the wallet of an agent whose card is live.Tests
The tests that use the converted doubles ran with the test files of the second commit and with this change. Every test had the same result, except the three Scala wallet listings above. These tests ran: the blob-storage tests of the converted files; the permission-card tests on the Effect, TypeScript, Go, Scala and MoonBit fixtures; the card-transfer and fork-lifecycle tests of
api/mod.rs; and the wallet tests ofhot_update.rs,instance_layer.rsandmatrix_client_resource_acceptance.rs.a_manual_update_whose_target_initial_file_does_not_load_fails_only_the_updatefails with and without this change, because of the local environment.The tests that reach the changed start helpers ran with the test files of the fifth commit and with this change, with the same result: the
fork.rstests, and the fork, resume and preparation tests ofrpc.rs,filesystem_snapshots.rs,hot_update.rs,scheduled_durable.rs,scope_cards.rs,tool_streamingandworker_initialization.rs. The tests that readRemoteRpcEvidenceare ignored onmain. With--include-ignored,fork_and_revert_streaming_rpc_join_the_original_remote_invocation,fork_dropping_inherited_rpc_output_does_not_cancel_original_readerandforks_of_agent_rpc_outputs_finish_without_inherited_attachmentsfail with and without this change, with the same error.Typed error checks
Two standalone-tool tests checked only the worker error of a failed invocation. Both variants of
InvocationErrorcarry a worker error. The tests now also check the variant: the owner that loses its component tool activation is rejected before acceptance, and a same-key caller of a retained startup failure gets the failure outcome.Invocation requests and raw sessions
Helpers
executor.invocation(&component, method)gives anInvocationStartBuilder. It always sets the auth context, an anonymous caller, the environment, the component owner and an idempotency key. It sets every other field only through a method:on_agent,on_key,input,input_record,idempotency_key,with_request_key,with_component_id,allow_streams,mode,freshness,caller,fresh_attemptandexpect_fingerprint. Thus a converted start sends the same fields as the literal that it replaces.build()gives the protobuf, so a test that sends an unusual start can still change it.executor.open_session(start)andexecutor.resume_session(resume)give anInvocationSession. The session validates every frame in both directions withInvocationSessionState, as the old loops did.open_unvalidated_sessionandresume_unvalidated_sessionskip the validation, for a test of a frame that the protocol refuses.acceptance,accepted,ready,next,messageandwait_for_result. It sends withsend,send_request,send_unvalidated,send_input,finish_input,end_inputandcancel_output. The stream frames take the epoch and the durable stream ID from the acceptance.collectandcollect_with_outputread to the end and give aSessionOutcomewith the result, the terminal (SessionTerminal::Succeeded,FailedorRejected, with the typedInvocationError) and the output items.InvocationSessionResultExtgivesmethod_resultandfirst_output_stream. The free functionsresume_attach,stream_reference,id_target,key_targetandstart_target_idbuild the other protobuf parts.id_target,key_targetandstart_target_idmove fromagent.rs.Conversions
InvocationStartliterals and session loops ofrpc.rs,agent.rs,fork.rs,api/mod.rs,hot_update.rs,invocation_context.rs,rpc/websocket_crash_probe.rs,tool_runtime_bypass/permission_admission.rs,tool_streaming/tool_result_delivery.rsandstandalone_tool.rs.rpc.rsloses its local session helpersopen_raw_sessionandawait_session_readiness.invoke_and_await_targetandinvoke_agent_with_keybuild their start with the builder, andinvoke_agent_sessionisopen_sessionandcollect.rpc.rs, the oversized opening frame, the lookups without a method,fork.rs'sexpiring_session_requestandworker_initialization.rs.rpc.rs's localreceive_invocation_sessionandinvoke_agent_sessionstill returnResult<_, String>, and their callers still compare the text. A later change of therpc.rstests converts them.Behaviour changes that no test observes:
output_consumer_cancel_after_result_remains_a_valid_terminal_sessiontakes its epoch from the acceptance. The old loop sent the literal1, which is the epoch of the acceptance in that test.invoke_agent_sessionreturns an error for anAttachmentRevokedframe, where it panicked before. Some of its error messages have new text; no test compares them.Tests
mainchanged thegolem:api/oplog@1.5.0WIT, so every test component was built again with the rebased CLI and SDKs.The tests of the converted files, the top-level
tool_streamingtests andtool_streaming::standalone_middlewareran with the test files of the seventh commit and with this change. Every test had the same result, except the fourgc_timed_cleanuptests above, which fail without the first commit's named calls and pass with them. The permission-card tests of the third to fifth commits ran with both test binaries and pass.These tests fail with and without this change, because the built-in tool components were not built again: the
builtin_git_*,builtin_node_*,builtin_javascript_*,builtin_web_fetch_*andgit_network_probe_*tests,typescript_guest_recursive_rm_removes_tool_created_outputand the twopython_sidecartests.Crash and promise checkpoint servers
Helpers
CrashCheckpointServer::start()andPromiseCheckpointServer::start()move the in-process checkpoint servers fromtool_streaming/mod.rsintogolem-worker-executor-test-utils. The protocol, the bind address, the 30 s wait (SETTLE_TIMEOUT) and the error texts do not change.agent_env(prefix)gives the environment that points a component at the server:{prefix}_CRASH_CHECKPOINT_PORTand{prefix}_CRASH_CHECKPOINT_GATE_PORT, or{prefix}_PROMISE_CHECKPOINT_PORT. The empty prefix gives the names without a prefix.reach(name)waits for the next arrival and asserts its name.recv()waits without a timeout or a name check, andtry_next()reads an arrival that is already queued.CrashCheckpoint::release()lets the component continue; dropping the arrival without a release keeps the gate shut.PromiseCheckpointhasnameandoplog_index.JoinHandle, so it ran on after the test; its receiver was already dropped at the same point, so a late announcement failed in both versions.Conversions
tool_streamingtests and their submodules. The hand-built env maps becomeagent_envcalls.typed_tool_output_stream_waits_for_producer_and_is_durable_through_nonidentity_middlewarekeeps its own held-HTTP server. It now sends one localHeldPromiseCheckpointper request on one channel, where it sent two arrivals of the old types on two channels. The two old name checks compared the same string from the same request.held_http_crash_recovery.rsandmcp_stdout.rskeep their own servers, which use a different protocol.Tests
The 166 tests of the converted files ran with the test files of the previous commit and with this change, and every test had the same result. The built-in tool tests above fail in both runs.
middleware_acceptance::output_redaction_preserves_structured_stream_error_and_completed_replayandtrapped_leaf_observers::nested_leaf_trap_notifies_external_caller_while_primary_waits_on_silent_tcpalso fail in both runs.In-process HTTP stubs
Helper
LocalHttpServer::serve(router)binds127.0.0.1:0, serves the router in the current tracing span, and stops the server when the value is dropped.port()andurl(path)give the address.Conversions
tool_streaming. The router stays in the test. Anabort()of the old task becomes adropof the server at the same place. Helpers and fixture structs that returned or held the task now return or hold the server.http/concurrent_recovery.rs, theJoinSetserver ofwasi.rs, the checkpoint server ofmcp_stdout.rs, one inapi/mod.rsand the graceful-shutdown server ofreconstruction.rs.0.0.0.0or127.0.0.1. They now bind127.0.0.1. The components reach them throughlocalhostor127.0.0.1.Tests
The tests of the converted files ran with the test files of the previous commit and with this change, and every test had the same result. The two
oplog_processortests could not run, because theoplog_processor_releasecomponent was not built. The MoonBit custom-scope tests and theexternal_durable_streamtests fail in both runs, because their components were not built again.Tool deployment fixtures
Helper
ToolDeployment::new(account_id, &provider_component)builds theToolDeploymentStateof one provider.tools(definitions)registers each definition with type IDs in definition order, andbound_to(agent_type)binds every registered tool to the agent type. The optionsprovider_name,account_email,deployment_revision,provision_env,config_keys_readable,filesystem_access(tool, access)andshell(tool)set the fields that the old copies set differently.provider_nameto keep the recorded value.Conversions
deployment_statefunction oftool_streamingand its calls. The old function boundcapable-streamingwith filesystem access whenever the deployment registered it. The Rust provider defines that tool, so its calls use the localrust_provider_deployment, which sets the access. The two loops that can deploygolem:bashmarkbashas the shell.deployment_statefunction oftool_runtime_bypass.tool_discovery.rskeeps its own fixture, because it invents tool definitions from names and gives each tool its own component.Tests
A temporary build computed the old and the new deployment at every converted call and asserted that they are equal. The
tool_streamingandtool_runtime_bypasstests ran with it. The assertion found the two calls with the other provider name.Shared invocation sessions
Helpers
InvocationStartBuilderandInvocationSessionmove from the executor test utils togolem-test-framework(dsl::invocation_session).InvocationErrorandassert_worker_error!move with them (dsl::invocation_error). The executor DSL and the integration DSL now build and read invocation sessions with the same code.InvocationStartBuilder::new(component, method, auth_ctx)andfor_tool(component, tool, auth_ctx)set only the method or the tool, the auth context, an anonymous caller, the environment and a fresh idempotency key. The component owner (component_owner), the agent type ID (local_type_ids,agent_type_id), the target (on_agent,on_key,target) and the input (input,input_record,input_value) stay unset until a method sets them. The executor sets the component owner and the type IDs itself, because the worker service sets them in production. So a converted request sends the fields that it sent before.InvocationSession::open(first, validate, connect)starts the session on the RPC thatconnectopens. The executor DSL connects to the executor.TestUserContext::open_sessionandresume_sessionconnect to theInvocationSessionRPC of the worker service.stream_mapping(stream)returns it.keep_unsent_frameskeeps the frames that the session cannot send after the other side completes the RPC, instead of failing. The integration tests need this, because the worker service can complete the call while the test still sends frames.id_target,key_targetandproto_agent_keyreplace the copies inintegration-tests/src/agents.rsand in the executor DSL.Conversions
integration-tests/src/invocation_session.rs: the session that reattaches after a fault is nowReattachingSession, so that its name is different from the sharedInvocationSession. It builds its start requests with the shared builder.tests/api/streaming_rpc.rs:invoke_agent_sessionandTrustedInvocationSessionkeep their signatures and their failure messages, and use the shared session.tests/api/agent_identity.rsuses the shared target helpers.Behaviour
Tests
A temporary build compared each converted integration request with the old literal request, after it replaced the random request key. All requests were equal. The
api::streaming_rpcandapi::agent_identity::ephemeral_grpcintegration tests, thestreaming_session_recoverytests and thefault_matrixrows ran before and after this change with the same result.HTTP test contexts
Helpers
HttpTestContext::builder(wasm_name, package_name)replaces the chainmake_test_context,make_test_context_with_openapi_endpoint,make_test_context_with_filesandmake_test_context_with_files_and_setup.agents(names)adds agent types with the default HTTP options,agent_with(name, options)adds one agent type with its own options,openapi_endpoint(prefix)sets the OpenAPI endpoint prefix,files(agent_type, entries)adds initial files, andbefore_component(setup)runs a step after the domain registration and before the component is stored.build(deps)runs the body of the oldmake_test_context_with_files_and_setup. The defaults are the values that the short functions passed.DomainEnvironment::create(deps)is the prelude that the HTTP and the MCP contexts share: a user without auto-deploy, an application and an environment with security overrides, and the registered domain{environment}.golem.cloud. It returns the user, the application, the environment, the domain and the registry client as named fields.per_database_test_context!(Context, build)writes the threePerWorkerdependenciestest_context,test_context_postgresandtest_context_sqlite.test_rnames a dependency after the path of its type and its tag, so the macro takes the context type as a plain name, and the calling module importsEnvBasedTestDependencies.Conversions
custom_apifiles that wrote the three dependencies by hand, andmcp.rs.custom_api, anddurable_contextinfault_matrix.rs.raw_http_router.rsnamed its dependenciesraw_router_context*. They now have the names from the macro. The tests still name their parameterraw_router_context, becausetest_rresolves a dependency by its type and its tag. Three tests in this file called the old dependency constructor directly to get their own context. They now callbuild_raw_router_context, so each of them still gets its own context.http_test_context.rsis also compiled into thefault-matrixandhttp-handler-lifecycletest binaries, which use only part of the builder. So the builder methods allow dead code, and the macro allows being unused.Tests
The
custom_apitests, thehttp-handler-lifecycletests and thefault_matrixdurable-stream rows ran before and after this change with the same result.Deployments from a plan
Helper
deployment_from_plan(&plan, version)ingolem_test_framework::dslreturns theDeploymentCreationof the environment that the plan describes: the plan's current revision and hash, the version, and no defaults, tools, MCP imports or tool middlewares. A test sets other fields with struct-update syntax, so each override stays visible:DeploymentCreation { publish_tools, ..deployment_from_plan(&plan, "1.0.0") }.DeploymentCreationis agolem-commontype, so a free function is used instead of an extension trait.deploy_environment_withbuilds its default with it.Conversions
DeploymentCreationliterals ofapi/deployment.rs, and the localdeployment_creationandempty_deployment_creationfunctions ofapi/deployment.rs,owner_environment_resolution.rsandgol40_chunk_g_environment_resolution_acceptance.rs.current_revision: Noneand now send the plan's current revision. A temporary build asserted at each of these requests that the plan's current revision isNone. The tests passed with the assertion.current_revision, because it does not come from the plan.fail_with_409_on_hash_mismatchkeeps its literal, because it has no plan.Tests
The
api::deployment,owner_environment_resolutionandgol40_chunk_g_environment_resolution_acceptancetests ran before and after this change with the same result.full_deployment_sqlitefails in both runs when it runs afterfull_deployment_postgres, because both register the fixed domainfull-deployment-test.golem.cloud. It passes alone.Websocket executor tests
Shared helpers
TestExecutorOverrides::configured(f)returns overrides that only change the executor configuration. It replaces the struct literal that setsconfigureand nothing else.TestDsl::invoke_and_await_typed::<T>andinvoke_and_await_typed_with_key::<T>invoke an agent method, wait for the result and decode it withAgentResult::into_typed. They are default trait methods, so the executor DSL and the integration DSL both get them.Conversions in
websocket.rsWebsocketTestis the fixture of the file: a context, an executor and the stored component.startusesstart, andstart_with_connection_limitusesstart_with_overrideswith the pool limit, as the tests did before.TestPeer::start(Accept, PeerScript)replaces nine copies of an in-process websocket server.Acceptkeeps how the old server accepted connections (one connection, a loop that serves each connection inline, or a task for each connection).PeerScriptkeeps what it did on a connection. Each test drops the peer where it aborted the server before.WebsocketAgentkeeps the component, the agent key and the worker of one agent. Itsstart_contentionandcontention_resultmethods replace the repeated invocations of the contention method.connect_persisted_handle,park_contention_receivesandinterrupt_parked_receivesreplace the setup that the reconnect-coordination tests repeated.assert_reports_session_lossreplaces the repeated check ofprobe_report_loss.crash_at_call_endreplacesgate.abort()followed byshutdown_and_wait_for_invocation_loops(); the wait for the gate stays at the call site, because some tests do work between the wait and the crash.SchemaValue::Resultcomparisons and theget_result_error_stringhelper.websocket_report_loss_replacement_connect_and_initialization_crasheslooped over four independent cases. It is now four tests,websocket_report_loss_replacement_{connect,initialization}_crashes_{before,after}_end. Each test states its expected result.Tests
The
websocket::tests ran before and after this change with the same result.WASI executor tests
Shared helpers
ExecutorTestingolem-worker-executor-test-utilsreplaces the file-localWebsocketTest.ExecutorTest::startcreates a context, starts the executor withstartand stores the component unchanged.ExecutorTest::start_with_overridesdoes the same withstart_with_overrides.websocket.rsnow uses it, andstart_with_connection_limit(.., n)becamestart_with_overrides(.., connection_limit(n)).TestWorkerExecutor::spawn_invoke_and_awaitandspawn_invoke_and_await_with_keystart an invocation in a background task and return itsJoinHandle. They clone what the task needs and keep the tracing span.TestWorkerExecutor::wait_for_oplogandwait_for_committed_oplogread the public oplog until a predicate holds and return that oplog. On timeout, the error names what the test waited for and describes the oplog. The committed form commits the oplog before each read, so theStartof a running call becomes visible.Conversions in
wasi.rswasi/linux.rsdoes not change, sowasi.rskeeps the items that it uses under#[cfg(target_os = "linux")].uselines are at the top of the file. Durations are named constants, andwithinreplacestokio::time::timeoutwhere a timeout fails the test.SchemaValueresults. Records decode into structs that mirror the guest types. The decoder reads record fields by position, so the record length checks are removed.executor.restart(Teardown::Drop)replacesdrop(executor)followed by the same start function.p3_wait_for_restart_preserves_recorded_deadlinekeeps the explicit drop and start, because the deadline must expire while no executor runs. A restart stays explicit also where the test drops a server between the two steps.WorkerExecutorError::Runtimewith the interrupt text.failing_workermatchesInvocationFailedandPreviousInvocationFailed, and checks that theirstderrholds the guest's log line and panic message. The guest-returned strings stay substring checks, because they are guest output.OplogViewreplaces the hand-written scans ofStartand terminal entries.WaitProgresscounts theStartandEndof an interrupted wait and the invocations after a boundary.incomplete_startsreturns the openStartentries after a boundary.ClockWithServer(a Clock agent whosePORTpoints to a local server),PoolContentionwithslow_then_fast_server(the two connection-pool tests),SilentFirstTcpServer(the TCP interrupt test),CountingServer,initial_file,config_entryandlisted_nodes.initial_file_p3_parity_implis a constant.Tests
The
wasi::andwebsocket::tests ran before and after this change with the same result.RPC executor tests, part 1
This part changes the first half of
rpc.rs: the unary, suspension, memory and output-stream tests. The input-stream, fork, revert and generated-client tests follow in part 2. The submodules inrpc/do not change.Shared helpers
TestWorkerExecutor::wait_for_suspended_unload(agent_id, timeout)waits until the agent's status isSuspendedand the executor has unloaded it. One timeout covers both waits. Theselect!that proves that the invocation did not finish first stays at the call site.OplogView::method_starts(method_name)returns theAgentInvocationStartedentries of the agent method invocations with that method name. It replaces the hand-written scans that count or find the start of a method.OutputLedgeringolem_test_framework::dslrecords the stream mappings, output items and stream ends that a test reads from one or more sessions. It checks each frame: the producer sequence continues its stream, no item follows the end of its stream, a stream ends once with a sequence equal to its item count, no durable offset repeats, and every frame names the durable stream ID of its mapping, also when the mapping arrives after the frame.ensure_completechecks that every stream with frames was mapped and every mapped stream ended.Conversions in
rpc.rsOutputLedgerreplaces the hand-written wire checks of four session readers. Each reader now checks all the rules, where before it checked a different subset.output_prefix_survives_autonomous_suspensionkeeps two explicit checks that the ledger allows: a stream is mapped before its first frame, and a stream is mapped once.output_prefix_survives_autonomous_suspensionmoves the check of the suspended prefix tocheck_suspended_prefix, and the decoding of the journal toOutputJournal::read.ProducerStreamsderives the durable stream IDs of the producer's records.streaming_output_resume_restores_exact_cursorsnames its four phases. One ledger spans both sessions, so the resumed session must continue each stream from its cursor.ExecutorTest,restart,withinwith named constants,spawn_invoke_and_await_with_key,wait_for_oplog,invoke_and_await_typedandTestExecutorOverrides::configuredreplace the hand-written setup, restarts, timeouts, background invocations and oplog polls.fast_rpc_suspensionholds the RPC suspension settings that three tests repeat.stream_session_records,finished_countandConsumerReadOrdinalsreplace repeated decoding of stream session records and counts of finished invocations.AttemptConflictstay text checks. The executor reports them asInvalidRequest, which names its category only in its text, or through an API that returns only the formatted error.Tests
The
rpc::tests ran before and after this change with the same result. This includes the four session readers that now check the whole output wire contract.RPC executor tests, part 2
This part changes the second half of
rpc.rs: the input-stream, joined-origin, fork, revert, generated-client, kept-handle and cancellation tests. The submodules inrpc/do not change.Conversions in
rpc.rsExecutorTest,restart,withinwith named constants,spawn_invoke_and_await,wait_for_oplog,wait_for_suspended_unloadandinvoke_and_await_typedreplace the hand-written setup, restarts, timeouts, background invocations, oplog polls and result decoding.RELOAD_TIMEOUTnames the wait for an unloaded agent to load again by its own wake-up.OplogViewreplaces the hand-written scans of RPCStartentries, theirEndentries, method starts and invocation starts.WorkerExecutorError::PreviousInvocationFailedinstead of its text.OutputLedgerchecks the output wire contract intypescript_streaming_guest_abi_e2eand in each run ofeffect_concurrent_stream_with_pending_websocket_readers.StreamingRpcReport,TsStreamingRpcReportandReflectionDiscoveryReport. The decoder reads record fields by position and does not check their number, so the record length checks stay.KeptHandle(a caller that keeps an RPC handle to a child, for the five kept-handle tests),TsCancelledCall(the aborted call to a blocked TypeScript agent, for the two cancellation tests),ConsumedInputandwait_for_detached_session.durable_read_case,fork_join_caseandfork_drop_case. The fork cases are ignored tests; they still compile.Tests
The
rpc::tests ran before and after this change with the same result.RPC executor tests, part 3: the
rpc/submodulesThis part changes the eight files in
rpc/. It has two commits.RpcDecorator(first commit)RpcDecoratorgives eachRpcmethod the wrappedRpcasinnerand forwards to it by default. A test double overrides only the methods that it changes.wrap_rpcgives the value forTestExecutorOverrides::wrap_rpc. This is the same shape asBlobStorageDecorator.Rpcwrappers inrpc/andRecordingRpcandFailingRpcnow implementRpcDecorator. The streaming methods keep the default of theRpctrait, as all the old wrappers did.HoldResponseRpcand theRecordingRpcinworker_initialization.rsstill make a new double on each executor start, because their state must start empty after a restart. The other doubles share one double across restarts. Their state was already shared. The sharedRecordingRpc::call_counthas no reader at those sites.abort_and_restartends a crash window: it aborts the test task of a running invocation and restarts the executor. WithTeardown::Shutdown, the executor shuts down before the abort, as the old tests did.committed_oplog,OplogView::last_index_ofandOplogView::invocation_startsreplace repeated commit-and-read steps and oplog scans.Conversions in
rpc/(second commit)ExecutorTest,restart,restart_with,abort_and_restart,spawn_invoke_and_await*,wait_for_committed_oplog,withinwith named constants andOplogViewreplace the hand-written setup, restarts, crash windows, timeouts, oplog polls and oplog scans.rpc.rsgets helpers that the submodules share:snapshot_every_nth_invocation,expect_snapshot_loaded,expect_snapshot_rejected,stored_create_requests,agent_caller,is_rpc_not_found,KeptHandle::keep_withandTsPromiseId.TsPromiseIdis a derived schema type that replaces the hand decoder of TypeScript promise IDs and the copy of its structs ininput_gc.rs.effect_duplex_websocket_crash_continuationran two cases that share nothing in one loop. It is now two tests,effect_duplex_websocket_continuation_without_crashandeffect_duplex_websocket_continuation_with_crash, which call one case function.completed_invocation_cache_drops_repair_inside_next_invocationnames its three phases: the original run, the first repair and the second replay. The phases share state, so the test stays one test.input_gc.rssplits itsscenariointo the run to the snapshot and one check function for each of the two outcomes.WorkerExecutorError::InvocationFailedand theAgentError::Unknownof the stored oplog instead of the formatted error. The refusal is still found in the message of the error, because the executor puts theRpcErrorof the schedule into the trap message.input_gc.rschecks the settled history withOplogShape. It keeps its check that no durable call follows the last finished invocation, becauseOplogShapeapplies that rule to each invocation by its own terminal.eprintln!diagnostics of the replay-barrier and hint probes move into assertion messages.Tests
The
rpc::tests ran before and after this change with the same result, with the split websocket test in place of the old one. Thein_function_retry::,worker_initialization::andinterruption::host::rpctests, which useRecordingRpcandFailingRpc, also ran with the same result.Worker initialization executor tests
This part changes
worker_initialization.rs,invocation_receipts.rsandcreate_config_admission.rs. It has two commits.Stored-oplog queries and create senders (first commit)
StoredOplogViewqueries the stored oplog thatstored_oplogreturns.invocation_countsgives the counts of the pending, started and finished invocation entries.invocationgives the positions of the entries of one invocation.create_requestsgives theCreaterequests. The positions are indexes into the stored oplog, because the stored entries have no oplog index.stored_create_requestsinrpc.rsgoes away.send_create_workerandsend_prepare_workersend aCreateWorkerRequestand decode the response into the success record or the typedWorkerExecutorError. A response without a result fails the test.CALL_TIMEOUT(20 s) joinsGATE_TIMEOUTandSETTLE_TIMEOUT. It replacesTERMINAL_TIMEOUTof therpctests.Conversions (second commit)
InitializationTestreplaces the three setup functions that returned tuples.system_create_requestreplaces the hand-built create requests. A test that needs another field changes it with struct update syntax. The constructor tests and the warm create test keep a request without an idempotency key, as before.ConstructorGatereplaces the four loops that wait for the promise index that the constructor prints, and completes that promise.constructor_self_schedule_survives_restart_but_self_call_is_rejectedran two cases that share nothing in one loop. It is now two tests,constructor_self_call_is_rejectedandconstructor_self_schedule_survives_restart.create_waits_for_constructor_gatenames the phase before the restart ingrpc_create_waits_for_prepared_constructor. The phases share state, so the test stays one test.restart,restart_with,withinwith named constants andExecutorTestreplace the hand-written restarts, timeouts and setup. The recorded-failure test still restarts with the default overrides, as before.WorkerExecutorErrorvalues.AgentCreationFailed.detailsstays a text check, because it carries the message of the guest.Tests
The
worker_initialization::tests ran before and after this change with the same result, with the split self-call test in place of the old one. Therpc::create_crash_window,rpc::held_response_restartandrpc::kept_handletests, which the first commit changes, also ran with the same result.Tool discovery executor tests
This part changes
tool_discovery.rs. It has two commits.Environment-state helpers (first commit)
TestExecutorOverrides::with_environment_stategives the executor an environment state service. It has the same shape aswith_registryandwith_worker_service.TestEnvironmentStateService::deploy_toolsandremove_toolspublish or remove the tool deployment of a component. They take the environment, the ID and the revision from the component.set_tool_deploymentstays for the other keys. The other test files adopt both helpers in their own parts.Conversion (second commit)
DiscoveryTestreplaces the setup that each test wrote by hand.HostApiAgentand the typed calls onDiscoveryTest(all_tools,tool,record_all_tools,recorded_tools,call_tooland its variants) replace the invoke and decode chains. The calls without an idempotency key still send none.DynamicToolreplaces the fixture of one MCP import: the deployment, the observation of the import and the credential of the tool.mcp_serverserves a handler at/mcp. The three longer MCP stubs become named types with the same handler bodies.OplogView::starts_ofandcall(start)replace the scans ofStartandEndentries.recorded_discoveryreplacesassert_recorded_discovery_snapshot. It requires exactly oneEndfor the discovery, where the old code took the first.restartandabort_and_restartreplacedrop(executor)and the next start. In five places, the old code changed the service between the drop and the start. That change now comes before the restart. At each of those points no invocation runs: every invocation returned, or the agent is suspended and resumes only on an explicitresumeafter the start.WorkerExecutorErrorvalues. The executor puts the cause into the message of the agent error, so that message is still a text check. The tool errors that reach the guest asResult<(), String>stay text checks.dynamic_tool_http_limits_apply_before_dispatchran three cases that share nothing in one loop. It is now three tests that callhttp_limit_case:dynamic_tool_per_invocation_http_limit_traps_before_dispatch,dynamic_tool_within_http_limits_dispatches_onceanddynamic_tool_monthly_http_limit_suspends_before_dispatch.tool_discovery_host_filters_and_uses_caller_deployment_scope,dynamic_tool_invocation_replays_committed_response_without_upstream_or_credentialsanddynamic_tool_invalid_params_forces_refresh_to_distinguish_removal_from_exclusionname their phases as functions. Their last checks count the calls of all phases, so each stays one test.Tests
The
tool_discovery::tests ran before and after this change with the same result, with the three limit tests in place of the old one. Themcp_stdout::test, which usesdeployment_stateof this file, also ran with the same result. Thescope_cards::tests, which also usedeployment_state, could not run in the sandbox, because their MySQL container did not start.deployment_statedoes not change.