From 538b8a53e06ce196fd9fc038a1b05a882445685b Mon Sep 17 00:00:00 2001 From: giles Date: Sat, 6 Jun 2026 22:20:52 +0000 Subject: [PATCH] =?UTF-8?q?plans:=20shared-plumbing=20extraction=20note=20?= =?UTF-8?q?=E2=80=94=20defer=20to=20post-merge=20integration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mod-sx (Prolog) and acl-sx (Datalog) converged on the same module shape but run on different engines. Only the audit log + fed trust/outbox shapes truly share; extract at the architecture-merge point refactoring both consumers atomically, not unilaterally from a loop branch. Co-Authored-By: Claude Opus 4.8 (1M context) --- plans/mod-on-sx.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/plans/mod-on-sx.md b/plans/mod-on-sx.md index f613eae3..876b92e8 100644 --- a/plans/mod-on-sx.md +++ b/plans/mod-on-sx.md @@ -238,6 +238,29 @@ lib/mod/fed.sx `mod/dedup-reports` collapses identical reports (reporter|subject|reason key, case-insensitive); `mod/distinct-reporters-of` counts unique reporters. +## Shared-plumbing extraction — post-merge integration note + +mod-sx (Prolog) and acl-sx (Datalog, `lib/acl/`, 120/120) independently converged +on the same module shape: `schema / engine / audit / explain / federation / api`. +That parallel is the signal both plans flagged. **Recommendation: do NOT extract +from a loop branch — extract at the architecture-merge integration point, after +both `lib/mod` and `lib/acl` have landed, refactoring both consumers in one change.** + +- **Different engines.** acl = Datalog bottom-up (native derivation trees); mod = + Prolog backtracking (proof via per-goal `pl-query-all`). The engine and most of + `explain` are NOT shared — same intent, different mechanism. Don't try to unify them. +- **Genuinely convergent shapes (the only real candidates):** + - **Append-only audit log** — `{seq, payload, retrieve-by-id}`; both have it (~40 + lines). Lift to e.g. `lib/guest/audit-log.sx` parameterized by the entry payload. + - **Federation trust/outbox** — advisory-unless-`(trust peer :scope)` + a send + seam; both have it. Lift the trust registry + outbox; keep `:scope` a parameter + (`:mod` vs `:acl`). +- **Trivia not worth a module:** `join-with`, `any?`, `str-contains?`, `distinct`. +- **Why not now:** the branches merge independently; lifting from one leaves the + other's copy un-refactored → duplication, not sharing. Real extraction must touch + both consumers atomically, which only the post-merge integrator can do. Designing + the abstraction also needs both payload shapes in view (only mod's is visible here). + ## Progress log - **Ext 19 — end-to-end triage pipeline, 390/390** (+15). Capstone: one