|
| 1 | +# Session (2026-08-23T03:15:58.000Z) |
| 2 | + |
| 3 | +**Agent:** Claude Code |
| 4 | + |
| 5 | +Actuator endpoints on `feature/primitive-event-bus` — Eric's directive right after the |
| 6 | +bus landed: the wrapper apps deploy as Kubernetes PODs, so they need the engines' |
| 7 | +operational surface. Commits `56c002c` (feature) + `a674198` (IDE/Sonar round). |
| 8 | +Node twin: `342a854` + `7a8b12c` (see mercury-nodejs memory, same-day log). |
| 9 | + |
| 10 | +## What shipped |
| 11 | + |
| 12 | +- `actuator.py`: GET `/info`, `/info/routes`, `/env`, `/health`, `/livenessprobe` on the |
| 13 | + Event API port. Response shapes mirror the Rust engine's actuator — itself the |
| 14 | + maintainer-approved minimalist port of Java `ActuatorServices` — so DevSecOps sees one |
| 15 | + surface across the estate: `/info` = `{app{name,version,description}, |
| 16 | + runtime{language,python,mercury_composable}, origin, time{start,current}, up_time}`; |
| 17 | + `/info/routes` = `routing.public/private` (route → instances, sorted); `/env` = opt-in |
| 18 | + `show.env.variables` / `show.application.properties` (absent env var → `""`); |
| 19 | + `/health` = dependency entries `{route, required, …info map, status_code, message}`, |
| 20 | + UP 200 / DOWN 400 (Java parity), teaching message when no dependencies configured; |
| 21 | + `/livenessprobe` follows the most recent health outcome (`OK` / 400 |
| 22 | + `Unhealthy. Please check '/health' endpoint.`). |
| 23 | +- **Health check functions = normal registered functions speaking the engines' interface |
| 24 | + contract (Eric's mid-session ruling, matching my derivation):** called through the |
| 25 | + event bus with header `type=info` (advisory identity map, merged into the entry) then |
| 26 | + `type=health` (non-200 = down); listed in `mandatory.health.dependencies` / |
| 27 | + `optional.health.dependencies` (optional never affects overall status); unregistered |
| 28 | + route → 404 `Please check - Route X not found`; DeliveryTimeout → 408 |
| 29 | + `Please check - Timeout for 10000 ms`. Engine timeouts kept (info 3 s, health 10 s). |
| 30 | +- Engine formats verbatim: origin = UTC `yyyyMMdd` + 32-hex uuid (the JAVA reference |
| 31 | + format — the Rust port simplified to a bare uuid, so the wrappers follow the |
| 32 | + reference); `elapsed_time` with the engines' strict `>` boundary quirks (60 s → |
| 33 | + "60 seconds", 3600 s → "60 minutes") — pinned with the same vectors the Rust port pins. |
| 34 | +- Deliberate wrapper-scale deltas, documented in the module docstring: no `/info/lib` |
| 35 | + (no runtime dependency manifest — deferred on the Rust port too), no XML responses, |
| 36 | + no 5-second info cache (dependencies are in-process functions). |
| 37 | +- `version.py` becomes the single Python-side version source (`__init__` re-exports) — |
| 38 | + breaks the actuator → `__init__` import cycle. |
| 39 | +- The pre-release `/health` "OK" scaffolding endpoint is replaced by the real one. |
| 40 | +- IDE/Sonar round (Eric's screenshots): four S7503 async-without-await handlers → ONE |
| 41 | + async `handle()` dispatcher (awaits the `/health` branch; constant endpoints render |
| 42 | + synchronously) — the python Actuator now mirrors the node twin's dispatcher shape; |
| 43 | + `app_origin` adopts the local-narrowing pattern (checkers don't narrow module |
| 44 | + globals); "health check" spelling (Grazie); S5863 self-compare fixed in the origin |
| 45 | + test; the `handle_livenessprobe` name (typo dictionary) dissolved by the dispatcher. |
| 46 | + |
| 47 | +## Verification |
| 48 | + |
| 49 | +- 49/49 pytest (10 actuator pins: five shapes, liveness-follows-health round trip, |
| 50 | + optional-failure-never-downs, teach-message, elapsed/origin format vectors), ruff |
| 51 | + clean, basedpyright 0 — re-run after the Sonar round. |
| 52 | +- Live drive: `mercury-serve examples/demo_app.py --port 8399 |
| 53 | + -Dmandatory.health.dependencies=demo.health` → all five endpoints engine-shaped; |
| 54 | + `/health` UP with the full `demo.health` dependency entry; node twin symmetric on 8398. |
| 55 | +- `examples/demo_app.py` gained `demo.health` (private, contract-speaking); README |
| 56 | + "Actuator endpoints" section (+ K8s wiring: livenessProbe → `/livenessprobe`, |
| 57 | + readinessProbe → `/health`); CHANGELOG entry. |
| 58 | + |
| 59 | +## Follow-up round (Eric's three asks, commit `7d5ca6c`; node twin `8ed4266`) |
| 60 | + |
| 61 | +- **`log.format` gains `compact`** — the engines' third presentation. Verified against |
| 62 | + the Java engine's own appenders (`JsonAppender` = Gson pretty serializer, |
| 63 | + `CompactAppender` = single-line serializer, same data map): so wrapper `json` is now |
| 64 | + PRETTY-PRINTED (indent 2) and `compact` is the single-line JSONL the old `json` |
| 65 | + emitted. Pinned: json has newlines, compact has none, both parse to the same entry. |
| 66 | +- **Sample `examples/resources/application.yml`** (both wrappers) — the engines' |
| 67 | + resources convention, auto-loaded by the CLI's next-to-app fallback: demo-app |
| 68 | + identity, port (8086 py / 8087 node), `mandatory.health.dependencies: demo.health`, |
| 69 | + opt-in /env lists, log keys. The demo now runs with plain |
| 70 | + `mercury-serve examples/demo_app.py` — no flags. |
| 71 | +- **README `-D` syntax** — quick starts teach `-Drest.server.port=8086` (engine syntax) |
| 72 | + instead of `--port`; the `--port`/`--config` CLI flags remain as conveniences. |
| 73 | +- Live drives re-run through the yml on both wrappers: /health UP under the demo-app |
| 74 | + identity, /env shows the opted-in keys, `-Dlog.format=compact` emits JSONL. Gates: |
| 75 | + 50/50 pytest + ruff + basedpyright 0; node 48/48. |
| 76 | + |
| 77 | +## Memory References |
| 78 | + |
| 79 | +- created: thread-actuator-endpoints |
| 80 | +- referenced: thread-primitive-event-bus, bp-publish-interop-gate, vision-mercury-python |
0 commit comments