)
* build: loosen freed socketry pins and add a pins-lifted canary lane
connectrpc-async's protocol-http1 and io-stream and connectrpc-falcon's
protocol-http1 now follow the floor-and-cap policy, since #82, #83 and #85
removed their private coupling. async moves to >= 2.46.0, < 3 under a new
guarded-coupling tier, justified by #88's require-time finalization probe.
async-http and protocol-http2 stay patch-pinned, with their reasons in the
gemspec and docs/development.md.
The daily, non-gating canary workflow and canary:* tasks lift the remaining
patch pins, run the Async and Falcon upstream contract specs and suites under
wall-clock deadlines, and classify which contract broke.
Refs #68
* fix(canary): fail phases on leftover output holders and keep failure detail
A phase whose command exits while a descendant still holds its output now
stops reading after a short drain grace and fails, and one that exhausts its
deadline while draining reports a timeout. The report script aborts with its
reason instead of ending on a backtrace, and errors raised outside examples
no longer hide the failed example ids.
* fix(canary): attribute each hook error to its own hook
Parse each RSpec hook-error block up to its own backtrace, so an expectation
failure in one hook no longer borrows the error class of a later hook, and
report a failed expectation by its first message line.
* fix(canary): report a multiline hook expectation by its diagnostic
RSpec prints a multiline source snippet before a failed expectation's
diagnostic, so take the first line after the snippet's blank line.
* fix(canary): keep quoted RSpec rerun ids in failure details
RSpec reruns examples that share a location by id and quotes it unless the
shell allows unquoted ids, so accept both forms. Also compare the canary's
full scheduled time with CI's and check that a leftover descendant is gone
after a drain timeout.
Change
Item 3 of the plan in #68 (comment). connectrpc-async and connectrpc-falcon still replace or call some async-http and protocol-http2 hooks, and
CompletionJoinrelies on how Async finalizes tasks. If Async stops calling a task's per-instance#consumeafter clearing its fiber, retirement joins wait forever. The investigation's P9 simulation reproduced that hang. This PR makes those dependencies fail loudly atrequire, before anything can hang. It is the guard that item 5 needs beforeasynccan move from~> 2.46.0to>= 2.46.0, < 3. No gemspec constraint changes here.Boot-time guard (
connectrpc/async/upstream_contract.rb)require "connectrpc/async"now runs two checks once per process:Hook shape checks. Each check covers one hook's defining owner, visibility and parameter shape. Positional parameter names are ignored. There are 25 checks, covering:
Outputprivatestream/passthroughandstart(parent:);read_in_background,synchronizeandcloseon the client and server connections;Client#create_response,Server#each(task:), protocol-http2create_streamandsend_goaway;super(prepare_input,process_data,send_body,send_headers,finish_output,request_window_update) on request and response streams.Hooks that items 1, 2 and 4 (refactor(falcon): stop overriding private HTTP/1 writer and wrapper state #82, refactor(async): use public upstream readers and own the HTTP/2 frame guard #83, refactor(async): own the HTTP/1 client stream #85) removed are not guarded.
Finalization probe. It runs in a dedicated thread with its own
Syncreactor, so it never touches the caller's scheduler or task tree. It checks whatCompletionJoinrelies on, for tasks that end by normal return, by a raised failure and by cancellation:#consumeruns after its fiber is cleared, and the task is finished at that point.#consumeruns again, now finished, when the child ends.Fiber.schedulerfrom inside#consumeruns on a later iteration, after the task's original fiber is dead, and not inline.The whole probe, including reactor teardown and the grace for stopping its thread, has a 5 s budget. Async's own teardown depends on the same node consumption the probe checks, so a broken contract can hang it. In that case
requirestill raises within the budget. The error lists the failures the probe already recorded, then a line naming the step that did not finish and saying that Async could not stop the probe thread. That thread then stays asleep for the rest of the process; it uses no CPU and does not block exit. If the probe crashes, the error names the step that crashed.Every broken contract goes into one
ConnectRPC::Async::UpstreamContractError, which is a private constant likeLifecycleError. The message names each contract, the installed gem version, the versions this package was verified with, and #68. For example, with the P9 simulation:There is no switch to skip the check, because skipping it would bring the hang back.
require "connectrpc/falcon"checks async-httpEndpoint#build_endpointand the protected#tcp_endpointthe same way.Scope. The guards cover the patch-pinned socketry hooks (async-http, protocol-http2) and Async's finalization contract. Falcon's own overrides of the
falcongem (Service#run,Server#accept/#call, and theEnvironmentmethods) are deliberately not guarded.falconfollows the floor policy, so a shape check would fail boot on harmless changes its version range allows.One
CompletionJoin. Falcon's copy is now a private alias ofConnectRPC::Async::Internal::CompletionJoin. The two copies were identical apart from the namespace and the observation ivar. Every join on a task now shares one observation (@connectrpc_async_completion). The Falcon example that checked two independent observers now checks that the Falcon and Async joins share one. The class stays internal; no hosting SPI is added.upstream_contract_spec.rbper gem. Each example pins one upstream behavior, so a pin bump or the future pins-lifted lane (item 6) shows exactly which contract broke:push;create_streambuilding ourRequestStream, and the roles of the stream and connection ivars (@input,@length,@output,@reader,Output@task);@write_frame_guardis never acquired during a real Host/Transport call, so no path bypasses oursynchronize(from refactor(async): use public upstream readers and own the HTTP/2 frame guard #83);gets,read,readpartial,write,flush,close,close_readandclose_write, all of whichHTTP1Streamdefines (from refactor(async): own the HTTP/1 client stream #85).request.bodyisFinishablearoundFixedorChunked, andremaining/lengthmark complete framing;write_bodyreturns after that close (HTTP1ResponseBody#closerelies on this since refactor(falcon): stop overriding private HTTP/1 writer and wrapper state #82).consume_local_windowlets the receive window go negative;send_window_updatewrites before it expands the window;read_in_backgroundandOutput#startrun their first pass before the task handle exists;write_body(nil)on a request emitscontent-length: 0;build_endpointbuilds TLS in the calling process.#consumepropagation;Node#consumethat also hangs teardown;pushthat transfers inline;Refs #68. The issue stays open for items 5 and 6.
Verification
mise run async:verifypassed with 916 examples and 0 failures, andmise run falcon:verifypassed with 404 examples and 0 failures. Both cover specs, build, isolated packages and Go interop. The two correction commits after that change only the contract module, its spec andsurface.json.mise run rbs:check,mise run checkandmise run async:checkpass.retirement_preemption_specrun fails while loading, with theUpstreamContractErrorabove, in 0.8 s. Before this change, the same simulation made 4 joins time out.Node#consume:requireraises after 5.04 s. The error lists the three parent-#consumefailures and the teardown timeout line.verify!disabled, the subprocess examples fail at the error-class assertion.@write_frame_guard, the frame-guard example fails atnot_to include(:upstream).verify!takes 1.2–1.4 ms, including the probe thread and reactor. Hook checks account for about 70 µs of that. There is no per-request cost.Limits:
TESTEDis a hardcoded list. A spec fails if a listed version no longer satisfies the gemspec, so a pin bump has to update the list.require, the probe takes longer. In testing this produced no false failure, because the waiting thread was starved just as much.Written on behalf of jimeh by
claude-opus-5-5usingClaude CodeviaT3 Code.