Skip to content

refactor: house style, Postgres store and a voice guide - #9

Merged
benjamsf merged 23 commits into
mainfrom
refactor/house-style
Nov 29, 2026
Merged

benjamsf merged 23 commits into
mainfrom
refactor/house-style

Conversation

@benjamsf

@benjamsf benjamsf commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Description

  • API split into one module per router; murmur-agent made a package; settings read with pydantic-settings.
  • State kept in Postgres with SQLModel.
  • UI rebuilt on shadcn/ui and lucide-react, with vitest + Testing Library tests.
  • A voice guide in the UI, with en/fi/sv text and pictures.
  • CI checks the version bump with validate-bumpversion. Version 1.1.0+261125.

Tested: the test suites and prek pass. The house-style and Postgres changes ran live on a test deployment: browser and ATAK voice. The guide's browser/ATAK picker was checked with tests and in a browser harness.

User-Facing Changes

Voice guide

A help button opens a short guide to talking in voice nets, either in the browser or in ATAK with OD Voice, with pictures. It opens by itself on the first visit.

Compact net picker

Pick the net from a compact list. The open net's panel scrolls with the page.

Anything Else You'd Like to Mention

Needs the Postgres settings MUMBLERMAPI_DATABASE_* from the platform. The platform's pin follows the tag.

The reusable general-check workflow ran here for the version bump
alone, as prek has its own job, so the job calls config-ci-library's
validate-bumpversion action itself.
The agent's own modules move under agent/: the Ice glue to agent/ice.py,
the enforcement pass and rounds to agent/rounds.py, and the Murmur
reconciler from channels.py to agent/reconcile.py. The Ice helpers the
other modules use get public names. The agent tests split per module
and share their helpers.
… TAK do

Each router gets its own module under api/ (usercrud, murmur_agent,
admin_channels, admin_templates, admin_users, voice, description,
healthcheck, clients), beside the request models and the identity
dependencies; all_routers and all_routers_v2 compose them. create_app
and the UI files move to app.py, the settings to config.py. The API
tests split per router and share their helpers through conftest.
mumblermapi keeps its users, the Units/ nets and their members, the
missions and the web voice slots in its own CloudNativePG cluster
instead of a SQLite file. store.py becomes a package with its errors,
tables and database settings; the tables are created at start with
create_all, as rmapi does. The health check reports an unreachable
database, and the mission watcher runs its store calls off the event
loop. Postgres text cannot hold NUL, so plans, descriptions and callsign
paths refuse it. The tests run against a Postgres that pytest-docker
starts.
The first start against an empty database copies the SQLite file of
earlier releases (MUMBLERMAPI_SQLITE_FILE) into it, in the transaction
that gives the database its version, and leaves the file as it is.
Nets keep their ids, and new ones get ids above any SQLite gave. The
README says what a rollback or a recreated database does.
…hz do

Settings, DatabaseSettings and AgentConfig are pydantic-settings
classes with the MUMBLERMAPI_, MUMBLERMAPI_DATABASE_ and AGENT_
prefixes, the agent's MURMUR_* variables by alias, instead of reading
os.environ field by field. Settings.from_env only adds the product
manifest. TakSettings keeps its from_env: it is None without
MUMBLERMAPI_TAK_URL and falls back to the manifest field by field.
… restate the code

The store's access and flag arguments are typed instead of checked at
run time, is_empty and _bump go, update_channel uses plain ifs, and the
description limit comes from channels.MAX_DESCRIPTION. The banner
comments go and the comments above the Ice and channel limits are cut
to what the code does not say; reconcile's docstring says what a rename
does to people in the net.
One runner for the unit suites and the component tests to come: vitest
in jsdom, with Testing Library's cleanup, a cleared localStorage and
restored spies after each test. The node:test suites are ported as they
are, so the modules no longer need to load without imports.
… and hooks

