Rename the worker idle_time surface to idle — Closes #368 - #369
Merged
conradbzura merged 1 commit intoAug 11, 2026
Merged
Conversation
The surface spelled one concept three ways: the wire RPC and the service handler said idle, the caller-facing method said idle_time, and the message said IdleTime. WorkerConnection.idle now mirrors the RPC it wraps, and the unit stays explicit where it matters: the message's seconds field and the method docstring. The RPC name itself is untouched, so the gRPC method path and the seconds field tag are identical and the change is wire-compatible with v0.14.0-rc0 workers. The surface has only shipped in that pre-release, so renaming the Python API before v0.14.0 final avoids a deprecation cycle. IdleUnavailable keeps its name.
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.
Summary
Unify the worker idle-reporting surface introduced by #253 on the single name
idle. The surface spelled one concept three ways: the wire RPC and the service handler saididle, the caller-facing method saididle_time, and the message saidIdleTime.WorkerConnection.idlenow mirrors the RPC it wraps, and the unit stays explicit where it matters — the message'ssecondsfield and the method docstring.IdleUnavailablekeeps its name.The RPC name itself is untouched, so the gRPC method path is identical and
secondskeeps tag 1. The surface has only shipped inv0.14.0-rc0, so renaming the Python API beforev0.14.0avoids a deprecation cycle.Behavior is unchanged — this is a pure rename, so it adds no tests. The 17 existing tests that exercise the idle surface all still apply and none became stale; twelve were renamed to track the method name, and the five in
test_service.pyneeded no edit at all because they drive the handler throughstub.idle(protocol.Void())and never name the renamed message.Closes #368
Proposed changes
Rename the wire message
Rename
message IdleTimetomessage Idleinwool/proto/wire.proto, so the service readsrpc idle (Void) returns (Idle). Thesecondsfield, its tag, and its comment are unchanged — the message name carries the concept and the field carries the unit. Generated stubs are gitignored and rebuilt by thehatch-protobufbuild hook, so no generated artifact is committed.Rename the protocol re-export
Re-export the message as
wool.protocol.Idlefrom_wire.pyandprotocol/__init__.py, in both the import block and each__all__. Both keep their alphabetical slot, so the diff is one line per list.Rename the connection method
Rename
WorkerConnection.idle_timetoWorkerConnection.idle. The body is untouched: the timeout validation, the channel acquisition, and the mapping ofUNIMPLEMENTEDtoIdleUnavailableand of transient codes toTransientRpcErrorall behave exactly as before. Update the docstring references in theIdleUnavailableandWorkerConnectionclass docstrings, and reflow the two paragraphs the shorter name left ragged.Update the service handler
Point
WorkerService.idleat the renamed message — the return annotation, the constructed response, and the:returns:docstring line. The handler name, its idle accounting, and its monotonic-clock measurement are unchanged.Track the rename through the tests
Update the three test files that named the old symbols: the export list and two message tests in
test_wire.py, six method tests intest_connection.py, and the call sites and names in the integration suite. Test names follow the method's__name__, sotest_idle_time_should_*becomestest_idle_should_*.Test cases
TestExportsIdlewool.protocol__all__TestMessageConstructionIdlemessage is constructed with and without a value0.0TestMessageConstructionIdlemessage is serialized and re-parsedTestWorkerConnectionIdleidleis awaitedTestWorkerConnectionUNIMPLEMENTEDidleis awaitedIdleUnavailableTestWorkerConnectionidleis awaitedIdleUnavailable,TransientRpcError, orRpcErrorper the code, carrying detailsTestWorkerConnectionidleis awaited with that timeoutValueErrorwithout calling the stubTestWorkerConnectionNoneor any positive timeoutidleis awaited with that timeoutVoidrequest and that deadlineTestWorkerConnectionidleis awaitedTestWorkerIdleReportingidleis polled twice with a wait betweenTestWorkerIdleReportingidleis polledTestWorkerIdleReportingidleis polled before and after the drainTestWorkerIdleReportingidleis polled against itIdleUnavailableand not anRpcErrorTestWorkerControlSurfaceidleis polled again after the stopTransientRpcError