Repository navigation
Primitive event bus, local PostOffice delivery, and the engines' actuator endpoints - #87
Merged
Merged
Conversation
Lock-step with mercury-python (ratified design, Eric 2026-08-23): every invocation reaches a function the same way - a per-route FIFO mailbox consumed by 'instances' worker loops (the parameter becomes faithful; the semaphore is gone). The HTTP host and the local side of PostOffice are thin ingress adapters over the bus. - bus.ts (internal): deliver (RPC, ttl-bounded -> 408; dead-work skip for queued calls whose caller already timed out) and publish (drop-n-forget, 202-shape ack). Worker owns the invocation pipeline: per-delivery trace context, AppException -> portable error envelope, execTime, error logging for un-replied publishes. An in-flight RPC's deadline timer is deliberately referenced (pending work holds the process open, at most until its deadline); an idle bus holds no handles. - PostOffice without an endpoint = local ingress with the engines' semantics: private routes callable in-app (the wire keeps its 403), headers verbatim, reply envelope identical to the remote path; unregistered route -> 404 envelope. With an endpoint: unchanged wire client. - No spill tier, no queue cap (ratified): back-pressure belongs to the tier that owns recovery - the engines' flows and graphs. - Demo gains the local-composition pair (public hello.chain -> private demo.suffix.helper); README documents local calls, faithful private and the workflow boundary; scope statement amended. Pins: test/bus.test.ts - the same eight as the python twin (local RPC public+private, unregistered 404, FIFO order, instances=2 concurrency peak, local 408 + dead-work skip proven, trace chained caller -> entry -> private helper, local send ack). The existing host suite now exercises the bus path. Gates: tests 39/39 (tsc + node:test). Co-Authored-By: Claude Code <noreply@anthropic.com>
Preemptive mirror of the python fixes: the 'absent = drop-n-forget' comment reworded (it parsed as commented-out code), and execute is static (uses nothing from the instance). Gates: tests 39/39. Co-Authored-By: Claude Code <noreply@anthropic.com>
Twin of the python fix: the entry handler's local 'po' shadowed the test's outer 'po' - renamed innerPo. Co-Authored-By: Claude Code <noreply@anthropic.com>
…netes GET /info, /info/routes, /env, /health, /livenessprobe on the Event API host, mirroring the Java ActuatorServices shapes as ported to Rust. Health-check functions are normal registered functions speaking the engines' type=info / type=health contract, listed in mandatory/optional.health.dependencies and called through the event bus; /livenessprobe follows the most recent /health outcome (400 when down, engine parity). VERSION moved to version.ts (single TS-side source). Co-Authored-By: Claude Code <noreply@anthropic.com>
…st assert Co-Authored-By: Claude Code <noreply@anthropic.com>
…or the demo log.format now carries the engines' three presentations: text (default), json (pretty-printed, matching the engine's pretty serializer) and compact (single-line JSONL for log aggregators). The demo app gains examples/resources/application.yml - the engines' resources convention, auto-loaded next to the app file - wiring the demo.health dependency and demonstrating the well-known keys. README quick start teaches the -D override syntax instead of --port. Co-Authored-By: Claude Code <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
Three features that complete the wrapper as a deployable polyglot function host —
lock-step twin of the mercury-python PR:
bus.ts) — the single dispatch pipeline: aper-route FIFO mailbox consumed by
instancesworker loops (thepreloadparameterbecomes faithful). Two operations only:
deliver(RPC, ttl-bounded → the standard408 envelope, with a dead-work skip) and
publish(drop-n-forget, 202-shape ack).The HTTP host and the local side of PostOffice are thin ingress adapters over it.
PostOfficewithout an endpoint delivers through theapplication's own bus (engine semantics):
isPrivatefunctions are callable in-appwhile the wire keeps its 403; headers pass verbatim; trace context chains through
local calls; the reply envelope shape is identical to the remote path.
actuator.ts) —GET /info,/info/routes,/env,/health,/livenessprobeon the Event API port, mirroring the JavaActuatorServicesshapes as ported to Rust. Health check functions are normalregistered functions speaking the engines'
type=info/type=healthinterfacecontract, listed in
mandatory.health.dependencies/optional.health.dependenciesand called through the event bus;
/healthanswers UP (200) / DOWN (400) and feeds/livenessprobe.Supporting:
log.formatnow carries the engines' three presentations —text(default),json(pretty-printed) andcompact(single-line JSONL); a sampleexamples/resources/application.ymldemonstrates the resources convention (the demo nowruns with plain
node dist/src/cli.js examples/demo-app.mjs); version single-sourced inversion.ts.Why
instancesandisPrivateparameters must be faithful, not decorative — withthe bus, worker assignment is real and private functions are reachable in-app through
PostOffice, exactly like an engine
pocall.back-pressure belongs to the tier that owns recovery, the engines' flows and graphs; a
leaf host fails fast by deadline. Node-specific lifecycle ruling: an in-flight RPC's
deadline timer is deliberately referenced — pending work holds the process open, at
most until its deadline — while an idle bus holds no handles.
surface — one probe wiring and one dashboard shape across Java, Rust, Python and
Node.js apps, with the same health-function contract developers know from the engines.
Verification
tsc+node --test): 8 bus pins (FIFO order, instances=2 concurrency, local408 + dead-work skip, private reachability, trace chain), 10 actuator pins (all five
shapes, liveness-follows-health round trip, optional-failure-never-downs, engine
elapsed-time/origin format vectors).
hello.chaincalls the privatedemo.suffix.helperthroughthe bus; direct wire call to the private route → 403.
/healthUPwith the full
demo.healthdependency entry;-Dlog.format=compactemits JSONL.Co-Authored-By: Claude Code noreply@anthropic.com
🤖 Generated with Claude Code