- Erlang 72.8%
- Python 18%
- Shell 5.3%
- Dockerfile 3.9%
| .github | ||
| apps/mcl_bookclub_observer | ||
| architecture | ||
| assets | ||
| config | ||
| deploy | ||
| scripts | ||
| .gitignore | ||
| .tool-versions | ||
| CHANGELOG.md | ||
| Containerfile | ||
| LICENSE | ||
| README.md | ||
| rebar.config | ||
| SECURITY.md | ||
Where mcl-bookclub is the producer — events, projections, emitters — this service is the consumer. It owns no reckon-db store and never dispatches a command: it watches the fact topics and answers its question ("what has the bookclub been up to?").
What it does
| Topic (published by mcl-bookclub) | What the observer does with it |
|---|---|
bookclub/member/member_registered_v1 |
records the member |
bookclub/book/book_procured_v1 |
records the book as on-shelf — unless it is already retired |
bookclub/book/book_retired_v1 |
supersedes: records the book as retired, in any arrival order |
Each fact goes through the three-module shape from mcl_om's
guides/read_model_services.md: a listener (a macula_subscriber, wired
by subscriptions/0) hands the payload to a policy, then writes the
decision to the read model (one sqlite file, absolute idempotent writes).
The policy is where the wire shape is unwrapped, with
mcl_om_wire:field/2, and where the admit/supersede decision is made: the
retired-book rule is the reason it is its own module.
Its own procedure, mcl-bookclub-observer/get_scoreboard, answers from the
local read model and then verifies the bookclub over the mesh by calling
mcl-bookclub/get_bookclub_by_id for every club the answer names, which
get_scoreboard.erl verifies one by one — a live cross-service call on every
answer, reported as bookclub_verified. Beyond it
mcl-om adds mcl-bookclub-observer/info and
mcl-bookclub-observer/get_limits to every service, both open, and
capabilities/0 is the list.
Why it exists
This service is the end-to-end proof of the FACT transport: the bookclub
emits, this observer consumes, and the two meet only over the mesh. Its
tests cover everything except the mesh itself (the one mesh call is mecked,
like every fleet suite); the live smoke test is the scoreboard's
bookclub_verified => yes on a box where both run.
Status
First version: the three ingestions, the supersede policy, the scoreboard, and the verification call. Not yet: history/trends, per-member views, paged lists.
Running it
rebar3 compile
rebar3 eunit
rebar3 lint
rebar3 dialyzer
scripts/health.sh # against a running node
The runtime is pinned to OTP 28.4.3 (.tool-versions, Containerfile, lint
workflow); run mise x erlang@28.4.3 -- rebar3 eunit if your shell is on
another release. Building the image: podman build -t mcl-bookclub-observer -f Containerfile ..
Configuration
config/sys.config.src carries the realm, its trust anchor and the PQ
profile; deploy/docker-compose.yml is runnable as-is (MCL_REALM,
MCL_REALM_KEY, station seeds, and MCL_COOKIE from the environment). The
read model lives on the /data volume.
Architecture
The C4 model is in architecture/README.md, with its
diagrams drawn by architecture/c4_diagrams.py into assets/. Change the
script, run it (python3 architecture/c4_diagrams.py), and look at the result
before committing.