Liking cljdoc? Tell your friends :D

2026-12-01 — An alias that follows the role, and a task the gateway holds itself

A sixth review came as a commit of tests alone, twelve assertions failing in six cases. They made four claims. Three are taken and one is declined.

A compartment nothing furnishes again

The entry before this took __r.gw away from a scratch that outlived a gateway's role when the scratch was next furnished. A session's own scratch is furnished at every eval. A compartment is furnished when it is entered by name, and a session that was standing in one resumes there without that. So the alias stayed in the compartment after the JVM had started again as an instance alone, and by the same route a session standing in a compartment when its JVM became a gateway did not get one.

The alias is now set to what the JVM is before each form evaluated in a scratch namespace, where a scratch's mappings are already brought up to date after a reload. Furnishing does the same thing through the same function.

Removed in one step

The removal read the alias, found it named the fleet's API, and then removed whatever was under the name. A caller who pointed the alias at something else between the two would have lost theirs. Nothing in a session does that unless it is racing a restart of its own JVM, and the reviewer's test has to hold the removal open to get in between. The namespace's alias table is already swapped in one step where an alias is replaced, so the removal is written the same way and applies only while the alias still names what was read.

With that the test no longer reaches the moment it was written to hold open. It passes because nothing calls the function it intercepts, and then points the alias elsewhere after the removal. It still fails if the two-step removal comes back.

A task the gateway holds itself

For ten seconds after it starts, a gateway does not call an unknown handle dead, because a node may not have reported it yet. A task method was held to that as well. In a JVM that stops and starts its gateway, a task in the gateway's own registry whose session had expired was refused in those seconds with the sentence about nodes still attaching, though the registry could answer. A task method is now answered here when this JVM's registry holds the task, after the checks for a retired handle and for one given out under a node's name.

Reaching it takes a session that has been silent for a day, since polling a task keeps its session alive, and a poll in the ten seconds after the restart.

Declined: refusing a node that is null

The tests asked that create-session refuse {"node": null} in every role, as it refuses a number. It does not, and the three tests now say so. A null is how some clients write an argument they are leaving out, and every other argument of every tool here reads one that way. The refusal exists for a request that names somewhere else, so that no session is opened on the wrong machine, and a null names nowhere. A client that writes nulls for what it omits would otherwise be unable to open a session at all.

The part of those tests that asks the same over the stateless wire is kept.

Shown

The whole suite, 316 tests, against each removal alone. The tests are the reviewer's, with the three about a null changed as above and one added for a compartment gaining the alias.

removedfailurestest
setting the alias before each form1a-resumed-scratch-compartment-loses-its-gateway-alias
removing the alias in one step1gateway-alias-cleanup-preserves-a-concurrent-rebinding
answering a held task here2startup-grace-keeps-a-known-local-task-reachable-after-session-expiry

The removals were run before the added test, against 315 tests. Removing the first fails that one too.

Not shown: anything between two JVMs from this checkout.

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close