Repository navigation
feat: route aliases in preload and the JSON log label source, as the Java engine has them - #121
Merged
Merged
Conversation
…Java engine has them The twin of mercury-python #54. preload('hello.declarative, hello.world', options, handler) 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 getTrace().route. FunctionRegistry.register stays single-route, as Platform.register does. The JSON log presentations (json and compact) label the emitting logger "source", as the Java engine's JSON layout does; the value is unchanged. The demo app aliases hello.world onto hello.declarative. npm test: 466 tests, 402 passed, 0 failed, 64 skipped; both driven live. 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
The twin of Accenture/mercury-python#54.
preloadtakes one route name or a comma-separated list:preload('hello.declarative, hello.world', { instances: 10 }, handler)registers the same function under every name withthe 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 fromgetTrace().route, theengines'
my_route.FunctionRegistry.registerstays single-route, as the engines'Platform.registerdoes;splitRoutesis exported beside
validateRoute. The JSON log presentations (jsonandcompact) label the emitting loggersource, asthe Java engine's JSON layout does; the value (a logger's name, or an unnamed logger's call site as
name:line) and thetextpresentation are unchanged. The demo app aliaseshello.worldontohello.declarative. Tests:test/registry.test.ts(6) and
test/log.test.ts(3), both new; docs: the README's function contract, the function-patterns, agent and loggingguides; CHANGELOG Unreleased Added 4 and Changed 5.
npm test: 466 tests, 402 passed, 0 failed, 64 skipped; both driven livethrough
node dist/src/cli.jsand 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, andpreloadtook one route where the engine's annotation and the Rust port's macro take a list of aliases -so one Node.js function could not serve a route the engines' examples reach under two names (
hello.declarativeandhello.world). Both changes mirror the Java engine's behaviour rather than design anything new, in lockstep with the Pythonpack.
🤖 Generated with Claude Code
Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com