Wave 2: mcl-scribe in the bundled release — its own store, org, data root and release defaults #16
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Purpose (feature): a bundled release can host mcl-scribe beside other services on one node — its store, its org, its data root and its release defaults come from the service itself — while its own standalone release keeps working exactly as it does today.
Raf, 2026-12-02: "Run the whole path (Recommended)" (the crew runs the whole path to one clustered mcl-martha release, in order, without coming back to him). Raf, 2026-12-02: "trust on sight. mcl-martha services should auto-cluster over LAN, no mcl-station required. Distributed Erlang offers us all we need."
Wave 2, per-service changes (martha-ai/mcl-martha#1), on the multi-service boot mcl-om#8 landed at a2aa62e3 (
refs martha-ai/mcl-martha#1, macula-services/mcl-om#8).What this service has to do:
mcl_scribe_store(config/sys.config.src:41).lesson_log:dispatch/3,state/1and the filer's log read already pass the id explicitly (apps/guide_lessons/src/lesson_log.erl:35-47,lesson_filer.erl:120); nothing inapps/reads theevoq.store_idenv. What is missing is a test that pins it, and a decision on whether theevoqblock may keep itsstore_idline once several services share one node.mcl_omapp env (config/sys.config.src:13), which one node cannot hold per service. The service's owninfo/0gains anorgkey and the env goes;mcl_omhonoursinfo/0's org only from the release that follows a2aa62e3, so this lands with the pin move below.mcl_scribe_app:start/2callsmcl_om:boot(mcl_scribe_service)unconditionally. Abundledapp-env switch: when set, the app opens its store and starts its departments but leaves the boot to the release that hosts it; when unset (the default, and every standalone release), it boots exactly as today.mcl_scribe_service:event_store/0readsMCL_DATA_DIRfrom the OS (mcl_scribe_service.erl:81). The data root becomes app env, the subdir is the service's own, and the OS variable is no longer read in code.sys.config.srccarries what only a release needs (identity key path, health socket, capability topic, org, realm, realm key). The ones that are the service's own defaults move tomcl_scribe.app.srcenv; what stays environment-specific (realm, realm key, paths the operator sets) stays in the config the release fills.lesson_fileris the service's one side effect that would run on every node (lesson_filer.erl:108,188). It is at-least-once and safe: two filers file each queued lesson, mcl-rag keys a chunk by source and text so the copy lands on the same chunk, and the lesson aggregate refuses a second final state, which the filer reads asdone(written({error, not_queued}) -> done). Under a netsplit the singleton runs one copy per connected partition, so the same argument holds partition by partition: safe, no guard needed beyond the aggregate's own refusal. It moves undermcl_om_singletononcemcl_omis at the release after a2aa62e3; the pin moves to~> 1.9in that same commit and never to a git ref. RULED OUT on 2026-12-02 (Jupiter, accepted by Mars): the premise is wrong — the log is a single-node store on each node, not one shared log, so a cluster-wide singleton would lose every lesson recorded on a standby node. The filer stays where its log runs; the reason is inguide_lessons_sup.Done when:
apps/namesmcl_scribe_storeexplicitly and that no code path reads theevoq.store_idenv.MCL_DATA_DIRvariable still honoured as the operator's input) and the store's subdir is the service's own; a test boots with a root and finds the store under it, and the unset default is what it was.bundledswitch set, the app opens its store and starts its departments without callingmcl_om:boot; without it,mcl_om:boot/1is called as today. Both are tested, and the standalone release path is unchanged..app.srcenv, andconfig/sys.config.srccarries only what the operator or the release supplies; the standalone release boots with the config it has today.~> 1.9)info/0carries the service's org and themcl_omorgenv is gone, both pinned by a test.lesson_statusprojects, so a cluster-wide singleton would leave every lesson recorded on a standby nodequeuedforever. The filer stays a plain worker on every node, andguide_lessons_sup_testspins that child so a quiet re-wrap fails. Mars, 2026-12-02: "a singleton over a store-driven side effect lands only with that service's A3 package 2 (cluster store)". The split note is corrected in comment 8104.Do NOT change the reckon-db store
mode(it stayssinglehere; that is the A3 package 2 follow-up, after reckon-db#2).Corrected (Vesta, 2026-12-02): the first version of this note wrapped the filer in
mcl_om_singletonand read the log as shared. It is not — Jupiter caught it and I checked the code:mcl_scribe_app:start/2opens the store on every node, andmcl_scribe_store:ensure/2is "a single-node store … and its subscription" (mode => single,data_dirunder that node's own root). So the note below is the corrected one, and the wrap is ruled out.A3 package 4, the split note the common brief asks for: what a double run does for the side effect, and whether it needs a guard.
Considered: the lesson filer (
lesson_filer) behindmcl_om_singleton.Ruled out, with the reason in
guide_lessons_sup: the scribe log is a single-node reckon-db store on each node's own volume, and the filer writes each lesson's final state into that log, whichlessons_to_statusprojects into thelesson_statusthe node answers. A lesson recorded on a node is in that node's log only, so only a filer on that node can file it. A cluster-wide singleton would run one filer; every lesson recorded on a standby node would have its cast dropped, never reach mcl-rag, and showqueuedforever. The same ruling as mcl-graph#15's learner: the filer runs where its log runs.What a double run does: there is none. With a store per node, each node's filer files only its own log, so no lesson is filed twice. The double run the analysis expected assumes a shared store; a shared, replicated scribe log is the case that would need the singleton, and that is a different package.
Not changed by this: C6 (
info/0names the org, themcl_omorgenv leavessys.config.src) and the~> 1.9pin stand as they are.Recorded by the inline fix on the branch (
d9551a3), which also pins the plain filer child inguide_lessons_sup_testsso a quiet re-wrap fails the suite.Landed on main at
d9551a35ca(PR 18, fast-forward fromb88e564, Terra on Mars's LAND).Every Done-when line checked against the diff: C2 pinned by the source-scanning test, the data root and the store's own subdir by the data-root tests, the
bundledswitch bymcl_scribe_app_tests, the service defaults in.app.srcenv withsys.config.srccarrying only what the operator or the release supplies, and C6 by the info/0 + no-{org,test. The fifth line is the ruled-out singleton wrap (Jupiter, 2026-12-02): the filer stays a plain worker, pinned byguide_lessons_sup_tests.Closing.