Repository navigation
feat: route aliases in @preload and the JSON log label source, as the Java engine has them - #54
Merged
Merged
Conversation
… Java engine has them @preload(route="hello.declarative, hello.world") registers the same function under every name with the same instances and visibility - the Java engine's @preload(route = "a.b, c.d") and the Rust port's #[preload]: the value is split on commas and whitespace as the engine splits it, empty segments dropped, every name validated, a repeated name once, no name refused as "missing service route(s)"; a handler reads the alias it was called as from get_trace().route. FunctionRegistry.register stays single-route, as Platform.register does. The JSON log presentations (json and compact) label the emitting logger and line "source", as the Java engine's JSON layout does; the value name:line is unchanged. The demo app aliases hello.world onto hello.declarative. ruff clean, basedpyright 0 errors, pytest 407 passed; both driven live. The Node twin follows in lockstep. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
acn-ericlaw
added a commit
that referenced
this pull request
Nov 16, 2026
…e label, recorded as landed Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
What
@preloadtakes one route name or a comma-separated list:@preload(route="hello.declarative, hello.world")registers thesame function under every name with the same
instancesand visibility - the Java engine's@PreLoad(route = "a.b, c.d")and the Rust port's
#[preload(route = "a.b, c.d")]. The value is split on commas and whitespace as the Java engine splits it(
util.split(route, "[, ]")), empty segments are dropped, every name is validated, a repeated name counts once, and a valuewith no name is refused with the engine's words (
missing service route(s)). Each alias has its own mailbox and workers, itsown startup line and its own
/info/routesrow; a handler reads the alias it was called as fromget_trace().route, theengines'
my_route.FunctionRegistry.registerstays single-route, as the engines'Platform.registerdoes. The JSON logpresentations (
jsonandcompact) label the emitting logger and linesource, as the Java engine's JSON layout does; thevalue (
name:line) and thetextpresentation are unchanged. The demo app aliaseshello.worldontohello.declarative.Tests:
tests/test_registry.py(new, 9) andtests/test_log.py; docs: the README's function contract, the function-patterns,agent and logging guides; CHANGELOG Unreleased Added 4 and Changed 5.
ruffclean,basedpyright0 errors,pytest407passed, 64 skipped; both driven live through
mercury-serveand verified manually against the rest of the Mercury system.Why
Engine consistency is the house style: a polyglot installation reads the four runtimes' logs in one aggregator and declares
its functions the same way in every language. The pack's JSON lines carried the logger under
loggerwhere the Java enginewrites
source, and its decorator took one route where the engine's annotation and the Rust port's macro take a list ofaliases - so one Python function could not serve a route the engines' examples reach under two names (
hello.declarativeand
hello.world). Both changes mirror the Java engine's behaviour rather than design anything new. The Node twin is openedin lockstep.
🤖 Generated with Claude Code
Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com