fed-sx-m2: Step 4c — route/3 with kernel access + 8 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
http_server:route/3(Req, Cfg, Kernel) is the new extended entry
point: folds the kernel reference (typically the registered
nx_kernel atom) into Cfg as {kernel, Kernel}. route/2 is
unchanged and stays the M1 surface.
The dispatch chain gained Cfg threading all the way down:
dispatch/3 -> dispatch/4 (M, P, F, Cfg)
actor_get/2 -> actor_get/3 (Rest, F, Cfg)
actor_subresource_get/3 -> /4 (Id, Sub, F, Cfg)
actor_outbox_response_for/3 (new) reads :kernel from Cfg and,
when the kernel atom is registered AND the actor exists, renders
'tip: <N>' alongside the actor id in text / JSON / SX content-
negotiated bodies. Unknown actors or unregistered kernels fall
back to the 4a stub.
Inbox / followers / following handlers accept Cfg but ignore it
for now — they layer real state lookup in 4d/4e/Step 5+.
Substrate gotcha logged in the Progress log: try/of/catch around
gen_server:call(nx_kernel, _) deadlocks in this port's scheduler
(probably the catch frame's mask defers reply delivery). The
live kernel_log_tip/2 helper does a bare call + integer guard
instead. nx_kernel_multi.sh already proves bare gen_server:call
into the same kernel works correctly.
8 new cases in next/tests/http_multi_actor.sh (33/33 total):
- route/3 with registered kernel: outbox body includes tip=0
- tip advances after POST publish through route/3 + token map
- unknown actor (ghost) falls back to 4a stub (no tip:)
- unregistered kernel ref falls back to stub
- JSON Accept renders {"outbox":"alice","tip":0}
- SX Accept renders (outbox "alice" :tip 0)
- Bob's outbox tip stays 0 while Alice publishes (per-actor)
- route/2 path unchanged: no tip field in body
Conformance 761/761. 121/121 across 10 Step-4-adjacent suites
(http_multi_actor, http_route, http_publish, http_post_format,
http_marshal, http_publish_fold, http_listen_bif, http_server_start,
nx_kernel_multi, bootstrap_start, actor_lifecycle).
This commit is contained in:
@@ -285,10 +285,21 @@ token; the token now maps to an `:actor_id` rather than a fixed `alice`.
|
||||
No-kernel auth-only path unchanged. The dead M1
|
||||
`expected_token/1` helper is gone. 8 new cases in
|
||||
`http_multi_actor.sh` (25/25 total).
|
||||
- [ ] **4c** — `http_server:route/3(Req, Cfg, Kernel)` — the Cfg
|
||||
carries opaque `:kernel` reference (or accepts the registered
|
||||
`nx_kernel` atom) so per-actor handlers can call
|
||||
`nx_kernel:state_for/1`, `actor_log_state/2`, projections etc.
|
||||
- [x] **4c** — `http_server:route/3(Req, Cfg, Kernel)` is sugar
|
||||
that folds the Kernel reference (typically the registered
|
||||
`nx_kernel` atom) into Cfg as `{kernel, Kernel}`. The dispatch
|
||||
chain gained a Cfg arg threaded all the way to per-actor
|
||||
sub-resource handlers (`dispatch/3` → `dispatch/4`, `actor_get/2`
|
||||
→ `actor_get/3`, `actor_subresource_get/3` → /4). The outbox
|
||||
sub-resource handler now reads `:kernel` and, when the actor
|
||||
exists in the kernel, renders `tip: <N>` in text / JSON / SX
|
||||
variants — proving the plumbing works end-to-end. Unknown
|
||||
actors or unregistered kernels fall back to the 4a stub.
|
||||
`try`/`of`/`catch` around `gen_server:call` deadlocks in this
|
||||
port's scheduler (probably the catch-frame mask defers reply
|
||||
delivery); the live handler does a bare `nx_kernel:log_tip_for/1`
|
||||
+ integer guard instead. 8 new cases in `http_multi_actor.sh`
|
||||
(33/33 total).
|
||||
- [ ] **4d** — Per-actor outbox listing reads from the named
|
||||
bucket's log entries via `nx_kernel:actor_log_state/2`, content-
|
||||
negotiates as today (text / json / sx). `?page=N` pagination
|
||||
@@ -738,6 +749,22 @@ proceed.
|
||||
|
||||
Newest first.
|
||||
|
||||
- **2026-06-06** — Step 4c: route/3 with kernel access.
|
||||
`http_server:route/3(Req, Cfg, Kernel)` folds the kernel
|
||||
reference into Cfg as `{kernel, _}`. Dispatch chain refactored
|
||||
to thread Cfg through to per-actor sub-resource handlers.
|
||||
Outbox handler reads `:kernel` and renders `tip: <N>` (in
|
||||
text / JSON / SX content-negotiated variants) when the actor
|
||||
exists; falls back to the 4a stub otherwise. Substrate quirk
|
||||
found: `try`/`of`/`catch` around `gen_server:call` deadlocks
|
||||
in this port's scheduler — bare call + integer guard works.
|
||||
Inbox / followers / following handlers accept Cfg but ignore
|
||||
it; real state lookup lands in 4d/4e/Step 5+. 8 new cases in
|
||||
`http_multi_actor.sh` (33/33 total). Conformance 761/761.
|
||||
121/121 across 10 Step-4-adjacent suites. **Gotcha** noted
|
||||
for future iterations: avoid try/catch wrapping gen_server
|
||||
calls in this substrate.
|
||||
|
||||
- **2026-06-06** — Step 4b: token -> ActorId map. Cfg's `:tokens`
|
||||
proplist (`[{Token, ActorId}, ...]`) maps bearer tokens to
|
||||
per-actor publishers. `handle_post_activity` threads the
|
||||
|
||||
Reference in New Issue
Block a user