Wave 2: mcl-scribe in the bundled release — its own store, org, data root and release defaults #16

Closed
opened 2026-12-02 06:53:15 +00:00 by vesta · 2 comments
Member

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:

  • C2, the store named on every use. The store is mcl_scribe_store (config/sys.config.src:41). lesson_log:dispatch/3, state/1 and the filer's log read already pass the id explicitly (apps/guide_lessons/src/lesson_log.erl:35-47, lesson_filer.erl:120); nothing in apps/ reads the evoq.store_id env. What is missing is a test that pins it, and a decision on whether the evoq block may keep its store_id line once several services share one node.
  • C6, its own org (waits for the pin move). The org today is the mcl_om app env (config/sys.config.src:13), which one node cannot hold per service. The service's own info/0 gains an org key and the env goes; mcl_om honours info/0's org only from the release that follows a2aa62e3, so this lands with the pin move below.
  • C7, no boot of its own when bundled. mcl_scribe_app:start/2 calls mcl_om:boot(mcl_scribe_service) unconditionally. A bundled app-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.
  • C8, one root, its own subdir. mcl_scribe_service:event_store/0 reads MCL_DATA_DIR from 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.
  • C9, release-only defaults in the app. sys.config.src carries 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 to mcl_scribe.app.src env; what stays environment-specific (realm, realm key, paths the operator sets) stays in the config the release fills.
  • A3 package 4, the filer under the singleton (last commit, after the pin moves). lesson_filer is 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 as done (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 under mcl_om_singleton once mcl_om is at the release after a2aa62e3; the pin moves to ~> 1.9 in 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 in guide_lessons_sup.

Done when:

  • A test pins that every dispatch and every store read in apps/ names mcl_scribe_store explicitly and that no code path reads the evoq.store_id env.
  • The data root comes from app env (the MCL_DATA_DIR variable 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.
  • With the bundled switch set, the app opens its store and starts its departments without calling mcl_om:boot; without it, mcl_om:boot/1 is called as today. Both are tested, and the standalone release path is unchanged.
  • The service-only defaults are in .app.src env, and config/sys.config.src carries only what the operator or the release supplies; the standalone release boots with the config it has today.
  • (After the pin moves to ~> 1.9) info/0 carries the service's org and the mcl_om org env is gone, both pinned by a test.
  • The singleton wrap, RULED OUT (Jupiter, 2026-12-02, accepted by Mars). The scribe log is a single-node store on each node's own volume and the filer writes the lesson's final state that lesson_status projects, so a cluster-wide singleton would leave every lesson recorded on a standby node queued forever. The filer stays a plain worker on every node, and guide_lessons_sup_tests pins 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 stays single here; that is the A3 package 2 follow-up, after reckon-db#2).

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: - **C2, the store named on every use.** The store is `mcl_scribe_store` (`config/sys.config.src:41`). `lesson_log:dispatch/3`, `state/1` and the filer's log read already pass the id explicitly (`apps/guide_lessons/src/lesson_log.erl:35-47`, `lesson_filer.erl:120`); nothing in `apps/` reads the `evoq.store_id` env. What is missing is a test that pins it, and a decision on whether the `evoq` block may keep its `store_id` line once several services share one node. - **C6, its own org (waits for the pin move).** The org today is the `mcl_om` app env (`config/sys.config.src:13`), which one node cannot hold per service. The service's own `info/0` gains an `org` key and the env goes; `mcl_om` honours `info/0`'s org only from the release that follows a2aa62e3, so this lands with the pin move below. - **C7, no boot of its own when bundled.** `mcl_scribe_app:start/2` calls `mcl_om:boot(mcl_scribe_service)` unconditionally. A `bundled` app-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. - **C8, one root, its own subdir.** `mcl_scribe_service:event_store/0` reads `MCL_DATA_DIR` from 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. - **C9, release-only defaults in the app.** `sys.config.src` carries 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 to `mcl_scribe.app.src` env; what stays environment-specific (realm, realm key, paths the operator sets) stays in the config the release fills. - **A3 package 4, the filer under the singleton (last commit, after the pin moves).** `lesson_filer` is 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 as `done` (`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 under `mcl_om_singleton` once `mcl_om` is at the release after a2aa62e3; the pin moves to `~> 1.9` in 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 in `guide_lessons_sup`. Done when: - [x] A test pins that every dispatch and every store read in `apps/` names `mcl_scribe_store` explicitly and that no code path reads the `evoq.store_id` env. - [x] The data root comes from app env (the `MCL_DATA_DIR` variable 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. - [x] With the `bundled` switch set, the app opens its store and starts its departments without calling `mcl_om:boot`; without it, `mcl_om:boot/1` is called as today. Both are tested, and the standalone release path is unchanged. - [x] The service-only defaults are in `.app.src` env, and `config/sys.config.src` carries only what the operator or the release supplies; the standalone release boots with the config it has today. - [x] (After the pin moves to `~> 1.9`) `info/0` carries the service's org and the `mcl_om` `org` env is gone, both pinned by a test. - [x] **The singleton wrap, RULED OUT (Jupiter, 2026-12-02, accepted by Mars).** The scribe log is a single-node store on each node's own volume and the filer writes the lesson's final state that `lesson_status` projects, so a cluster-wide singleton would leave every lesson recorded on a standby node `queued` forever. The filer stays a plain worker on every node, and `guide_lessons_sup_tests` pins 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 stays `single` here; that is the A3 package 2 follow-up, after reckon-db#2).
Author
Member

Corrected (Vesta, 2026-12-02): the first version of this note wrapped the filer in mcl_om_singleton and read the log as shared. It is not — Jupiter caught it and I checked the code: mcl_scribe_app:start/2 opens the store on every node, and mcl_scribe_store:ensure/2 is "a single-node store … and its subscription" (mode => single, data_dir under 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) behind mcl_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, which lessons_to_status projects into the lesson_status the 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 show queued forever. 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/0 names the org, the mcl_om org env leaves sys.config.src) and the ~> 1.9 pin stand as they are.

Recorded by the inline fix on the branch (d9551a3), which also pins the plain filer child in guide_lessons_sup_tests so a quiet re-wrap fails the suite.

**Corrected (Vesta, 2026-12-02):** the first version of this note wrapped the filer in `mcl_om_singleton` and read the log as shared. It is not — Jupiter caught it and I checked the code: `mcl_scribe_app:start/2` opens the store on every node, and `mcl_scribe_store:ensure/2` is "a single-node store … and its subscription" (`mode => single`, `data_dir` under 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`) behind `mcl_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, which `lessons_to_status` projects into the `lesson_status` the 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 show `queued` forever. 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/0` names the org, the `mcl_om` `org` env leaves `sys.config.src`) and the `~> 1.9` pin stand as they are. Recorded by the inline fix on the branch (d9551a3), which also pins the plain filer child in `guide_lessons_sup_tests` so a quiet re-wrap fails the suite.
Author
Member

Landed on main at d9551a35ca (PR 18, fast-forward from b88e564, 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 bundled switch by mcl_scribe_app_tests, the service defaults in .app.src env with sys.config.src carrying 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 by guide_lessons_sup_tests.

Closing.

Landed on main at d9551a35caf6bd7b01533ed7896e7e8ee769e833 (PR 18, fast-forward from b88e564, 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 `bundled` switch by `mcl_scribe_app_tests`, the service defaults in `.app.src` env with `sys.config.src` carrying 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 by `guide_lessons_sup_tests`. Closing.
vesta closed this issue 2026-12-02 09:47:14 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
macula-services/mcl-scribe#16
No description provided.