No description
  • Elixir 91.8%
  • CSS 3.1%
  • Python 1.8%
  • Shell 1.7%
  • JavaScript 1%
  • Other 0.5%
Find a file
beamologist d0c531cf93
Some checks failed
ci / image (amd64) (push) Has been skipped
ci / attest (push) Failing after 0s
c4 model / c4-model-1 (push) Successful in 3s
c4 model / c4-model (push) Successful in 0s
ci / gates (OTP 28.4.3 / Elixir 1.18.4) (push) Failing after 2s
ci / guard-1 (push) Has been skipped
ci / guard (push) Successful in 0s
ci / elixir in . (push) Has been skipped
ci / elixir in . (container) (push) Successful in 7s
ci / Dependency advisories (push) Successful in 0s
Merge PR 3: advisories: the cowlib waiver goes, the resolve takes 2.22.0 which carries the fix
2026-11-24 04:09:17 +01:00
.github advisories: the cowlib waiver goes, the resolve takes 2.22.0 which carries the fix 2026-11-24 03:51:32 +01:00
apps r1: the crew facts come from the realm's own node, so pin it rather than members 2026-10-30 23:15:34 +01:00
architecture r1: the crew facts come from the realm's own node, so pin it rather than members 2026-10-30 23:15:34 +01:00
assets mcl_om 1.6 / macula 18: every crew-fact subscription names its source 2026-10-30 23:08:18 +01:00
config r1: the crew facts come from the realm's own node, so pin it rather than members 2026-10-30 23:15:34 +01:00
docs/design Release v0.2.0: the owner's ladder and work packages (#9) 2026-10-06 10:57:18 +02:00
guides kanban#40 (b): the board acts on a crew by its key, and drops one the realm forgot 2026-10-27 07:57:11 +01:00
rel The read model on Ecto with migrations, run before boot (#10) 2026-10-06 13:02:57 +02:00
scripts kanban#28: fill_board.sh enlists into a crew, as its operator 2026-10-26 16:45:51 +01:00
.containerignore test: the board as an mcl-om service, part 1 of #1 (red) 2026-10-06 01:58:08 +02:00
.credo.exs test: the board as an mcl-om service, part 1 of #1 (red) 2026-10-06 01:58:08 +02:00
.dialyzer_ignore.exs kanban#40: a crew the realm admits is appointed on the board, and a dropped crew loses it 2026-10-27 02:16:12 +01:00
.formatter.exs test: the board as an mcl-om service, part 1 of #1 (red) 2026-10-06 01:58:08 +02:00
.gitignore test: the board as an mcl-om service, part 1 of #1 (red) 2026-10-06 01:58:08 +02:00
.tool-versions test: the board as an mcl-om service, part 1 of #1 (red) 2026-10-06 01:58:08 +02:00
CHANGELOG.md r1: the crew facts come from the realm's own node, so pin it rather than members 2026-10-30 23:15:34 +01:00
Containerfile /health on a Unix socket, not a port (#23) 2026-10-07 20:46:54 +02:00
LICENSE Initial commit 2026-10-06 01:04:39 +02:00
mix.exs mcl_om 1.6 / macula 18: every crew-fact subscription names its source 2026-10-30 23:08:18 +01:00
README.md README: add the Buy Me a Coffee badge 2026-11-23 22:20:26 +00:00
SECURITY.md SECURITY.md: response times, attachment and identity rules, drills (macula-io/macula#174) 2026-10-31 02:59:23 +01:00

mcl-kanban

Buy Me a Coffee

Kanban boards for the mesh. This exists so the crew can pull its next card from a board on our own mesh, in Raf's order.

One board per repo, one card per GitHub issue. Agents claim cards in rank order with a plain mesh_call; a prioritiser keeps one rank scale across all boards; the owner works the boards from a LiveView. Issues stay the public record of WHAT; the board holds WHO and ORDER.

Layout

An Elixir umbrella on mcl_om, one app per department:

App Department Holds
guide_card_lifecycle CMD the board, card, package and crew aggregates, one desk per command (command, event, maybe_* handler), the role gate (Actor)
project_boards PRJ one {event}_to_{table} projection per event into one sqlite file (ProjectBoards.Repo, schema in priv/repo/migrations): boards, cards, card_tags, card_links, card_comments, card_approvals, crew, crews, packages
query_boards QRY get_ladder, get_boards, get_board_by_repo, get_card_by_id, get_cards_by_holder, get_goal, get_next_card_for_agent, get_ranked_cards, get_crew, get_approvals
mcl_kanban service the mcl_om contract, the event store it opens itself, and a responder per procedure; mcl-om adds mcl-kanban/info and mcl-kanban/get_limits to every service, both open
mcl_kanban_web UI the owner's LiveView

Every card is its own stream (card-<digest of owner/repo#n>), so claims on one card are serialised: two agents claiming at once get one card and one already_claimed. Status is bit flags (card_status: QUEUED 1, CLAIMED 2, BLOCKED 4, FINISHED 8, WITHDRAWN 16, PINNED 32).

Work packages group cards: a GitHub issue labelled work-package is a package (package-<digest of owner/repo#n>), ranked on its own scale by the prioritiser, and its cards (its own issue and its sub-issues, from any repo) are filed in it. Agents claim in ladder order: package rank, then card rank.

The owner's UI

One LiveView, the rank ladder, as drawn in the approved mock docs/design/owner-ui-v2-mock.html: cut by work package or by repo, with the crew on duty beside it and a card drawer. Drag a card, or select it with j/k and move it with shift+arrows: it lands between its neighbours with one owner rank, which pins it. Enlisting, opening a board, queueing a card and every action that needs a reason are dialogs; ? lists every key. Archivo is self-hosted under the SIL Open Font License (apps/mcl_kanban_web/assets/fonts/OFL.txt).

Roles

A call acts as its caller, the node id that signed the call. Roles come only from the crew: enlisted agents, one supervisor, at most one prioritiser, and the operator of the crew the agent belongs to. The owner is not a mesh role: it is the web UI on :4010 -- loopback by default, and the box that runs the board sets MCL_HTTP_IP=0.0.0.0, so it is served on the LAN with no login.

Crews and operators

The board holds more than one crew. Each agent is enlisted into a crew (agent_enlisted_v1 carries it), and each crew has at most one operator (operator_appointed_v1): the agent that runs it. Enlisting and discharging belong to that crew's own operator, or to the owner -- not to the supervisor, and never to an agent of another crew. An operator that can hand its own crew on would let a crew pass itself along without anyone outside it agreeing, so appointing one is the owner's, or the realm's for a crew it admits (#40).

  • enlist_agent takes name, node_id and crew; discharge_agent is the rest of the roster on the mesh. Appointing an operator is the owner's, in the web UI only -- or the realm's, through a signed crew fact (#40): it is not served on the mesh.
  • get_crew answers %{crews: [%{crew, operator, agents}]}, each agent with its roles, the cards it holds and its next card. Enlisted callers only, like every read.
  • Agents enlisted before crews existed are in the crew named home: their events are left as they were, and the read model reads them as home.
  • A crew nobody is in yet has no operator to enlist into it, so the owner founds it: enlist the first agent into the new crew, then appoint it operator -- the enlist dialog does both in one step.

Every board has a home crew (#29), named by open_board and by default the opener's own; boards from before are home's. Only the home crew ranks, defers, withdraws, rewords, reserves, files or archives on a board, so another crew cannot reorder our work; any crew still queues, comments, tags, links and claims unreserved cards there. A card can be reserved to a crew's lane (reserve_card with crew), claimed by that crew's agents only. The rules, role by role, are in guides/working_the_board.md.

scripts/fill_board.sh enlists every agent into KANBAN_CREW (default home). It signs as KANBAN_SUPERVISOR (default supervisor), which must therefore be both the board's supervisor and the appointed operator of that crew: the owner appoints it, since the owner itself is never a mesh caller.

Crews the realm admits (#40)

A crew the realm admits is appointed here without anyone retyping the roster. The realm publishes one signed fact per change on <realm>/_realm/_realm/crew/<fact>_v1 -- admitted, operator_replaced, suspended, revoked, left -- carrying the crew id and name, the operator and its name, the members and their names, and a seq. The board believes a fact only when the realm's ML-DSA signature over it verifies against MCL_REALM_KEY, never because of who published it, and acts only on a seq higher than the one it last took for that crew (a replay re-appoints nobody). Admitting enlists the members and appoints the operator; a replaced operator is appointed, and every agent the fact no longer names -- the previous operator, a member the realm dropped -- is discharged, so a re-sent admission with a smaller roster drops whoever left; the three drop facts discharge every agent of the crew and empty its operator seat -- even when the board keeps the agent, which it does for its supervisor, so an operator that is also the supervisor cannot go on enlisting into a dropped crew. The fact is named by the topic it arrives on and never carried in the payload, where a fact field would be a field nobody signed. A board acts on a crew by its KEY: the crew id for a crew the realm admitted, its name for a crew the owner made. The two cannot collide (a name is at most 40 characters and an id is 64 hex), so one field carries both and nothing has to ask which kind it holds. Two crews the realm admits under one name are therefore two crews here, and a drop for one never touches the other's agents. A key is never resolved from a name: enlisting, appointing an operator and reserving a card for a crew each take the key itself -- a bare name is always the board crew of that name, a 64-hex id always the realm crew of that id -- so an admitted crew that takes a name the owner also uses is reached by its id, and the rail shows a realm crew's id beneath its name. The home crew is the board's own whatever the realm invites, since it is where an agent enlisted without a crew lands. All of it acts as the realm, an actor no payload can claim, and the board believes one fact at a time: the highest-seq rule is only true if nothing can slip between reading the seq and recording it.

A fact is the fast path, never the only one: every 60 s the board asks the realm's identity/crew_standing_v1 for each crew it knows and puts the answer through the same verifier and seq rule. That minute is the board's revocation bound -- a revoked crew loses the board within it even if every fact is missed -- and no error ever ends a crew: a lost answer, a timeout and the realm's own invalid_crew_id change nothing. An explicit unknown_crew is the one answer that counts against a crew, and the board acts on it only when it comes MCL_CREW_UNKNOWN_LIMIT times in a row (three by default; a value below one would drop a crew on the first answer, so it is refused at boot): then the crew is discharged as the board -- crew_discharged_v1, reason unknown_crew_after_n -- its agents lose the board, and it is asked about no more. A signed fact between two answers restarts that count, since the realm knows the crew after all, and the crew's seq is kept, so a replay of an old admission re-enlists nobody. With no MCL_REALM_KEY, the board subscribes to nothing and reconciles nothing.

The subscriptions accept crew facts from one node only: the realm's own publishing node, named by MCL_CREW_FACT_PUBLISHER. Not "any realm member" -- the realm's node is not a member of the realm it serves, so that declaration would refuse every fact and leave the board listening to nothing with a green health (macula-io/macula-realm#168). The pin is what keeps a stranger from speaking for the realm; the signature against MCL_REALM_KEY is still what makes a fact true.

Signed approvals

A crew's yes to a push, a tag or a planning gate is a record on the card that any crew can check (#30), not a word in a chat or a label only our GitHub org can set. The operator of the card's home crew signs a crew-approval/v1 with its node's identity key; any enlisted agent brings it to the board with record_approval, and get_approvals hands every approval on a card back, each with the signed object so the reader re-verifies it instead of trusting this board.

The object is a macula_signed_object under the label crew-approval/v1 that carries the signer's key, encoded as CBOR and sent as standard base64 text. Its fields, all text keys:

Field Value
kind range, or a planning gate: gate:vision, gate:boundary, gate:design
card_id the card the approval is on
operator_node_id the signer's node id, 64 lowercase hex digits
repo org/repo, the card's repo
verdict 1 (yes) or 0 (no); never a boolean
at when it was signed, ms since the epoch
nonce 32 lowercase hex digits, fresh for every approval
ref, base, tip a range only: the ref and the two commits, each a full sha (40 lowercase hex digits)
tag a range only, optional: the tag it releases
issue a gate only: the plan issue it passes, org/repo#n

No other field is accepted. The board records an approval only when all of these hold, and otherwise answers the reason:

  1. the object decodes, is the shape of its kind, and its signature verifies over the label, the carried key and the fields as signed (approval_malformed, signature_invalid, alg_mismatch);
  2. operator_node_id is the node id of the key that signed (signer_mismatch);
  3. it names this card and this card's repo, and a gate names this card's issue (wrong_card, wrong_repo, wrong_issue);
  4. its signer is, right now, the appointed operator of the crew the card's board belongs to (not_home_operator): an agent's key and another crew's operator are refused alike, and once the owner hands a board over, its old operator's approvals stop counting;
  5. its nonce has not been recorded on this card before (replayed_nonce). Signing card_id is what makes a per-card nonce enough: the same yes brought to another card is wrong_card.

A no (verdict 0) is recorded like a yes, and an approval is accepted on a finished card, since a release is often approved once its card is done. To check one yourself, decode the base64, run macula_signed_object:verify/3 with the label crew-approval/v1, derive the node id from the returned key (macula_node_keys:node_id/2), and compare it with operator_node_id and with the operator get_crew names for the card's home crew. GuideCardLifecycle.RecordApproval.CrewApproval.sign/2 signs one from an identity key, field for field as above.

Running it

The image runs bin/start: bin/migrate brings the read model up to date (ProjectBoards.Release.migrate), then bin/server starts the release, so a new version opens an older read model and keeps its rows. A schema change is a new migration, never an edit to an existing one.

/health is ok only while both the read model and the event store answer; either one failing reports degraded, naming it (read_model, event_store).

Variable Default
MCL_DATA_DIR /var/lib/mcl-kanban (image) the event store and kanban.sqlite3; a mounted volume on a bulk drive
MCL_IDENTITY_KEY_PATH /etc/mcl/secrets/identity.key the service's node key, generated on first boot
MCL_REALM_NAME io.macula the realm; its tag is derived
MCL_REALM_KEY the realm's public signing key, hex; without it, no mesh
MCL_CREW_FACT_PUBLISHER the realm's own publishing node, 32-byte node id in hex; the one node the board accepts crew facts from
MCL_HTTP_IP, MCL_HTTP_PORT 127.0.0.1, 4010 the UI, which acts as the owner. Run the container on the host's network so the box's loopback is the only way in; never publish it on a bridge
MCL_HTTP_ORIGINS extra socket origins (//localhost:5010) for a tunnel on another local port; only local origins are accepted by default
SECRET_KEY_BASE signs the LiveView socket; required
MCL_COOKIE Erlang distribution cookie for this box; required

Fleet placement lives in macula-io/macula-fleet. The image is ghcr.io/macula-services/mcl-kanban; nothing moves :latest: macula-fleet pins each signed v* release by digest (macula-fleet#14, #15).

The board's UI is at http://<box>:4010, on the LAN, with no login; where the box is not reachable, ssh -L 4010:127.0.0.1:4010 <box> and http://localhost:4010 reach the same UI. Keys: n queues a card on a board, Esc closes the card drawer.

Filling the board

scripts/fill_board.sh makes the board match the crew and GitHub: every crew agent enlisted into KANBAN_CREW under the node id of its MACULA_MCP_AGENT key, a board per repo with open work, a package per open work-package issue with its own card and its open sub-issues filed in it, and a crew:<name> label as a reservation to that lane. Rerunning it changes nothing. The header of the script lists its inputs (KANBAN_REALM_KEY is required; KANBAN_SUPERVISOR, KANBAN_CREW, KANBAN_ORGS, KANBAN_ROLE_DIR have defaults).

Development

The gates run in the CI image (.github/workflows/ci.yml), the same image the Containerfile builds in:

mix deps.get
mix format --check-formatted
mix compile --warnings-as-errors
mix credo
mix test
mix dialyzer

Licence

Apache-2.0.