Admin.tsx, Details.tsx, NetTree.tsx and Talk.tsx become one component
per module, each named after its export (NetDetails, NetCard,
TemplatePanel, UsersList and the rest). The admin view's data,
requests, notice, folds, focus requests, width and channel plan
actions are hooks under admin/hooks/, and the net tree model moves
from paths.ts to admin/tree.ts with its tests. localStorage is read and
written in one place, lib/storage.ts, and the browser id leaves the
push-to-talk module.
The icons come from lucide-react, as in rmui and its shadcn components,
instead of the hand-drawn set in icons.tsx; Loader and Trash are
lucide's Loader2 and Trash2.
shadcn/ui is set up with rmui's Radix versions (components.json, cn
and the @ alias), and the controls come from it: Button, Input, the
More menu on DropdownMenu, the admin tabs on Tabs, Switch for voice on
or off, Radix ToggleGroup for the access choice, Textarea, Alert for the
error lines, Command (cmdk) for the member picker and Badge for the
callsign chips; the presence dots are a StatusDot component. The
picker suggests at most seven members, as many as its list shows.
Confirmations ask in an AlertDialog instead of inline: NetConfirm for
the open net, ClearPlan before the whole plan goes. ui.ts loses the
classes the controls now carry.
Component tests with Testing Library and user-event, in jsdom with
fake timers: the admin view's loading, requests, notices, tabs, folds,
focus and confirmations, the open net, the plan actions, voice on or
off, the access choice, the More menu's keyboard use, the member
picker, and the talk panel's failure line.
The talk panel's nets are a select, grouped under their top-level
nets, instead of a list that pushed the push-to-talk button off the
screen. The push-to-talk key is caught before the focused picker can
act on it, so a bound letter, digit or Space never switches nets.
A help button beside the title opens a short guide in rmui's shadcn
dialog: joining a net, push to talk and who is in which net, and for
admins building the unit nets and what cannot change here. It opens by
itself while a step is new to the callsign in this browser, unless
rmui's setting turns guides off, which the guide also offers.
The open net's panel beside the list has no scroll of its own any more:
it scrolls with the page, and stays in view while it fits on the
screen. Once it outgrows the screen, what has focus in it is brought
back into view.
The class strings move from ui.ts into the markup that uses them, as
in rmui and the shadcn copies, and ui.ts goes; ui/README.md keeps its
rule that only classes in rmui's Tailwind build work. Shared modules
are imported through @/. Card rows are separated with divide-y, the
search's clear button and the add-member chip are ghost Buttons, and
the muted ghost buttons get a Button variant. The shadcn copies lose
their origin headers.
…that restate the code

The remote reads back its own stored folds and push-to-talk binding
without checking their shape; one that is not JSON still gives the
default. netPath no longer guards against a looped channel tree, and
the access choice no longer maps a top-level inherit net to open: the
server makes neither. Comments that restate the code go, long ones are
cut to the reason, and comments name the controls instead of their
Finnish labels.

def _answer[T](call: Callable[[], T], fallback: T) -> T:
"""call's answer, or fallback when it raises. Murmur removes an authenticator that fails a call, and every
login then needs the server password, which nobody is given."""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to be aware there is a SuperUser account which is logged. This is something that should be disabled in opendefence-platform via the arguments mumble is ran with.

=> Password for 'SuperUser' set to '<password>'

@benjamsf benjamsf Nov 28, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. That password also works whenever the agent isn't attached. Disabled in pvarki/opendefence-platform#113, where an init container runs mumble-server -disablesu 1 before every start. Tested locally and SuperUser can't log in anymore.

Comment thread README.md
| `MUMBLERMAPI_PROXY_READY_URL`, `MUMBLERMAPI_GATEWAY_READY_URL` | mumblermapi | What the health check asks: this pod's Linkerd proxy, default `http://127.0.0.1:4191/ready`, and the voice gateway's `/readyz`; empty skips that check |
| `MUMBLERMAPI_TAK_URL`, `MUMBLERMAPI_TAK_SERVER_NAME`, `MUMBLERMAPI_TAK_CN` | mumblermapi | TAK's API, the name on TAK's certificate, our TAK identity's CN (default: the manifest's `product.dns`); unset leaves `Missions/` empty |
| `MUMBLERMAPI_RMAPI_URL` | mumblermapi | rmapi, for our TAK certificate and TAK rights (default: the manifest's `rasenmaeher.mtls.base_uri`) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MTLS_TRUST_L5D, MTLS_REQUIRE_L5D and MTLS_TRUSTED_INGRESS_IDENTITIES should also be mentioned as they are important to be used, especially on opendefence-platform.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to the settings table.

Comment thread src/mumblermapi/app.py
from .tak import watch


class UiFiles(StaticFiles):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: while this works nginx could be used on opendefence-platform to serve these as other integrations do.

@benjamsf benjamsf Nov 28, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kept it in FastAPI for now. It saves a container, and remoteEntry.js needs no-cache anyway. Or should i just move it?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One user can claim endless ids, essentially making the server run out of slots. Should probably be limited to some sensible number per user and/or slots raised slightly.

@benjamsf benjamsf Nov 28, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. A callsign now gets at most four phone slots and a fifth is refused. Also raised Murmur's limit from 100 to 250 in pvarki/opendefence-platform#113.

Every new <callsign>---<slot> name took a new user id and its own session, so one certificate could fill the server. A fifth phone slot is now refused; web- slots and the bare callsign do not count.
@benjamsf
benjamsf merged commit 3f0a410 into main Nov 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants