fed-sx-m2: Step 1b — nx_kernel multi-actor gen_server calls + 9 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 34s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 34s
New gen_server exports add_actor/3, publish_to/2, log_tip_for/1, actors/0, state_for/1, bucket_for/1, with_projections_for/2 — each is a thin gen_server:call delegating to 1a's pure-functional bucket API via fresh handle_call branches. Existing single-actor calls (publish/1, log_tip/0, with_projections/1) route through bucket 0 unchanged. Per-actor mailbox sharding (one gen_server per bucket so distinct- actor publishes don't serialise on a single mailbox) is forward- looking — deferred to Step 4 where the per-actor HTTP routing makes it actually load-bearing. Single-mailbox serialisation is fine for Steps 1-3. nx_kernel_multi.sh extended from 17 to 26 cases (gen_server load, start_link bucket-0 seed, add_actor/3 dup detection, publish_to/2 per-actor isolation, interleaved publishes, no_actor error, state_for + with_projections_for round-trips). 134/134 across 12 nx_kernel- adjacent + http suites. Erlang conformance 761/761 preserved.
This commit is contained in:
@@ -132,14 +132,18 @@ actors.
|
||||
the substrate; local `has_keyed`/`find_keyed`/`set_keyed`/
|
||||
`set_bucket` helpers handle the keyed-list ops.
|
||||
`next/tests/nx_kernel_multi.sh` 17/17.
|
||||
- [ ] **1b** — Multi-actor gen_server. `start_link/3` still works as
|
||||
the single-actor entry; add `add_actor/3` (gen_server call,
|
||||
bumps bucket), `publish_to/2(ActorId, Request)`, `log_tip_for/1`,
|
||||
`actors/0`, `state_for/1`, `with_projections_for/2`. Existing
|
||||
`publish/1`/`log_tip/0`/etc route through bucket-0 unchanged.
|
||||
Concurrent publishes to distinct actors don't serialise across the
|
||||
mailbox (multiple casts queued before each is processed). New tests
|
||||
extend `nx_kernel_multi.sh` with 6-8 gen_server-mediated cases.
|
||||
- [x] **1b** — Multi-actor gen_server. `start_link/3` still seeds
|
||||
bucket 0; new exports `add_actor/3`, `publish_to/2(ActorId,
|
||||
Request)`, `log_tip_for/1`, `actors/0`, `state_for/1`,
|
||||
`bucket_for/1`, `with_projections_for/2` delegate to the pure-
|
||||
functional bucket APIs via fresh `handle_call` branches. Existing
|
||||
`publish/1`/`log_tip/0`/`with_projections/1` route through bucket
|
||||
0 unchanged. Per-actor mailbox concurrency (one gen_server per
|
||||
bucket so distinct-actor publishes don't serialise) is forward-
|
||||
looking — deferred to Step 4 (multi-actor HTTP routing) where it
|
||||
actually pays off. `nx_kernel_multi.sh` extended with 9 gen_server
|
||||
cases (26 total), every M1 nx_kernel-adjacent + http suite still
|
||||
green (134 / 134 across 12 suites).
|
||||
|
||||
**Acceptance:** `bash next/tests/nx_kernel_multi.sh` passes 12+ cases.
|
||||
|
||||
@@ -676,6 +680,19 @@ proceed.
|
||||
|
||||
Newest first.
|
||||
|
||||
- **2026-06-06** — Step 1b: gen_server multi-actor calls.
|
||||
`nx_kernel` exports `add_actor/3`, `publish_to/2`, `log_tip_for/1`,
|
||||
`actors/0`, `state_for/1`, `bucket_for/1`,
|
||||
`with_projections_for/2` — each is a `gen_server:call` delegating
|
||||
to the pure-functional bucket API from 1a. Existing single-actor
|
||||
calls untouched. `nx_kernel_multi.sh` extended with 9 gen_server
|
||||
cases (26 total); 134 / 134 across 12 nx_kernel-adjacent + http
|
||||
suites. Conformance 761/761 preserved. Per-actor mailbox sharding
|
||||
noted as forward-looking — current single gen_server serialises
|
||||
publishes across actors, which is fine for Steps 1-3 (single-actor
|
||||
HTTP endpoints) and is naturally untangled by Step 4's per-actor
|
||||
routing.
|
||||
|
||||
- **2026-06-06** — Step 1a: per-actor bucket refactor of `nx_kernel`.
|
||||
State shape now `[{actors, [{Id, Bucket}, …]}, {next_actor_seq, N}]`;
|
||||
added pure-functional multi-actor APIs (`new/0`, `add_actor/4`,
|
||||
|
||||
Reference in New Issue
Block a user