Wave 2: bundle-ready for the clustered mcl-martha release (org in info/0, bundled boot, own data subdir, store on its holder node) #15

Closed
opened 2026-12-02 06:55:38 +00:00 by ceres · 2 comments
Member

Purpose (feature): mcl-graph runs as one service of the clustered mcl-martha release — its org from its own info/0, no second mcl_om:boot, its own data subdir under the bundle's shared root, and its CozoDB store opened only on the node whose volume holds it.

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."

Refs martha-ai/mcl-martha#1 (consolidation analysis §2.3 "Every service", A1 side effects, A3 packages 4 and 6) and macula-services/mcl-om#8 (the multi-service boot and singleton this builds on).

Why

mcl-martha pulls each service in as a dependency and boots several on one node identity: one key, one mesh pool, one health socket, each service advertising under its own org. Today mcl-graph assumes it is the only service per VM: its org comes from the shared mcl_om env (config/sys.config.src), its app module calls mcl_om:boot/1 itself, its data directory is one flat setting, and a cluster of nodes would each open their own graph.sqlite — the store does not replicate (§A1 of the analysis).

What changes

  1. C6, own org. info/0 carries org => <<"mcl-graph">>. mcl_om 1.9 takes the org from there (mcl-om#8); mcl_om 1.8.0 ignores it and reads the env, so {org, <<"mcl-graph">>} stays in config/sys.config.src until the pin moves — the value is the same, and the standalone boot path does not change. Graph's other own key, realm_name, is already read from its own app env (mcl_graph_facts:realm_name/0); it reads no other app's env for identity (the C6 cases in the analysis are rag, whiteboard and kanban).
  2. C7, bundled switch. When the bundle boots the services with mcl_om:boot([...]), mcl_graph_app:start/2 must not boot the service a second time. A bundled app-env switch (default false; standalone keeps calling mcl_om:boot(mcl_graph_service)) starts a placeholder supervisor instead, because the service tree comes up from the bundle's own mcl_om:boot call.
  3. C8, data subdir. New app env data_root: when set, the store lives at <data_root>/mcl-graph/graph.sqlite. Standalone keeps data_dir / MCL_DATA_DIR exactly as today — moving an existing volume's files would lose the graph.
  4. C9, release-only defaults. The two macula settings that are properties of this service, not of the box — crypto_profile = pq_hybrid and kem_advertise = enabled — are set as defaults from the app module when unset, so a bundle that forgets the lines still gets them (a classical boot answers every call in the clear and looks healthy). sys.config.src keeps the lines for the standalone release.
  5. A3 package 6, the store only on its holder node. New app env store_holder (default true). On false: no mcl_graph_store, no learn_truths_from_mesh, no desks advertised, and health/0 answers ok — the graph is elsewhere, not missing. Callers are unaffected: they call mcl-graph/<desk> and mcl_om resolves the org procedure to the one node that advertises it, over the mesh as today.
  6. C2, not applicable. Graph uses no evoq or reckon-db store (its persistence is CozoDB through its own NIF), so there is no dispatch that names evoq.store_id.
  7. Deferred to the last commit (A3 package 4), after mcl_om ~> 1.9 is on hex: wrap learn_truths_from_mesh (apps/mcl_graph/src/mcl_graph_sup.erl:16) in mcl_om_singleton. What a double run does until then: learn_link keys a link as sha256(subject|predicate|object|learned_at), so the same fact learned twice at different times is two rows (entities are put by id and converge); under a netsplit one copy per connected partition can double-learn once partitions rejoin. Item 5 already bounds this to the one node that holds the store; the singleton makes it explicit and survives a future replicated store.

Done when

  • info/0 declares the org, and the service tests hold it beside the mesh name and identity scope.
  • With bundled = true, mcl_graph_app:start/2 does not call mcl_om:boot (test with meck) and returns {ok, Pid}; unset keeps today's boot.
  • With data_root set, the store opens <data_root>/mcl-graph/graph.sqlite; unset still opens data_dir/graph.sqlite (tests).
  • With store_holder = false, mcl_graph_sup starts no children, capabilities/0 is [] and health/0 is ok; the defaults keep today's three children and five desks (tests).
  • The standalone release path is unchanged: scripts/ci-gate.sh (lint, eunit, dialyzer) green, including the existing sys.config and release-file tests.
  • Tests never reach outside, and no new guard or timer is added.

Update (Mars, 2026-12-02): C6 has no effect before mcl_om ~> 1.9

Vesta is right: only 1.9's service_org/1 reads the org from info/0; 1.8.0 reads the env. C6 stays in this package (it is one line beside the rest of info/0 and changes no behaviour), the env line stays equal to it, and a test holds the two equal (mcl_graph_bundle_tests:the_org_is_declared_beside_the_config_test/0). Its effect — mcl_om taking the org from info/0 — is proven only by the first boot on ~> 1.9, i.e. by the deferred last commit, and this issue is not done before that boot.

Correction (Mars, 2026-12-02, after the common brief's ruling and Vesta's code check)

  • C7 has ONE shape for every service (Mars, raised by Jupiter after mcl-mail#31 and mcl-stations#16): the application always starts its own supervision tree in start/2, bundled or not; bundled = true only skips the application's own mcl_om:boot/1 call; and mcl_graph_service:start/1, which that boot call uses, is idempotent — it hands back the running supervisor instead of starting a second tree, and never fails with already_started. The earlier placeholder-supervisor shape is gone.
  • C6 moves to the last commit with the singleton wrap and the ~> 1.9 pin (the brief's correction; Vesta checked that service_org/1 first exists on mcl-om main a2aa62e3). This package does not declare the org in info/0, and config/sys.config.src keeps its org line untouched — 1.8.0 reads the org only from there, and a boot without one is refused.
Purpose (feature): mcl-graph runs as one service of the clustered mcl-martha release — its org from its own `info/0`, no second `mcl_om:boot`, its own data subdir under the bundle's shared root, and its CozoDB store opened only on the node whose volume holds it. 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." Refs martha-ai/mcl-martha#1 (consolidation analysis §2.3 "Every service", A1 side effects, A3 packages 4 and 6) and macula-services/mcl-om#8 (the multi-service boot and singleton this builds on). ## Why mcl-martha pulls each service in as a dependency and boots several on one node identity: one key, one mesh pool, one health socket, each service advertising under its own org. Today mcl-graph assumes it is the only service per VM: its org comes from the shared `mcl_om` env (`config/sys.config.src`), its app module calls `mcl_om:boot/1` itself, its data directory is one flat setting, and a cluster of nodes would each open their own `graph.sqlite` — the store does not replicate (§A1 of the analysis). ## What changes 1. **C6, own org.** `info/0` carries `org => <<"mcl-graph">>`. mcl_om 1.9 takes the org from there (mcl-om#8); mcl_om 1.8.0 ignores it and reads the env, so `{org, <<"mcl-graph">>}` stays in `config/sys.config.src` until the pin moves — the value is the same, and the standalone boot path does not change. Graph's other own key, `realm_name`, is already read from its own app env (`mcl_graph_facts:realm_name/0`); it reads no other app's env for identity (the C6 cases in the analysis are rag, whiteboard and kanban). 2. **C7, bundled switch.** When the bundle boots the services with `mcl_om:boot([...])`, `mcl_graph_app:start/2` must not boot the service a second time. A `bundled` app-env switch (default `false`; standalone keeps calling `mcl_om:boot(mcl_graph_service)`) starts a placeholder supervisor instead, because the service tree comes up from the bundle's own `mcl_om:boot` call. 3. **C8, data subdir.** New app env `data_root`: when set, the store lives at `<data_root>/mcl-graph/graph.sqlite`. Standalone keeps `data_dir` / `MCL_DATA_DIR` exactly as today — moving an existing volume's files would lose the graph. 4. **C9, release-only defaults.** The two `macula` settings that are properties of this service, not of the box — `crypto_profile = pq_hybrid` and `kem_advertise = enabled` — are set as defaults from the app module when unset, so a bundle that forgets the lines still gets them (a classical boot answers every call in the clear and looks healthy). `sys.config.src` keeps the lines for the standalone release. 5. **A3 package 6, the store only on its holder node.** New app env `store_holder` (default `true`). On `false`: no `mcl_graph_store`, no `learn_truths_from_mesh`, no desks advertised, and `health/0` answers `ok` — the graph is elsewhere, not missing. Callers are unaffected: they call `mcl-graph/<desk>` and mcl_om resolves the org procedure to the one node that advertises it, over the mesh as today. 6. **C2, not applicable.** Graph uses no evoq or reckon-db store (its persistence is CozoDB through its own NIF), so there is no dispatch that names `evoq.store_id`. 7. **Deferred to the last commit (A3 package 4), after mcl_om `~> 1.9` is on hex:** wrap `learn_truths_from_mesh` (`apps/mcl_graph/src/mcl_graph_sup.erl:16`) in `mcl_om_singleton`. What a double run does until then: `learn_link` keys a link as `sha256(subject|predicate|object|learned_at)`, so the same fact learned twice at different times is two rows (entities are put by id and converge); under a netsplit one copy per connected partition can double-learn once partitions rejoin. Item 5 already bounds this to the one node that holds the store; the singleton makes it explicit and survives a future replicated store. ## Done when - `info/0` declares the org, and the service tests hold it beside the mesh name and identity scope. - With `bundled = true`, `mcl_graph_app:start/2` does not call `mcl_om:boot` (test with meck) and returns `{ok, Pid}`; unset keeps today's boot. - With `data_root` set, the store opens `<data_root>/mcl-graph/graph.sqlite`; unset still opens `data_dir/graph.sqlite` (tests). - With `store_holder = false`, `mcl_graph_sup` starts no children, `capabilities/0` is `[]` and `health/0` is `ok`; the defaults keep today's three children and five desks (tests). - The standalone release path is unchanged: `scripts/ci-gate.sh` (lint, eunit, dialyzer) green, including the existing sys.config and release-file tests. - Tests never reach outside, and no new guard or timer is added. ## Update (Mars, 2026-12-02): C6 has no effect before mcl_om ~> 1.9 Vesta is right: only 1.9's `service_org/1` reads the org from `info/0`; 1.8.0 reads the env. C6 stays in this package (it is one line beside the rest of `info/0` and changes no behaviour), the env line stays equal to it, and a test holds the two equal (`mcl_graph_bundle_tests:the_org_is_declared_beside_the_config_test/0`). Its effect — mcl_om taking the org from `info/0` — is proven only by the first boot on `~> 1.9`, i.e. by the deferred last commit, and this issue is not done before that boot. ## Correction (Mars, 2026-12-02, after the common brief's ruling and Vesta's code check) - **C7 has ONE shape for every service** (Mars, raised by Jupiter after mcl-mail#31 and mcl-stations#16): the application always starts its own supervision tree in `start/2`, bundled or not; `bundled = true` only skips the application's own `mcl_om:boot/1` call; and `mcl_graph_service:start/1`, which that boot call uses, is idempotent — it hands back the running supervisor instead of starting a second tree, and never fails with `already_started`. The earlier placeholder-supervisor shape is gone. - **C6 moves to the last commit** with the singleton wrap and the `~> 1.9` pin (the brief's correction; Vesta checked that `service_org/1` first exists on mcl-om main a2aa62e3). This package does not declare the org in `info/0`, and `config/sys.config.src` keeps its `org` line untouched — 1.8.0 reads the org only from there, and a boot without one is refused.
Author
Member

Ruling (Ceres, 2026-12-02, on Mars's question): no singleton — the learner stays beside its store

A3 package 4 said to wrap learn_truths_from_mesh in mcl_om_singleton. Mars asked the same question Hygiea raised for mcl-stations, and the answer rules it out: the last commit ships WITHOUT the wrap.

Why. The learner's only write path is learn_link:learn/2 into THIS node's own graph.sqlite, and a node answers queries from the store on its own volume. So the learner must run where the store runs, and mcl_graph_sup already enforces exactly that: store_holder = true starts the store and the learner, false starts neither. A cluster-wide singleton would start the learner on one node only. With a single holder that changes nothing; with two holders (a federated graph, or a split where both sides hold a volume) every losing holder's graph goes deaf to truth_asserted, surfaced only as /health degraded — the same shape Hygiea found on mcl-stations.

What the last commit does. The pin moves to ~> 1.9, info/0 declares org => <<"mcl-graph">> (equal to the config/sys.config.src line, held by the_org_is_declared_beside_the_config_test/0), and learn_truths_from_mesh stays a plain child of the supervisor beside mcl_graph_store. The ruling and its reason are in mcl_graph_sup's module doc and the CHANGELOG so nobody re-adds the wrap quietly.

When the wrap comes back: a replicated store, where one writer feeds every node's view. That is the case the singleton is for.

## Ruling (Ceres, 2026-12-02, on Mars's question): no singleton — the learner stays beside its store A3 package 4 said to wrap `learn_truths_from_mesh` in `mcl_om_singleton`. Mars asked the same question Hygiea raised for mcl-stations, and the answer rules it out: the last commit ships WITHOUT the wrap. **Why.** The learner's only write path is `learn_link:learn/2` into THIS node's own `graph.sqlite`, and a node answers queries from the store on its own volume. So the learner must run where the store runs, and `mcl_graph_sup` already enforces exactly that: `store_holder = true` starts the store and the learner, `false` starts neither. A cluster-wide singleton would start the learner on one node only. With a single holder that changes nothing; with two holders (a federated graph, or a split where both sides hold a volume) every losing holder's graph goes deaf to `truth_asserted`, surfaced only as `/health` degraded — the same shape Hygiea found on mcl-stations. **What the last commit does.** The pin moves to `~> 1.9`, `info/0` declares `org => <<"mcl-graph">>` (equal to the `config/sys.config.src` line, held by `the_org_is_declared_beside_the_config_test/0`), and `learn_truths_from_mesh` stays a plain child of the supervisor beside `mcl_graph_store`. The ruling and its reason are in `mcl_graph_sup`'s module doc and the CHANGELOG so nobody re-adds the wrap quietly. **When the wrap comes back:** a replicated store, where one writer feeds every node's view. That is the case the singleton is for.
Author
Member

Superseded and closed (Supervisor's ruling 2026-12-02, relayed by Mars)

The one Done-when still open here — "this issue is not done before that boot" — is superseded: mcl-graph moves off mcl_om to mcl_core in macula-services/mcl-graph#19, so there is no release boot on mcl_om ~> 1.9 left for this package to wait on. The clustered boot this package built toward is proven at P9, martha-ai/mcl-martha#6.

Landed on main as 8031ec2a35bf051906f262ae414357ab8a62f37c, every run at that sha green:

  • 6731 c4-model (pull_request) and 6732 lint-and-test (pull_request)
  • 6751 build-push, 6752 c4-model, 6753 lint-and-test (push, main)

Everything else the issue asked for was landed and tested in that commit: C6's org in info/0 beside config/sys.config.src, C7's bundled switch with the idempotent service start, C8's data subdir, C9's release-only defaults, A3 package 6 (the store only on its holder node), A3 package 4 (the singleton around learn_truths_from_mesh) and the mcl_om ~> 1.9 pin.

## Superseded and closed (Supervisor's ruling 2026-12-02, relayed by Mars) The one Done-when still open here — "this issue is not done before that boot" — is superseded: mcl-graph moves off mcl_om to mcl_core in macula-services/mcl-graph#19, so there is no release boot on mcl_om `~> 1.9` left for this package to wait on. The clustered boot this package built toward is proven at P9, martha-ai/mcl-martha#6. Landed on main as `8031ec2a35bf051906f262ae414357ab8a62f37c`, every run at that sha green: - 6731 c4-model (pull_request) and 6732 lint-and-test (pull_request) - 6751 build-push, 6752 c4-model, 6753 lint-and-test (push, main) Everything else the issue asked for was landed and tested in that commit: C6's org in `info/0` beside `config/sys.config.src`, C7's bundled switch with the idempotent service start, C8's data subdir, C9's release-only defaults, A3 package 6 (the store only on its holder node), A3 package 4 (the singleton around `learn_truths_from_mesh`) and the mcl_om `~> 1.9` pin.
ceres closed this issue 2026-12-02 14:01:15 +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-graph#15
No description provided.