P1: mcl-om history into mcl-core, renamed mcl_core, contract/bridge split (Refs #1) #5
Loading…
Reference in a new issue
No description provided.
Delete branch "uranus/1-p1-split"
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?
Refs #1. P1 of the design: mcl-om's history into mcl-core, renamed
mcl_core, split into contract and bridge behind a transport boundary. No behaviour change.Commits, in order (each reviewable alone):
c815dbbmerges mcl-om main (a8e35a1) with--allow-unrelated-histories. LICENSE is mcl-core's full Apache text, README is mcl-om's, and.gitignoreis the union of both.a2011c5renames files only:src/becomescontract/andbridge/(design §1.2),mcl_om*becomesmcl_core*, and no file's content changes, sogit log --followand blame reach mcl-om's commits.939c36arenames inside the files: modules, app, app env key,MCL_OM_*, the hex name and the template dependency (~> 1.0). vsn is 1.0.0, unreleased. History stays as written: CHANGELOG, the proof vector's provenance, version mentions andmcl-om#Nreferences.71b873baddsmcl_core_transport(call_capability/4,5go through it, andmcl_core_bridgeis the one transport),docs/DESIGN.mdand the C4 SVGs from mcl-lan 4020832 with a §9 appended, the README model, and the CHANGELOG 1.0.0 entry with the steps to move from mcl_om.Local, OTP 28.4.3, rebar 3.28.0: sealing test, lint, xref, eunit (480 tests, 0 failures), ct (mcl_core_SUITE, mesh_pool, singleton), dialyzer and ex_doc all pass. mcl_service_template_SUITE did not run locally, because this machine's
~/.config/rebar3/templateslinks to another checkout and the suite refuses that by design. CI runs it.CI: mcl-om's forge workflows came over in the merge, renamed.
template-lint-imageis red on the forge for a known reason (#2, carried from mcl-om#2). No tag, no hex publish.Adopts the four-tier architecture: Layer 4 apps — hecate-app-* (live in hecate-daemon) Layer 3 session — hecate-daemon (per-user, user laptop) Layer 2 services — hecate-services/* (this org) Layer 1 identity — hecate-realm / macula-realm Layer 0 kernel — macula-station hecate-om is the library every hecate-services/hecate-X daemon depends on. Defines: - hecate_om_service behaviour (6 callbacks: info, start, stop, health, capabilities, identity_spec) - hecate_om facade (boot/1, advertise_capabilities/0, health/0, service_cert/0, macula_client/0) - workers: hecate_om_identity (loads realm-signed service-principal cert), hecate_om_capabilities (publishes onto mesh bloom-channel), hecate_om_health (serves /health), hecate_om_health_handler (Cowboy) Services run on REALM INFRASTRUCTURE NODES (BEAM cluster, dedicated relay boxes, future cooperative-contributed nodes), never on user laptops. Each has its own realm-signed service-principal credential — institutions of the realm, not user agents. See guides/identity_model.md for the town/library metaphor. Container deployment under system-wide systemd-managed Podman (Quadlet units), orchestrated by hecate-gitops. Images at ghcr.io/hecate-services/hecate-X:{latest,semver}. Filesystem under /etc/hecate/ + /bulk0/hecate/<service>/ per beam-cluster convention. Templates render Containerfile, Quadlet unit, manifest.json, CI workflow, _app.erl, _service.erl from variables. Generator script: scripts/scaffold-service.sh. Guides: service_anatomy.md, identity_model.md, container_deployment.md.Real macula:connect / macula:publish calls behind hecate-om's identity and capability workers. Services that depend on hecate_om now get genuine mesh integration when seeds are reachable, and graceful no-op behaviour when they aren't (no station yet, test harness, etc.). hecate_om_identity: - attach_client/1 now calls macula:connect(Seeds, Opts), caches the pool pid, returns undefined on failure (degraded mode) - new realm/0 accessor (reads from app env; supports raw 32-byte binary OR 64-char hex). v2 will extract from the service-cert. hecate_om_capabilities: - do_publish/1 now calls macula:publish(Pool, Realm, Topic, Payload) - topic = <<"_mesh.cap.", service_name>> - payload = #{type=>capability_summary, service, capabilities, published_at} - skipped silently when no client / no realm; publish/0 can be re-called when state catches up app.src: - {realm, ...} env entry documented (operator pins via gitops env) - {station_seeds, []} env entry — empty list = run offline - version bumped to 0.2.0 handler_table dispatched from advertise_all/0 uses the {module(), atom()} form that macula_client:handler/0 accepts — keeps the per-call hot path off the BEAM message queue.Move the reckon_db_sup:start_store/1 + evoq_store_subscription:start_link/1 boilerplate out of every CMD/PRJ services _app.erl and into hecate_om. Adds: - src/hecate_om_store.erl: ensure/2, ensure_store/2, wait_for_store/2, ensure_subscription/1. Single-mode store at <data_dir>/<store_id>/. - hecate_om_service behaviour: optional store_id/0 + data_dir/0 callbacks; -optional_callbacks([store_id/0, data_dir/0]). - hecate_om:boot/2: maybe_wire_store(ServiceMod) runs before ServiceMod:start/1 if both optional callbacks are exported. - templates/sys.config.src.tmpl: canonical reckon_db + evoq blocks. - scripts/scaffold-service.sh: renders the new sys.config template. - rebar.config + hecate_om.app.src: reckon_db, evoq, reckon_evoq as hard deps. Producer-only services pay image-size cost; nothing starts unless they declare store_id/0. Each CMD/PRJ services _app.erl shrinks back to a one-liner: start(_StartType, _StartArgs) -> hecate_om:boot(my_service_module). Service module exports two extra helpers: store_id() -> {ok, S} = application:get_env(my_app, event_store_id), S. data_dir() -> {ok, D} = application:get_env(my_app, data_dir), D. Motivated by the parksim trio shipping without the evoq adapter wiring and without any reckon_db_sup:start_store/1 call - the spike documented in reckon-gateway/plans/RESEARCH_CATALOGUE_SPIKES.md. This release ensures that mistake cant repeat for future scaffolded services. Bumps vsn 0.2.0 -> 0.3.0. Non-breaking for existing consumers; the new callbacks are optional, omitting them keeps the old behaviour.rebar3 dialyzer hard-failed on OTP 28 ("Could not get Core Erlang code") because the macula + reckon-db hex packages ship without debug_info. Exclude those apps from the PLT + analysis and suppress the resulting unknown-function notes (no_unknown), keeping cowboy/jsx/ranch in-PLT so handler/JSON call sites still type-check. ct + dialyzer + ex_doc now all exit 0.hecate_om:boot/1 auto-starts a service's reckon-db store from store_id/0 + data_dir/0, but built the #store_config with no indexes. A service that also declared indexes via its own start_store hit {already_started} (swallowed), so the declarations were dropped and CCC payload indexes never registered. Add an optional store_indexes/0 callback; boot threads its result into the store config (ensure/3, ensure_store/3). Bump the reckon-db stack pins to the current ecosystem (reckon_db ~> 5.4 for the #store_config.indexes field).When a service exports store_integrity/0, hecate_om:boot/1 threads its value (disabled, or #{enabled => true, key_source => ...}) into the reckon-db store config, enabling per-store HMAC event tamper-resistance. Defaults to disabled (backward compatible). hecate_om_store:ensure/5 + ensure_store/5 take the integrity config explicitly. Release 0.5.0.rebar3 new hecate_service generates a repository that compiles, tests and deploys: application, supervisor, the six-callback service module, a eunit suite asserting the contract, a relx release, a Containerfile, both CI workflows, an executable health script, a compose file and the documentation. WHY REPLACE THE OLD TEMPLATES RATHER THAN FIX THEM. They had drifted from the estate they serve. They emitted a Quadlet unit nothing on the fleet uses, since the beam nodes run docker compose under a pull-based reconciler. They emitted TODO comments in place of two callbacks, which is a stub generator. They defaulted to a store-backed service in a mostly producer-only estate. Their identity_spec claimed two actions and a wildcard resource for a service that could exercise none of them, which is a lie on the mesh generated by default. And they shipped no test. Nothing consumed them either: the scaffold CLI the README documented was never written. THE SUITE IS THE POINT, NOT THE TEMPLATE. Those files drifted for months because nothing ran them, so the new ones are generated for real through rebar3 new and then compiled against this library, which makes the behaviour attribute check all six callbacks. This repository also had no CI at all, so the guard now runs. TWO THINGS FOUND BY RUNNING IT, both of which would have shipped silently. Mustache eats GitHub Actions. ${{ secrets.GITHUB_TOKEN }} renders to $ and rebar3 reports success, so the workflow fails later at its login step with an empty password, a long way from the cause. Every template file now switches delimiters on its first line, and two independent tests catch a regression. Sandboxing HOME to isolate the test looked right and was wrong twice. rebar3 resolves its template directory from HOME, but overriding it breaks an asdf shim, which then cannot find its installs, and after that its version selection. The suite installs into the real template directory and removes exactly what it added, which behaves the same on a laptop and in a bare container. The wrapper script now takes the name once and derives the Erlang atom, because a service has two names, mustache has no functions, and typing both is how they end up disagreeing. The generated suite asserts they agree.A handler {error, Reason} now reaches its caller with the reason intact rather than as {call_error, 15, unknown_error}. Nothing here matched on the old shape, so this is the constraint and nothing else.Replaces the pubsub _mesh.cap.announce discovery with signed DHT records. On capability register (and a 30s republish tick), write one signed procedure_advertisement per capability (advertiser = service key, serving_station = a connected station via macula:links/1, procedure_uri = realm-namespaced cap name). lookup/1 resolves via macula:find_records/2 + read_procedure_advertisement, verifying each signature, returning the {advertiser, serving_station} set. Retain the service keypair in hecate_om_identity (+ keypair/0) so records can be signed; an ephemeral service is correctly not advertised. Consumes macula ~> 8.0 (resolves 8.2.0; lock is gitignored per org policy). Pure helpers unit-tested (RED-verified); elvis + dialyzer clean. Live cross-node mesh e2e is covered by composition and needs a fleet check. Deferred: org URI segment (Slice 7), multi-station per provider (Q10/Slice 5).Adds a gen_server test covering the no-mesh boot path (the one that actually runs before a pool/keypair connect): register/publish no-op without crashing, list still reports own caps, lookup returns {ok, []}, and identity reports {error, no_keypair}. Raises hecate_om_capabilities cover to ~53% (remainder is live-pool I/O glue, proven by macula-station's cross-station SUITE).Closes the repeated boilerplate the API-integration survey found in four independent hecate-services repos, each hand-rolling the same {macula_client(), realm()} pairing because hecate_om gave them nothing to build on. hecate-tube's mesh-fact emitters and direct-dial provider desks are the first real consumers. Also carries two changes already sitting here from the prior survey session: the finished survey write-up, and the scaffold template's stale hecate_om version pin (~> 0.8 -> ~> 0.13).load_keypair/0 only ever loaded from identity_key_path. A service deployed with the env pointed at a path with nothing there yet (the common case - nobody provisioned it out-of-band) got keypair() -> {error, no_keypair} forever, every boot, with no error logged anywhere. Confirmed live on hecate-tube: mesh_handles/0 resolved fine (the service peers and calls just fine on an ephemeral identity), keypair/0 never did, so tube_mesh_providers retried its three direct-dial advertisements (RPC lookups + video streaming) every 5s forever and never once succeeded, since hecate-tube's very first deployment. No amount of local testing catches this kind of gap - it only surfaces against a real deployment that actually gets called, not just one that calls out. Now: any load failure (missing file, or a corrupt one) generates a fresh keypair and persists it to the configured path, same self-provisioning pattern macula-realm's own mesh identity already uses. Falls back to undefined (prior behavior) only if the save itself fails. identity_key_path left unconfigured is unaffected. Bumped to 0.14.1. rebar3 lint clean, dialyzer clean, 17/17 eunit (4 new, verified they fail without the fix before confirming they pass with it).hecate_om_service:capability() grows an optional handler => {Module, Args} field. hecate_om_capabilities advertises such a capability via macula_response:advertise_direct/7 instead of hand-building a bare DHT discovery record — the old path made a capability discoverable but never callable, since nothing ever registered a handler with a station. A capability with no handler keeps the legacy record-only path unchanged. Per-capability factory-supervisor pids are round-tripped through state and passed back as reuse_sup on every 30s republish tick, so periodic re-advertise does not leak a supervisor per tick. Verified genuinely callable end-to-end against a real demo-fleet station (station-de-frankfurt.macula.io), not just wired: two independent pools/identities (provider + consumer), full RPC round trip. Getting that live test to pass surfaced two real, pre-existing bugs in hecate_om_capabilities' consumer side, neither introduced by this piece: - resolve_at/4 and resolve_full/4 keyed DHT lookups by procedure_uri/3 (Realm+Org+Name), but a handler-bearing capability is written under macula's own discovery_uri/2 key (Realm+bare-Name — Org is a post-resolve verify_cert_chain concern in macula's model, never part of the discovery key). call_capability's own dial side already used the bare name, so the two could never have matched. Fixed with a new discovery_key/2 matching macula's private formula; the legacy record-only path is untouched. - dial_provider called macula:call_station/7 with no verify/pin_tls_cert/expected_node_id override, so every direct-dial call failed at the TLS layer before the real, application-level trust check (the DHT record's pubkey signature) ever ran. macula_direct_dial:call/6, macula's own canonical implementation of this exact resolve-then-call pattern, sets exactly that triad because a station's TLS certificate has no relationship to its macula identity. hecate_om_capabilities was missing it entirely. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>hecate_om_service grows an optional subscriptions/0 callback: a list of {Topic, HandlerMod, Args} triples, HandlerMod implementing the macula_subscriber behaviour. hecate_om:boot/1 wires it exactly like store_id/0 / read_model_id/0. Two new processes under hecate_om_sup: hecate_om_pubsub_sup, a plain supervisor whose children (macula_subscriber instances, restart => transient) are added/removed dynamically by topic; and hecate_om_pubsub_subscriptions, a reconciler gen_server holding the desired set with a 30s self-heal tick, same shape as hecate_om_capabilities' own republish timer and for the same reason — retry a topic that couldn't start because the mesh wasn't attached yet, or whose child exhausted its restart budget after a full pool replacement. hecate_om_pubsub:ensure_subscriptions/1 is the public entry point, diffing desired against currently-running children so a service can call it again whenever its desired set changes at runtime (e.g. one topic per newly-registered entity) and touch only the delta. No hand-rolled reconnect logic: macula_subscriber already turns a genuine subscription loss into {stop, Reason, State}, and an ordinary link respawn is invisible to it (macula_client_replay already replays it one layer down, confirmed live in macula-io/macula's macula_link_respawn_replay_tests.erl during this plan's design phase). Supervision restart is the entire reconnect story. Verified with real event delivery against the same live demo-fleet station used for piece B: declared a subscription, published a real fact via piece C's hecate_om_pubsub:publish/2, confirmed the handler received it end-to-end. Then proved the dynamic-membership design directly — adding a topic left an existing child's pid unchanged and started exactly the new one; removing a topic stopped exactly it and left the other untouched. Also fixes a real bug in this codebase's own test-teardown convention, unrelated to piece D's design: supervisor:stop/1 does not exist in OTP (verified directly against OTP 28) despite the analogy with gen_server:stop/1. Used inside a catch, it silently failed, leaking supervisors across test runs and causing registration collisions. Fixed with the correct idiom: unlink/1 + exit(Pid, shutdown) + a monitor-wait for confirmation. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>hecate_om_pubsub:start_publisher/3,4,5 and hecate_om_content: start_feeder/2,3,4 / start_downloader/2,3,4: each resolves hecate_om:mesh_handles/0 exactly like the terminal publish/2,3 and put/1,2 / get/1,2 do, then starts the real macula_publisher / macula_feeder / macula_download with a caller-supplied callback module instead of hecate_om's own, returning {ok, Pid} rather than a blocked-until-done value. hecate_om has no say over what the caller's own callback does with the outcome. Motivated by a concrete gap: pieces B and D (capabilities' handler, subscriptions' HandlerMod) already let a service supply its own callback, because handle_request/2 and handle_event/4 necessarily carry business logic hecate_om can't know in advance. Piece C and E's callbacks don't, in any real example surveyed -- every hand-rolled publish site and hecate-tube's content wrappers used the callback as a pure value-relay -- which is why they collapse into a terminal, synchronous API by default. But a service that wants something the three publish modes or the block-and-return content shape don't cover (retry-with-backoff on a batch publish, decoupled from any caller; a per-item completion side effect during a batch upload) had no way to get mesh_handles resolution without hand-rolling the whole thing and reintroducing the boilerplate this plan exists to eliminate. Nothing about the original design was wrong for the common case; it was just missing the same harness path B and D already had. Renamed the private mode-dispatch helper in hecate_om_pubsub.erl (start_publisher/6 -> publish_with_mode/6) to avoid a same-name- different-arity clash with the new public start_publisher/3,4,5. Tested the same way as the terminal APIs, plus a live proof specific to the escape hatch's actual point: a real round trip through a test-owned callback module (not hecate_om's own) against the real demo-fleet station, for both publish and content, confirming the caller's module genuinely receives the SDK outcome. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>The prior commit proved a caller-supplied callback receives the SDK outcome, which is necessary but not sufficient: it never actually built or ran the retry-with-backoff / batch-upload scenarios that justified building the escape hatch in the first place. This commit does. hecate_om_pubsub_tests: a real retry-with-backoff coordinator, run to genuine exhaustion against the zero-link pool -- three real attempts, in order, with real backoff between them, notifying the original caller of every intermediate failure and the final outcome. hecate_om_content_live_station_tests: a batch-upload coordinator, run to real completion against the live demo-fleet station -- three concurrent uploads via start_feeder/3, a shared collector process, distinct MCIDs confirmed for all three. The first version of the retry test called start_publisher/4 again recursively from *within* handle_published/2 -- i.e. from inside a macula_publisher gen_server's own callback, in the same beat that gen_server was about to stop. That passed in isolation and under light load, then failed deterministically inside the full suite, and adding diagnostic io:format calls (which perturbs scheduling) made it pass again -- the signature of a genuine race, not bad luck. Raising the timeout made it worse: it stopped failing fast and instead hung for the outer EUnit group's budget before being cancelled. The actual fix was moving the retry decision into a separate, ordinary process that orchestrates N one-shot start_publisher/4 calls, each using the already-proven {simple, Pid} relay, rather than looping inside a short-lived per-attempt callback. This is also simply the more correct design for "fully decoupled from any caller waiting synchronously," the original justification for the escape hatch -- not a workaround, the right shape from the start. Confirmed clean over 8 isolated runs and 3 full-suite runs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>cmake alone got rebar3 lint/eunit compiling clean, but rebar3 ct then failed at boot: rocksdb's CMakeLists auto-detects system Snappy via find_package(Snappy) and silently disables it when missing rather than failing the build, so the NIF compiled fine but barrel_docdb's runtime config -- which asks for Snappy blob compression -- couldn't open it ("The specified blob compression type Snappy is not available"). lz4/zstd/bz2 go through the same silent auto-detect, so all four are installed now rather than fixing them one crash at a time. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>hecate_om_identity used to hand-roll the mesh pool's whole lifecycle: self() ! connect, a 5s retry timer, and erlang:monitor + DOWN to notice and reconnect if the pool died. Reading macula_client.erl directly showed both defenses were redundant: each seed link dials and retries forever on its own timer without ever crashing the pool process for an unreachable seed, and hecate_om.app.src already lists macula in applications, so standard OTP boot ordering means macula has finished starting before hecate_om ever does. The pool is now an ordinary hecate_om_sup child (restart => permanent) started via hecate_om_identity:start_mesh_pool/0 -- it runs after identity (an earlier sibling) has already loaded the keypair, so it reads that back rather than duplicating the loading logic, then registers the pool locally so macula_client/0 becomes a plain whereis/1 check with no gen_server round trip. The child is conditionally included: omitted entirely with no seeds configured, so macula_client/0 degrades to {error, no_client} exactly as it did before this migration, rather than a real-but-idle pool making "nothing configured" indistinguishable from "connected". The open boot-race question this comment carried is resolved, not assumed: a real application:ensure_all_started(hecate_om) boot with seeds configured resolves macula_client() with no poll or retry on the assertion itself, proven both against an unreachable seed (test/hecate_om_mesh_pool_SUITE.erl) and a real station (test_live/hecate_om_mesh_pool_live_station_tests.erl). The same CT suite also proves the actual point of "proper supervised child": kill the pool pid and confirm OTP, not hand-rolled code, brings up a new one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>hecate-tom-player's tom_wire_macula.erl was, before this, the one place in the workspace classifying a failed RPC call as worth retrying by asking macula_bolt4:is_retryable/1 instead of keeping a second copy of the BOLT#4 code table locally. hecate_om_wire: retryable/1 generalizes that instinct rather than porting tom's own three-way {ok,_}|{refused,_}|{unreachable,_} vocabulary, which is tom's own business framing, not a generic mesh concept: just the boolean every caller actually needs to decide whether to retry. {error, {call_error, Code, _Name}} is confirmed (via macula_station_link.erl's own doc table) to be macula's documented CALL-failure shape, not tom_wire_macula.erl's private convention, so this covers macula:call/5, call_station/6,7,8, and hecate_om_capabilities:call_capability/5,7 uniformly. Preserves the one non-obvious correctness detail from the original: macula_bolt4:is_retryable/1 raises for a code its own table doesn't recognize (confirmed by reading macula_bolt4.erl directly) rather than returning false, a real possibility across a protocol version skew -- caught here and treated as retryable rather than crashing the caller over an unrecognized code. Landed in hecate_om_wire.erl alongside piece F, as F's own module doc already anticipated. Also corrects a plan-doc misattribution from the original survey: tom_wire_macula.erl lives in hecate-tom-player, not hecate-tom-world. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>service_cert/0, realm/0, keypair/0, org/0, cert_chain/0, and realm_ca/0 were plain gen_server:call/2, which raises {noproc, _} if called before this gen_server has started. Confirmed by reading them directly, not assumed: hecate-biotope, hecate-society, and hecate-dronex each hand-roll a try/catch around hecate_om_identity:realm() specifically; biotope and society also wrap macula_client() -- which became dead code the moment piece A shipped a non-raising whereis/1 check for it, not just theoretically obsoleted. A shared safe_call/1 catches exit:{noproc, _} -- called before boot, or the process died between the registered-name lookup and the send -- and converts it to {error, not_booted}. A genuine timeout is a different, real bug and is deliberately left to propagate rather than silently degrading. org/0 keeps its own "always a binary" contract: not_booted collapses into the same <<"_">> placeholder already used for "unconfigured", not a new tuple shape callers would need to handle. Audited every internal call site in hecate_om/hecate_om_capabilities before landing -- all either delegate the {error, term()} shape through unchanged or already pattern-match a generic {error, _} catch-all, so widening the error set introduced zero breakage. 6 new EUnit cases prove the non-raising contract directly against a genuinely-killed gen_server (killed and confirmed dead first, restored after), not assumed from EUnit's test ordering in a shared VM where other modules in this suite start their own hecate_om_identity. This closes out the mesh-wrappers plan -- pieces A through H are now all implemented, tested, and (as of this commit) pushed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>advertised/3 discarded advertise_direct's {error, Reason} outright. put_advertisement/2's try ... catch _:_ -> ok end discarded BOTH a plain {error, _} return from macula:put_record/2 (never pattern-matched at all, not just the exception guard) and any real exception, with no logging in either case. Combined with register/1's handle_call always replying ok regardless of what do_advertise actually did, a service could run healthy indefinitely with its capability never reaching the mesh's DHT and nothing anywhere to say why. Also a correctness gap against this repo's own CLAUDE.md: a try/catch is only justified when it adds monitoring value neither branch actually did here. Both paths now logger:warning/2 the real reason, matching the existing hecate_om_pubsub:handle_published/2 precedent (same module, same style). Found live investigating why hecate_stations.list_stations was unreachable: macula-cli dht find-records-by-type (new subcommand, macula-io/macula-cli) confirmed the advertisement genuinely never landed in the DHT, but nothing in hecate-stations' own logs said why until this fix -- existing tests already exercised the failure path and now show a real reason (no_healthy_station in the test fixture's case) instead of silence. 82/82 existing tests pass, dialyzer clean.The actual root cause, found by deploying 0.16.2's new logging to hecate-stations (beam03) and reading it: {ok, no_keypair, ok} -- pool and realm both fine, no stable signing keypair. identity_key_path was simply absent from the scaffold template every service is generated from (priv/templates/hecate_service/sys.config.src), so every generated service inherits the gap unless someone remembers to add it by hand. Without it, hecate_om_identity:load_keypair/0 returns undefined forever -- the self-heal/auto-generate-and-persist path only fires when a path IS configured but the file fails to load -- so keypair/0 stays {error, no_keypair} permanently, and advertise_with/7 no-ops on every republish tick by design ('an ephemeral service cannot sign and is correctly not advertised'). This module's own comment already named this as a known recurring issue (hecate-tube hit it before); it just wasn't caught at generation time until now. Template now sets identity_key_path to /etc/hecate/secrets/identity.key, the same already-mounted secrets volume service_cert_path uses -- no new infrastructure needed. Added sys_config_configures_a_stable_identity to hecate_service_template_SUITE so a future template regeneration can't silently drop this again -- confirmed RED without the fix, GREEN with it. 82/82 eunit, 15/15 CT (incl. the new template test), dialyzer clean.The primitive already existed one layer down: macula:advertise/5's auth => {ucan_required, Issuer} policy, enforced on every inbound call by macula_station_link's authorize_policy/2. Nothing in hecate_om used it -- advertise_one/7's capability-map pattern never read an auth key to merge into the Opts it already builds for advertise_direct. New auth_opts/1 (pure, exported), merged alongside the existing cert-chain and reuse_sup opts. Default absent (open), matching every existing caller unchanged. 3 new tests, 85 total pass, dialyzer clean. hecate-rag still hand-rolls its own advertise loop and won't benefit until it migrates onto register/1 -- flagged as separate work in plans/PLAN_UCAN_GATED_CAPABILITIES.md, not done here. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PDq2jUtd2F5EYWQyEgp1g7Add auth key to capabilities, forwarding macula's existing UCAN gating policy through hecate_om_capabilities:register/1 -- see plans/PLAN_UCAN_GATED_CAPABILITIES.md. Add hecate_om_simple_handler, bridging macula's native {Module, Function} handler convention into macula_response's init/1 + handle_request/2 contract -- discovered as a real prerequisite while migrating hecate-rag's 15 capabilities onto register/1, not hecate-rag-specific. 89 tests pass, dialyzer clean, ex_doc builds clean for both new modules. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PDq2jUtd2F5EYWQyEgp1g7field/2,3 fixed the atom/binary KEY hazard but still returned the wire-level CBOR VALUE representation unchanged. A JSON string sent as an RPC arg is a CBOR text string (major type 3), which decodes to {text, binary()}, not a bare binary() -- a plain binary is reserved for a CBOR byte string (major type 2), a different wire type. Every is_binary/1 guard and :: binary() field spec downstream silently failed to match a real caller's payload, indistinguishable from a missing field. Found live 2026-09-01 diagnosing hecate-rag's get_document_verbatim: a temporary diagnostic log showed the actual payload as #{source_path => {text, <<"...">>}} -- the key lookup was already correct, the value never was. New unwrap/1 (exported, pure) recurses through list elements and map values, so a topics :: [binary()] or hits :: [map()] field round-trips correctly too, not just a flat top-level field. field/2,3 now applies it to whatever is found (or the caller's own Default) before returning. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PDq2jUtd2F5EYWQyEgp1g7hecate_om_ownership_proof:verify/3 proves a caller holds the private key for the Ed25519 identity they claim to be asserting on behalf of, inside an otherwise-open mesh payload -- a signature over {identity, timestamp, procedure}, procedure-bound so a proof minted for one gated capability can't be replayed against another. Extracted after the identical ~40-line verifier was written twice independently: hecate-citizens' citizen_ownership_proof and hecate-mail's mailbox_ownership_proof, each one's own moduledoc naming the exact trigger for consolidating -- a third, unrelated consumer. hecate-graph needing the same mechanism to make its learn_link provenance mind-grained (an individual mind's own signed identity, not just the wire-level connection identity spartan's shared mesh pool carries) is that third consumer. A different mechanism from {ucan_required, Issuer} capability gating (plans/PLAN_UCAN_GATED_CAPABILITIES.md): that controls who may call a procedure at all. This proves who asserted a specific claim inside one. Neither existing consumer migrated here -- no bug in either, out of scope for this extraction, worth doing later. 10 new tests, 120 total. ex_doc clean, elvis clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016vYH48rnRe3RhKqQVoJeLDcapability().auth gains {realm_member_required, RealmDid, RequiredCan} -- macula added this policy after PLAN_UCAN_GATED_CAPABILITIES.md was written and explicitly called the realm-membership case unbuilt in macula "today". auth_opts/1 needed no code change (already policy-agnostic); the type and moduledoc were the whole gap. A hecate-nvidia-pair implementation the same day had to bypass this module entirely to use the policy, purely because the type made it look unsupported through the normal path. describe_rpc_capabilities/0 + describe_pubsub_capabilities/0 (both optional): human-facing capability/topic documentation, distinct from capabilities/0's/subscriptions/0's dispatch-wiring-only metadata. When either is exported, boot/2 advertises a synthetic <service-name>.describe_capabilities RPC (hecate_om_describe, stateless) returning both lists live. Real motivating cost: macula- lazymesh's MeshServices catalog hand-maintains a hardcoded description list today purely because there's nowhere on the mesh to pull it from. Both optional, matching store_id/0's/subscriptions/0's own precedent -- a service with nothing to describe implements neither and gets no synthetic capability advertised at all. 131 eunit tests pass (8 new). RED/GREEN verified specifically on capability_for/2's "undefined when neither callback is exported" behavior. Dialyzer did not complete within a reasonable time in this sandbox -- not run to a result, flagging rather than claiming clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BFKNhxq5qzEXD6fbnFKjGgmacula encodes every map key as CBOR text, and its frame decoder turns a key back into an atom only when that atom already exists in the receiving VM. Otherwise the key stays {text, Bin}. field/2,3 looked up the atom form and the binary form only, so such a key read as absent and the caller got the default. The lookup now tries the atom form, then the binary form, then {text, Bin}. The first form present wins, as before. The moduledoc and field/3's doc describe the new order. New tests cover a text key reached from an atom literal and from a binary literal, a text key whose atom does not exist, and the lookup order. Without the fix, hecate_om_wire_tests gives 30 tests, 3 failures (the three text-key cases); with it, 30 tests, 0 failures. Full run on OTP 28.4.2: rebar3 lint clean, rebar3 eunit 135 tests, 0 failures. Refs #1 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013xRyALYtnYX1D7u5AiGWGchealth_ip (optional) sets the address hecate_om's health listener binds, as a string such as "127.0.0.1" or an address tuple, and passes it to ranch as {ip, Addr}. Unset or empty, the listener binds every interface, as before. A service whose health is probed only from its own container or host can keep the endpoint on loopback. Tests cover the socket options and a loopback listener refusing a connection on another interface. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyWXBuNgV8YGRLRsCZJG95hecate_om_identity treated every macula_identity:load/1 error as a first boot: it generated a new keypair and saved it over the configured identity_key_path. A corrupt file, a directory or unreadable file at the path, or a key file readable by group or others (which the next macula release refuses to load) therefore gave the service a new node id and destroyed its real key, with nothing in the logs. Now only {error, enoent}, a missing file, generates and saves a keypair. Any other load error makes keypair_from/1 return {error, {identity_key_unloadable, Path, Reason}}. init/1 stops with that reason, so hecate_om_sup and the service refuse to start and the file is left as it was. Tests: a corrupt key file is refused and left byte-identical; a directory at the key path is refused and stays empty, a real case even when tests run as root; start_link with a corrupt configured key returns the error, leaves the file unchanged and registers no process. First boot still generates and persists a puzzle-valid keypair. The group-or-others mode case needs macula 66c2c30 or later to go red; the same non-enoent clause covers it. On OTP 28.4.2: without the fix, hecate_om_identity_tests gives 18 tests, 5 failures (the corrupt file came back as a regenerated keypair and was overwritten, the directory path came back undefined, start_link succeeded and left the process registered); with it, 18 tests, 0 failures. Full run: rebar3 lint clean, rebar3 eunit 146 tests, 0 failures, rebar3 ct all 16 passed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013xRyALYtnYX1D7u5AiGWGcAdded since 0.24.0: - health_ip (optional): the address the /health listener binds. - describe_rpc_capabilities/0 and describe_pubsub_capabilities/0 (optional callbacks), served live through a <service>.describe_capabilities RPC. - The {realm_member_required, RealmDid, RequiredCan} auth policy in the capability() type. - read_model_ttl_sweep/0 (optional callback) arming barrel_docdb's TTL sweeper on a service's read model. Fixed since 0.24.0: - hecate_om_identity refuses to replace a key file that fails to load; only a missing file generates a keypair. - hecate_om_wire:field/2,3 finds keys that arrive as {text, Bin}. - hecate_om_SUITE expects the 16 hecate_om_service callbacks. vsn 0.25.0 in src/hecate_om.app.src; the CHANGELOG's Unreleased section becomes [0.25.0] - 2026-09-11. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013xRyALYtnYX1D7u5AiGWGcA service with no realm trust anchor started, went green, answered /health and was permanently unable to resolve anything org-namespaced. Traced off a deployed box: with no realm key pinned, macula_client:realm_key/2 answers none, macula_record:verify_authorization/3 refuses every advertisement with no_realm_key, and macula_direct_dial reports {unresolved, no_trusted_advertisement}. The boot claim never reached the realm, so there was no pending row for an operator to approve, no delegation and nothing callable. Every symptom was downstream of one unset variable, and nothing anywhere said so. BREAKING. realm and realm_key are both required now. realm_trust_opts/0 used to fall through to an empty map, which made unset indistinguishable from deliberately empty. It raises instead, and the pool does not start. An unconfigured trust anchor is not a deployment that half works. realm_key is a new app env: the realm's public signing key, hex encoded. MCL_REALM beside it is an IDENTIFIER, sha256 of the realm name, and was never a key. The two are different things and the old config only carried the first. THE DECODE LIVES IN mcl_om, and that is the decision worth stating. macula:connect/2 takes realm_trust as raw bytes and deliberately refuses anything else, because it is a typed in-memory contract. A deploy environment can only carry text. Translating one into the other is exactly what this module already does for realm, 64-hex to 32 bytes, and for every seed's expected_node_id. Putting it in the SDK would push deploy-shaped text into a typed contract; putting it in a service means every mcl-* service doing it again, which is the duplication that caused this. A malformed value names the variable rather than raising a bare badarg out of the hex decoder. THE SCAFFOLD TAUGHT THE BUG, so the template is fixed in the same commit. Its sys.config.src carried realm_trust commented out, called it necessary only for a service that CALLS org-namespaced capabilities, and said the realm's key comes from a foundation_realm_trust_list DHT record rather than from that file. That last claim is wrong for this path: macula_direct_dial never supplies the foundation form, so the pinned key is the only way an advertisement is ever trusted. Every service generated from the template inherited a mandatory setting that looked optional. The template, its compose file and its README now require MCL_REALM_KEY. FOR WHOEVER MEETS THAT ATOM NEXT: trusted_stations/2 filters on the authorization check AND a readable serving_station in the record. A record missing the latter is dropped silently and produces the identical no_trusted_advertisement. Do not assume it is this cause. Verified: the four new tests FAIL against the committed pre-fix module, 5 assertions red, and pass with the fix. Full suite 146 tests 0 failures, elvis clean, edoc builds. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>The verify_mode default flip and its loud refusal of an unrecognised value. Minor rather than patch in 0.x: it changes a default that reaches every consumer's pool, and it adds a boot failure on a value that used to be silently tolerated. Consumers on "~> 0.2" take it without a constraint change. is_checkout_publishable.sh derives the tag from {vsn, ...} in src/mcl_om.app.src and requires a CHANGELOG section for it, so the bump and the section name are what make v0.4.0 publishable at all rather than bookkeeping after the fact. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>This repo's next tag would have failed to publish, silently and with no reason printed, and nothing here would have changed to cause it. `rebar3_hex` 7.3.0 was published upstream on 2026-09-22 and reads NO environment variable for authentication. With the plugin unpinned, a tag run fetches it, ignores `HEX_API_KEY`, resolves no credentials, and dies on `{badmatch, #{...}}` at `rebar3_hex_publish.erl:372` with the bare message "Uncaught error in rebar_core". Nothing reaches hex. Found on macula's `v12.0.0`, which failed exactly this way today. This repo last published on 2026-09-21 with 7.2.0, hours before 7.3.0 existed, so it looks healthy and is not. ⚠ The publish workflow's `--dry-run` guard cannot catch this: a dry run never authenticates, so it passes with a placeholder key while the real publish dies. 7.2.0 reads `HEX_API_KEY` in `rebar3_hex_config.erl`. Verified on macula by running the publish under the pin with a throwaway config dir and an invalid key: it resolves 7.2.0, reaches hex.pm and is refused by name. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>macula 12 refuses 'verify' in any value -- on a seed, at connect and in call_station opts -- so the pool composes none and MCL_OM_VERIFY, verify_mode/0 and verify_mode_of/1 are gone with the three modes they chose between. A client verifies the station's own ML-DSA-87 certificate and nothing else; what binds a link is still the D16 expected_node_id pin. D30 makes the puzzle difficulty one fleet constant (still 8), and macula now REFUSES a {macula, puzzle_difficulty, _} setting at application start whatever its value, so it goes from test.sys.config and from the service scaffold every future mcl-* service inherits. The generate/3 option of the same name is untouched. Raf's 2026-09-23 ruling gives a machine one stored identity, so a suite that leaves node_identity_path unset reads -- and on a fresh machine writes -- the identity of whatever is running it. The suite now uses its own key file. The machine's key is not touched. The three pool_verify_* tests are replaced by one that asserts the new contract rather than dropping the coverage. 148 tests, 0 failures against macula 12.0.0-alpha.1 via _checkouts. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>mcl_om_claim:init/1 returned {stop, normal} with no seeds, which a supervisor reads as a failed start, taking mcl_om down with it. It returns ignore now. mcl_om_mesh_pool_SUITE's seeded cases never configured the realm trust mcl-om requires, so they failed before reaching macula. They pin a generated realm key now. Mutation-checked: verify => none back in base_pool_opts/0 turns the suite red with one_verification_mode. Both were red on main before the macula 12 port, unseen because lint-and-test only runs on workflow_dispatch. Released as 0.26.1. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>generate_and_save/1 returned undefined when saving a new identity key failed, so the service ran on a throwaway identity and generated another on every start: a new node id per restart, silently. It now returns {identity_key_unsaveable, Path, Reason}, which init turns into a stop, the same as an unloadable key already did. The scaffold's compose file mounts a named volume, <repo>-secrets, at /etc/mcl/secrets. With nothing mounted there, docker gave each recreated container a new anonymous volume, and so a new identity per watchtower roll. The volume is named explicitly so a different -p cannot fork it. Both test-first (seen red: got undefined; got nomatch). Released as 0.26.2. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>mcl_om_capabilities advertised under mcl_om_identity:org/0's `_' placeholder when no org was set: `_/Name', which no realm grants, from a service that looked healthy. It now advertises nothing unless the org is a wire segment, logs once, and records each handler-bearing procedure as not granted with {org_unset, Org}; mcl_om_provider_grant makes that degraded at once (operator_must_set_org). The live capability tests move to a real org, since under `_' they would no longer reach the SDK and pass for the wrong reason; `_' has its own test (red first). The scaffold sets {org, <<"<repo>">>} in sys.config.src (one org per service, named after the repository, fixed in the release). Its README, compose and sys.config no longer describe 11.x, a classical-profile fallback macula 12 does not have, or CI publishing :latest on tags; the README states the two image channels and where the org comes from. Comments no longer name obsolete services, and the house-specifics test forbids that prefix in generated output. Tests: generated_service_has_its_org and generated_text_is_current (red first); the rendered sys.config parses after substitution. Released as 0.26.4, carrying the template fixes already on main. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>mcl_om_ownership_proof:verify/3 read timestamp, signature and public with maps:find/2 on atom keys. A proof decoded by macula's codec carries every key as {text, Key}, so every proof a caller actually sent was refused as missing_proof, forged and genuine alike, before a signature was checked. The fields are read through mcl_om_wire:field/2 now. The suite's wire-shaped test built that shape by hand with atom keys; two new tests send the proof inside a CALL through macula_frame and verify what comes out. Release 0.26.6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>A service with no usable org (unset, empty, `_`, an unexpanded ${MCL_ORG}, anything that is not a wire segment) booted, logged "advertise skipped, no org configured" and ran green without advertising or claiming: a bot on beam01 went unnoticed that way. mcl_om:boot/2 now refuses before wiring anything, naming the setting; mcl_om_identity:checked_org/1 is the rule. mcl_om_claim:labels/0 treated an empty app env value as a label, so a sys.config `{box, <<"${MCL_BOX}">>}` with the variable unset sent an empty box instead of falling back. Empty now falls through to the OS variable and the service name. Tests first: mcl_om_org_tests (7 refused shapes, 4 accepted), mcl_om_claim_tests (empty app env), mcl_om_SUITE boots a service on an unexpanded ${MCL_ORG} and expects the refusal. The SUITE's other cases now boot with an org, as every service must. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>macula 12.2's macula_publisher returns {ok, Pid} before announcing, so a failed start announcement ends the publisher after the start; a crashed publish worker ends it too. Started with start_link from the caller, either exit killed the service process that called mcl_om_pubsub:publish/2. Each publisher now runs under a watcher that traps its exit: an abnormal exit is logged, counted (failed_publishes/0, and `failed_publishes` on /health), and answered to a sync caller at once as {error, {publisher_exited, Reason}} instead of after its timeout. A start that raises answers the caller {error, {publisher_not_started, Reason}}. `publisher_opts` passes macula_publisher's own options through, so `announce => false` publishes the payload without the two fact frames. publish/2,3 keep their contract. Test first, failures injected through macula_publisher's publish/fact_publish options. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>The realm's Providers desk counts a node online only while it has an unexpired procedure advertisement signed by it, so a publish-only service (the mpong bots) advertised nothing and always showed offline while it worked. mcl_om:boot/2 now adds `info` to every service's capabilities, advertised through the same delegation path (it appears once the org is admitted), open to any mesh caller. The reply is public facts only, strings as {text, _}, no booleans: name, version, description, service_name, box, org, node_id (hex), macula and mcl_om versions, uptime_s, the health word and the Org/Name procedures it advertises. The health word comes from mcl_om_health:last/0, the verdict /health last computed, never a fresh probe per call, so an open caller cannot drive the service's own health checks. A service that declares its own `info` refuses to boot: {mcl_om_capability_name_reserved, <<"info">>}. Tests first: the reply shape, public keys only, the verdict words, a round trip through macula_frame (every string arrives as text), the name clash, and a booted service answering. READMEs updated; mcl-om's status said 0.26.x. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>The many-provider contract model (a thousand book clubs, one get_bookclub_by_id) needs a caller-side pin: resolving under Org/Name returns every provider, a club that does not own the asked id answers not_found, and not_found is a valid answer, not a failover signal -- so the wrong club wins by record order. The fix is a pin, not a smarter retry: Opts gains advertiser => node_id, the caller names the node that published the facts it consumed, only that provider is dialed, and a stale pin fails closed as {error, no_provider}. mcl_om:call_capability/5 is the facade; pinned_providers/2 is exported and unit-tested.Raf, 2026-09-25: delete rather than rewrite. No mcl service called mcl_om_content (grep across macula-services: only build artefacts), and macula 12.6.0 (D27) made share_content/get_content/unshare_content the calls a service wants. Removes mcl_om_content, mcl_om_content_feeder, mcl_om_content_downloader and their tests; the guide's chapter 4 now shows the macula calls with #{org => Org}. Breaking for a 0.x: 0.30.0. mcl_om keeps requiring macula ~> 12.2; a service that shares content requires 12.6.0 itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>9c576f0) 5f7e912092New app env `mesh`, `optional` (default, unchanged) or `required`. With `required`, init/1 stops with {mcl_om_mesh_unconfigured, #{missing => [...]}} naming each of MCL_REALM, MCL_REALM_KEY, MACULA_STATION_SEEDS and MACULA_STATION_NODE_IDS that is unset, empty or left unexpanded by relx. An unset seed list used to boot a green service with no pool. Whatever the mode, a set realm that is neither 32 bytes nor 64 hex is refused as {mcl_om_realm_malformed, ...}; an empty MCL_REALM used to stop the process with {case_clause, {ok, <<>>}}. The check runs before the node key is loaded or generated. Tests first, seen red (7 of 8). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>- sys.config.src sets {mesh, required}; rebar.config floors mcl_om at ~> 0.33 (was ~> 0.26), and the suite holds the floor to the released minor. - scaffold-service.sh requires MCL_VISIBILITY (private|public). It sets the licence (proprietary notice or Apache-2.0, in LICENSE, app.src and README), the CI runner ([self-hosted, msi00] for private services in macula-services and macula-internal, ubuntu-latest otherwise; self-hosted for public is refused) and the gh repo create flag. New template variables proprietary, runs_on and holder (the Apache LICENSE hardcoded the holder). - Closing text: a tag publishes only its version, deployment is macula-fleet's, remote is origin, package note matches the visibility. - README and guides follow; the deployment guide's rollback text matched to the two channels. Template suite: 8 new or tightened cases seen red, now 31 pass (the one skip is the existing no-container-runtime case). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>mcl_om_claim settles on the bare {error, <<"not_admitted">>} macula 13 returns as well as the older call_error shape; each change of the claim's state is one log line naming realm and org; /health carries it under `claim'. Found on mcl-fovea's first boot: the realm had filed the claim as pending, and the service kept re-sending it every minute, silently. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>The claim runs inside the worker (init/1 and every retry) and a call to an unreachable realm takes up to 15 s; status/0 asked the worker with a 5 s timeout, so /health could 500 mid-call (Mercurius). The worker now writes {Claim, Since} to a persistent_term on every change of kind; status/0 reads it, no entry being no_mesh. scaffold-service.sh refuses a non-JSON MCL_RUNS_ON (Mercurius's observation). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>Mercurius's review of 0.34.0: 1. A bad `confidential' value still booted green and unreachable: confidentiality_verdict/2 looked only at `required', so a typo passed register/1, then confidentiality_opts/1 raised inside advertise_one/6 on every republish tick, caught as a warning. The verdict now runs the whole check in the caller, in order: a value other than off/preferred/required ({mcl_om_confidential_not_a_provider_mode, #{capabilities => [{Name, Value}]}}), a kem_advertise that is neither enabled nor disabled ({mcl_om_kem_advertise_not_a_switch, ...}; macula raises not_a_switch on every advertise otherwise), then `required' without kem_advertise enabled. 2. `off' is a real provider mode in macula 13 (confidentiality(off, _) is {ok, #{}}): it keeps a procedure keyless while kem_advertise is enabled, where absent means macula's `preferred'. It is now forwarded, and the type, the doc, README and CHANGELOG say what it does. Tests: off is carried; the verdict names every capability with a bad mode; a non-switch kem_advertise is refused; register/1 refuses a misspelled mode at boot; confidentiality_opts/1 still refuses a bad mode by name. Seen red first. eunit 262/262 and dialyzer clean, run on msi00 in the CI image (host00 slot rule). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>publish/0 (mcl_om:advertise_capabilities/0) advertised every capability inside its gen_server default of 5 s, the shape register/1 had: it now replies and advertises right after in the same process (Neptunus, reviewing 0.33.3). Red first: a 3-capability publish with a 2 s advertise each failed {timeout,{gen_server,call,[mcl_om_capabilities,publish]}} on the old code. Three identity tests generate a real key (first boot with its puzzle grind, an existing key saved and loaded back, a key whose save fails), which on msi00 at load 19 outlived eunit's 5 s and was cancelled. Each has its own timeout now; at --cpus=0.25 the module passes, 39 tests, and was cancelled before. The mcl-om#10 plan records the consumers' measured exposure (only bookclub and bookclub-gleam could float onto 0.35 unmigrated; phoenix, tube and whiteboard are held by their macula 12 pin) and the storeless M3 services. CHANGELOG [0.35.0] counts mcl-rag's 18 capabilities, not 17. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>_testand a 5 s stray wait 9c40988029macula ~> 14.11 -> ~> 15.6 (macula#105, macula-fleet#27). Wire 1.0 carries 1 to 8 serving_stations per procedure advertisement (macula-station#55): build_advertisement/5 publishes [Station]; decode_resolved/1 and lookup/1 yield one {advertiser, serving_station} per listed station. Major version so no `~> 0.x` service floats onto a wire the live fleet cannot speak. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>A capability test that builds its own request map tests the handler against the shape the handler expects, which is how mcl-chess 0.7.1 passed 206 eunit tests and then refused every real call on the live mesh (mcl-chess#10). The wire delivers text keys as {text, Bin} and the verified caller under the atom key as a raw 32-byte node id, and a reply's plain binaries go out as CBOR byte strings while a raw node id tagged as text is refused outright. mcl_om_wire_test:call/3 closes that gap for any service's suite: it encodes the request with macula's own codec, decodes it through macula_frame:plain_payload/1 which is the provider's own path, merges the caller the way macula_station_link:with_caller/2 merges it (a peer that names itself is dropped), runs the handler inside the request's caller context the way the link does, puts the reply through macula_frame:check_payload/1 before anything else, and answers the client's view. A handler that refuses with the behaviour's own {error, Reason, NewState} is answered as the client answers it, {error, Detail} carrying the reason's name, instead of crashing the test on a badmatch. The two directions do not convert the same way, on purpose. A request is authored by a JSON client, so strings are text; a reply is the provider's terms, so a plain binary stays a byte string, because smoothing that over would hide the very fault this helper exists to catch. A boolean in a request is refused rather than translated to 1/0. Its own suite pins the killing power rather than the convenience: a fixture handler written the way mcl-chess wrote one is refused by the helper, and the same capability written against the wire answers through the same path. That second fixture reads its caller through mcl_om_wire:caller_hex/1 (1.1.0), so the two released helpers are exercised together. The template's capability note now points a new service at the helper. Co-Authored-By: Claude Code <noreply@anthropic.com>The client view ran the decoded reply through mcl_om_wire:unwrap/1, which maps {text, Bin} to Bin and passes a plain binary through unchanged. A reply carrying {text, <<"x">>} and one carrying <<"x">> therefore both read as <<"x">>, and macula_frame:check_payload/1 accepts bytes, so a responder that regressed a field to a bare binary kept every test green while its clients got a blob where they expected a string. That is the mirror of the fault the helper exists to catch. The strict decoder already tells the two apart: {text, Bin} for CBOR text, a plain Bin for CBOR bytes. The client view keeps that apart now, naming a byte string {bytes, Bin} and unwrapping text as before, which is also how the request side authors bytes. An existing assertion such as ?assertEqual(<<"checkmate">>, Field) fails on a bytes field, so a consumer's tests need no change. Pinned by two tests: a reply's byte string does not read as text (both shapes, plus the inequality the capability assertion relies on), and a byte string nested in a list is named as bytes too. eunit 358/0, dialyzer clean, lint clean. Co-Authored-By: Claude Code <noreply@anthropic.com>priv/templates/mcl_service/rebar.config emitted {mcl_om, "~> 1.0"} while mcl_service_template_SUITE derives the expected floor from mcl_om's own version, so `rebar3 ct` has been red on main since 1.1.0. At both 1.1.0 and 1.2.0 the job failed with generated_service_floor_is_this_release: expected: "~> 1.2", got: "~> 1.0" and hex published anyway, because the publish workflow does not depend on the test job. The template now emits ~> 1.2, so the suite's policy holds: a service scaffolded from this release starts on the release it came from. A generated service is unaffected in practice, since ~> 1.0 also resolves the newest release; what was broken was the statement the floor makes and the check that guards it. Whether a tag should publish while that job is red is a separate decision, recorded on #33. rebar3 ct 48/0 (the suite that was red), eunit 358/0, dialyzer clean, lint clean. Co-Authored-By: Claude Code <noreply@anthropic.com>Two review findings on macula-codebase-checks#11, and the release that carries them. 1. THE TEMPLATE SAYS WHAT A GENERATED SERVICE MEETS. It calls the advisory gate but ships no .github/advisories-waivers.txt, so a new service goes red on the first advisory it inherits and stays red until that advisory is fixed or a dated, owned row is added. That is the gate working, and the comment now says so instead of leaving a scaffold's author to work it out. 2. THE FLOOR FOLLOWS THE RELEASE. {mcl_om, "~> 1.2"} becomes "~> 1.3", which is what mcl_service_template_SUITE:generated_service_floor_is_this_release derives from this release's own vsn. Left at 1.2 it would be the #33 defect again. 3. THE RELEASE IS A MINOR, not a patch: cowboy "~> 2.12.0" to "~> 2.18" is the base dependency of every generated service, and the CHANGELOG names what it buys and the one advisory it does not (cowlib EEF-CVE-2026-43966, waived, dated 2026-11-20, owner ceres: no released cowlib carries the fix, and a git dependency would hide the advisory from the gate rather than fix it). Verified on this tree with the templates installed from this checkout into an isolated HOME: rebar3 eunit 358 tests, 0 failures; rebar3 ct 49 tests, 0 failures, template suite included. Refs macula-io/macula-codebase-checks#11 Co-Authored-By: Claude Code <noreply@anthropic.com>macula 18 stops serving openly by default (macula#147): an advertise with no `auth' is refused, a subscription with no `sources' is refused, and `macula_subscriber:start_link/6' replaces the arity-5 call. mcl_om moved onto `~> 18.0' and now makes both mistakes unrepresentable at boot, naming what is missing, instead of leaving them to the SDK. Capabilities: `mcl_om_service:capability()' names macula 18's call class `{callers, members | role | {nodes, Ids}}' beside the policies it already forwarded, and `mcl_om_capabilities:register/1' refuses a capability that names a handler and no policy (`{auth_required, [Name]}'). Only handler-bearing capabilities are asked: a capability with no `handler' is a discovery record, which macula does not gate. `auth_opts/1' loses its silent `#{}' default, and `unguarded_capabilities/1' and its boot warning go, since the warning described a default that no longer exists. The synthetic `<service>.describe_capabilities' names `auth => open'. Subscriptions: `subscriptions/0' returns `#{topic, module, args, sources}' with `sources' required and `{open, Reason}' for an opt-out that someone wrote down. `validate/1' is pure and runs in `mcl_om:boot/2' before the service's own `start/1', so a bad declaration leaves no half-built tree behind; the reconciler compares the WHOLE declaration read back from the child spec, so changing one subscription's sources, module or args restarts that subscriber and no other. A start failure is logged once, kept per topic and reported on `/health', where it degrades the verdict instead of hiding behind `ok', and cleared when that topic next starts. `/health' gains a `subscriptions` key in every state (declared, running, last failure per topic), read lock-free from ETS the way the grant and liveness tables are, so a probe never queues behind a reconcile that is subscribing. `body/6' becomes `body/7', and `subscriptions' joins the key names boot refuses from a service's own `info()'. Gates, all run locally on this tip: rebar3 lint, xref, eunit (396), ct (51), dialyzer. Co-Authored-By: Claude Code <noreply@anthropic.com>THE DIAL WAS THE IDENTITY, NOT THE NETWORK. Last commit recorded that every fleet station refused the connection and could not say why. It can now: a station admits a node whose identity key proves the fleet's proof-of-work puzzle, and refuses one whose does not -- at the dial, before any realm or wiring is discussed, so a plain key reads as an unreachable fleet rather than a refused one. scripts/measure-sealing.escript now generates the key at macula_node_keys:puzzle_difficulty(), which is the same thing every live test and every service already does. The repo's own live suite had the same symptom from this host, so the diagnosis cost more than the fix. AND THE LISTING IS REAL. scripts/measure-sealing.escript took 201 advertisements from a fleet station, 170 of them in the fleet's realm, and the listing is BYTE IDENTICAL to the one macula-mcp returned for the same realm on the same afternoon. Two SDKs, one answer: what follows is a measurement of the fleet, not of a client. services expected 20 (19 in the plan, plus mcl-fovea -- see the last commit) services seen 20 procedures listed 170 keyed 103 keyless 67 (0 with a written opt-out, 26 not a service) findings 41 NO-OFF, all of them Forty-one is the honest number today: release A does not exist, so no service can write `off`, and every keyless service procedure is clear by omission. That is the baseline release B is measured against, which is the whole reason this exists. RULE A LEARNED ONE THING FROM THE REAL DATA. An agent's ring procedure and the realm's identity surface are keyless and always will be, and a written not-a-service claim is already their reason -- so a procedure under a declared prefix is exempt from NO-OFF, and the summary counts it separately rather than folding it into the fleet's clear procedures. 67 keyless, 26 of them not services, 41 the fleet must answer for. 28 cases, 0 failed; eight mutations of the checker (any one rule disabled or mis-matched) all turn it red.* subscription: a sealed group, admitted by a token the subscriber never holds mcl-om#49. The publish side has had its hook since mcl-tenders (`publisher_opts => #{publish => Fun}`, the token read at the publish); the subscribe side had none, so a service that publishes its facts sealed could not subscribe to them through mcl_om at all. It had to hand-roll a subscriber and lose the reconcile, /health and the fail-closed bookkeeping. A subscription may now carry `group` and `admission`, valid only together. `group` is the sealed group's prefix, which `topic` must be under on a segment boundary; `admission` is {M, F, A}, called as apply/3 with exactly those arguments and nothing added, answering {ok, Token} or {error, Reason}. Declared wrong, the boot is refused naming the topic, the way a missing `sources` already is. THE TOKEN LIVES FOR ONE CALL. mcl_om starts such a subscriber with its own `subscribe` function (macula_subscriber:start_link/6's `subscribe` option): the admission is called there, and the token goes straight to macula:subscribe/5 beside the group. The child spec carries the fun and the {M, F, A} and never the token; macula_subscriber keeps no options in its state at all; and a refused admission is reported by a fixed atom rather than by whatever it answered or raised with -- an admission reads a token and can fail holding it, so echoing that term is exactly how a token would reach a crash report. The tests look for a canary in the child spec, in the read-back, in the recorded failure and in the /health report, and the whole run prints it nowhere. CALLED ONCE PER ATTEMPT, NEVER ON A TICK: a first start, a restart, a pool replacement, a changed declaration -- not the 30s reconcile that finds the subscriber running and matching. Nothing is cached in mcl_om: once the group is joined, a later epoch pull is macula's keyring's business. FAIL CLOSED. A refusal starts nothing, is recorded per topic, and degrades /health naming the topic and the reason ({group, {admission, Reason}} for ours, macula's own verdict once one is presented). No fallback to a clear subscription, ever. The declaration-equality check gains both keys, so changing either restarts that subscriber and no other; a declaration with neither reads back exactly as it did before. Minor, not patch: a service that wants a sealed subscription has to declare two keys it could not declare in 1.6, and mcl-tenders#4 is waiting on it. 1.7.0. Refs mcl-om#48, mcl-tenders#4. Co-Authored-By: Claude Code <noreply@anthropic.com> * subscription: a raise out of the subscribe call does not print the token Pluto found the publisher side logging a publisher's raw exit reason with `~p`, the group token living in the keyring's state; Uranus files that separately. This is the subscribe-side twin, and the fun mcl-om#49 added is what puts a token in that position: `macula:subscribe/5` is not ours, and an exception raised from it carries the call's own arguments -- a `function_clause` reason IS the argument list, which is the options, which is the token. The subscriber's start failure keeps that reason and `recorded/3` logs it with `~p`, so the token reached a log line and `/health`. Probed before it was fixed, with the canary as the token: subscription to .../tender_notice_reported_v1 did not start: {function_clause, [{macula_pubsub, subscribe, [not_a_pool, <<0:256>>, <<"...">>, <0.9.0>, #{group => <<"...">>, sources => {org,<<"...">>}, ucan_token => <<"CANARY-admission-token-do-not-print">>}], ... `handed_over/7` now answers the fixed atom `subscribe_raised` for a raise and never passes its reason on: the token dies at the frame that held it. Fail closed is unchanged -- nothing subscribes, the topic is recorded with the reason, `/health` degrades naming it, and the next 30s tick retries -- only the cause is less specific than it would be for a call that holds no secret. The test drives a real start under the real supervisor with a pool that is not a pool, captures every log event, and asserts the canary is in no recorded failure, no `/health` report and no log line -- and that the log capture really saw that start, so "the canary is not in the log" is not vacuous. Also the scaffold's floor: `priv/templates/mcl_service/rebar.config` still emitted `{mcl_om, "~> 1.6"}`, and `mcl_service_template_SUITE` derives the expected floor from mcl_om's own version, so `rebar3 ct` was red on the 1.7.0 tree. CI would have caught it; the local gate did. CONTRIBUTING and service_anatomy now name the same floor. Refs mcl-om#49. Co-Authored-By: Claude Code <noreply@anthropic.com> * subscription: an admission's own refusal is not reported as itself Terra's r1, REQ1 (security). `admission_token/1` passed `{error, Reason}` through unexamined, so an admission answering `{error, {expired, Token}}` -- which is what a real admission looks like when the token it just read has expired -- put the token in `recorded/3`'s log line and in `/health`, and a test pinned that pass-through. Probed before the fix: the canary reached `failures/1` through `{group, {admission, {expired, CANARY}}}`, while the module doc and the CHANGELOG claimed the opposite. The only reason that survives is an ATOM: `no_admission_token` and the like are the operator's lead and can carry nothing, so they pass through; a term becomes the fixed atom `admission_refused`, a raise stays `admission_raised`, and the SDK raise stays `subscribe_raised`. The test that pinned the pass-through now pins the atom, and a new one drives a real start under the real supervisor with an admission that refuses with the token in a tuple, and asserts the canary is in no recorded failure, no `/health` report and no log line -- and that the term it arrived in is gone from the log too. Two observations from the same review, folded in: - A test that the admission is asked again on a second attempt, by an admission that reports each call: nothing is cached, which is the only way a rotated token ever reaches macula. - An admission runs inside the reconcile server (through `supervisor:start_child/2`), so one that blocks delays every other subscription's reconcile and the `/health` report with it. Said in the module doc, the README and the guide rather than bounded here: what an admission does to fetch a token in under a second is the service's design. And the claims corrected where they were wrong: "in no state and in no log" is true of mcl_om's own artefacts and node-wide only once macula-io/macula#189 lands, which Terra filed -- the SDK keyring keeps the ucan in its state and `macula_node_keys:redacted/1` leaves it there. The CHANGELOG bullet, the README and the guide now say exactly that. Local on this tree: eunit 463/0, ct 51/0, dialyzer, xref, `rebar3 lint`, sealing 42/0. Refs mcl-om#49. Co-Authored-By: Claude Code <noreply@anthropic.com> --------- Co-authored-by: Claude Code <noreply@anthropic.com>* Per-procedure inbound limits from the node's config {inbound_guard, #{procedures => #{<<"org/proc">> => Limits}}} sets one procedure's limits (and envelope) per environment without a rebuild: merged over the capability's declared limits, under runtime set_limits. validate_config/0 checks the whole block at guard boot. Refs #19, Refs macula-services/mcl-echo#11 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Boot refuses a procedure entry whose per_caller_max exceeds its global_max Terra R1 on #19: validate_configured/1 ran only the key check, so the entry passed boot and its procedure was then never advertised. Docs name what boot cannot know (the capability's own numbers, a name that matches nothing). Refs #19 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Release 1.8.0 Per-procedure inbound limits from config (#19, PR #61) and slices A-C of #51 (scaffold). The template asks for mcl_om ~> 1.8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>The work's start function answers as a supervisor child's does. {ok, Pid, Info} runs the work as {ok, Pid} does; ignore ends the guard as an ignored child, and global drops its name with it. Before, both crashed the guard with a case_clause (Jupiter, r1). The moduledoc now says that a netsplit runs one copy per connected partition, and that resolve/3 keeps one when the parts meet (Jupiter's note, r1). Refs #8a8e35a1) into mcl-core: its history comes along (Refs #1) c815dbbaf7- mcl_core_transport (src/contract/): the seam between the contract and a transport. mcl_core:call_capability/4,5 reach the wire through it, and mcl_core_bridge (src/bridge/) is its one transport in 1.0, delegating to the mesh code unchanged. src/lan/ holds a note for the LAN transport. - docs/DESIGN.md and assets/mcl-lan-{context,container}.svg, moved from macula-services/mcl-lan at 4020832, with a §9 appended on what changed since (mcl-core, §8 void, what P1 leaves for P2 and P3). README shows the model, ex_doc carries both. - CHANGELOG: mcl_core 1.0.0 and how a service moves from mcl_om.Landed on main as
1256ced9dfby fast-forward from423fe1a9; the mcl-om history comes along unchanged. Closing.Pull request closed