Skip to content

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

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
Contributor

What

The twin of Accenture/mercury-python#54. preload takes one route name or a comma-separated list:
preload('hello.declarative, hello.world', { instances: 10 }, 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(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 getTrace().route, the
engines' my_route. FunctionRegistry.register stays single-route, as the engines' Platform.register does; splitRoutes
is exported beside validateRoute. The JSON log presentations (json and compact) label the emitting logger source, as
the Java engine's JSON layout does; the value (a logger's name, or an unnamed logger's call site as name:line) and the
text presentation are unchanged. The demo app aliases hello.world onto hello.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 logging
guides; CHANGELOG Unreleased Added 4 and Changed 5. npm test: 466 tests, 402 passed, 0 failed, 64 skipped; both driven live
through node dist/src/cli.js 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 preload took 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.declarative and
hello.world). Both changes mirror the Java engine's behaviour rather than design anything new, in lockstep with the Python
pack.

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

…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
acn-ericlaw merged commit 66ada94 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:30
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