fed-sx-m2: Step 9c — auto-Accept backfill drain + 6 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 50s

maybe_auto_accept/3 in http_server.erl now calls maybe_backfill/3
after the Accept publish. Flow:

  inbound Follow{actor: bob, object: alice, backfill: SPEC} lands
    -> pipeline ok -> append_inbox + broadcast (Step 6b)
    -> maybe_auto_accept fires (Step 6c)
       -> publish Accept{actor: alice, object: Follow} (Step 6c)
       -> maybe_backfill (Step 9c)
          -> backfill_enabled cfg gate
          -> :backfill present on Follow
          -> backfill:parse_mode -> Mode
          -> nx_kernel:log_state_for(alice) -> LogState
          -> backfill:slice(Mode, LogState, true) -> [Wrapped]
          -> deliver_backfill(bob, Slice):
               whereis(bob) cfg gate (peer worker registered)
               -> delivery_worker:enqueue(bob, A) for each

Cfg surface:
  {backfill_enabled, true}     gate the drain (default off)
  {auto_accept_follows, true}  Step 6c gate (required)

Each backfilled entry carries {backfilled, true} (per design §13.3,
:id preserved so the receiver's replay defence still catches the
forward-going copy).

6/6 in next/tests/backfill_drain.sh:
  - Follow with {backfill, {last_n, 2}} + 3 pre-published notes
    -> bob's delivery_worker has exactly 2 pending entries
  - Each entry carries {backfilled, true}
  - :backfill_enabled absent -> no drain (back-compat)
  - Follow without :backfill field -> no drain
  - Missing peer worker (no whereis) -> silently skipped + 202

Step 9 fully closed (9a slicing + 9b ?since route + 9c
Accept-drain). The live HTTP dispatch of the queued entries
still gates on Blockers #2 (httpc).
This commit is contained in:
2026-06-07 07:01:55 +00:00
parent 3629b2923f
commit 070986913d
3 changed files with 196 additions and 7 deletions

View File

@@ -666,12 +666,20 @@ Per §13.3: A wants B's history when A first follows B. Four modes:
to `http_multi_actor.sh` (downstream dependency since Step
7c/9a — must have been latently broken; the existing 41
passes + 3 new = 44 now all green).
- [ ] **9c** — Follow → Accept → backfill-delivery wiring.
The receiving kernel reads the Follow's `:backfill` field
via `parse_mode/1`, slices its outbox, and dispatches each
entry to the new follower's delivery_worker queue (Step 8d).
Gates on Blockers #2 (httpc) for the actual peer fetch path
but the in-process drain works today.
- [x] **9c** — Follow → Accept → backfill drain (in-process).
`maybe_auto_accept/3` in `http_server.erl` now calls a new
`maybe_backfill/3` after the Accept publish: when Cfg carries
`{backfill_enabled, true}` AND the Follow envelope carries a
`:backfill` field, the receiver parses the mode via
`backfill:parse_mode/1`, slices its outbox via
`backfill:slice/3` (Wrap=true so each entry gets
`{backfilled, true}`), and enqueues every slice entry onto
the peer's delivery_worker if registered (silently skipped
otherwise — kernel manager lazy creation belongs upstream).
6/6 in `backfill_drain.sh` covering full path + entry marker
+ flag-off no-op + missing-backfill-field no-op + missing-
worker silent skip. The live HTTP dispatch of those queued
entries still gates on Blockers #2 (httpc).
**Tests:**
@@ -1047,6 +1055,19 @@ proceed.
Newest first.
- **2026-06-07** — Step 9c (closes Step 9): Follow → Accept →
backfill drain (in-process). `maybe_auto_accept/3` now calls
`maybe_backfill/3` after the Accept publish: when
`:backfill_enabled` is true and the Follow envelope carries a
`:backfill` field, the receiver parses the mode, slices its
outbox via `backfill:slice/3` (Wrap=true), and enqueues every
entry onto the peer's delivery_worker. Silent skip when the
worker isn't registered (kernel manager lazy creation
upstream). 6/6 in `backfill_drain.sh`. Step 9 fully closed
(9a slicing + 9b ?since route + 9c Accept-drain). Live HTTP
dispatch of queued entries still gates on Blockers #2
(httpc).
- **2026-06-07** — Step 9b: outbox `?since=Cid` pagination.
`actor_outbox_response_for/3` in `http_server.erl` now reads
`?since=` from the query string via new `parse_since/1` +