Skip to content

feat: route aliases in @preload and the JSON log label source, as the Java engine has them - #54

Merged
acn-ericlaw merged 1 commit into
mainfrom
feat/route-aliases-and-source-label
Nov 16, 2026
Merged

acn-ericlaw merged 1 commit into
mainfrom
feat/route-aliases-and-source-label

Conversation

@acn-ericlaw

Copy link
Copy Markdown
Collaborator

What

@preload takes one route name or a comma-separated list: @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(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 value
with no name is refused with the engine's words (missing service route(s)). Each alias has its own mailbox and workers, its
own startup line and its own /info/routes row; a handler reads the alias it was called as from get_trace().route, the
engines' my_route. FunctionRegistry.register stays single-route, as the engines' 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) and the text presentation are unchanged. The demo app aliases hello.world onto hello.declarative.
Tests: tests/test_registry.py (new, 9) and tests/test_log.py; docs: the README's function contract, the function-patterns,
agent and logging guides; CHANGELOG Unreleased Added 4 and Changed 5. ruff clean, basedpyright 0 errors, pytest 407
passed, 64 skipped; both driven live through mercury-serve and 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 logger where the Java engine
writes source, and its decorator took one route where the engine's annotation and the Rust port's macro take a list of
aliases - so one Python function could not serve a route the engines' examples reach under two names (hello.declarative
and hello.world). Both changes mirror the Java engine's behaviour rather than design anything new. The Node twin is opened
in lockstep.

🤖 Generated with Claude Code
Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com

… 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
acn-ericlaw merged commit ff4652f into main Nov 16, 2026
5 checks passed
@acn-ericlaw
acn-ericlaw deleted the feat/route-aliases-and-source-label branch November 16, 2026 03:29
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant