imsd-messages/AGENTS.md

185 lines
10 KiB
Markdown
Raw Permalink Normal View History

<!-- SPDX-License-Identifier: GPL-3.0-only -->
<!-- SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® -->
# AGENTS.md — working on imsd-messages
For coding agents and anyone changing imsd-messages: what the repository
contains, how it is built and tested, and the conventions a change follows.
The README is for users. Where this file and the code disagree, the code is
right and this file has a bug — fix it in the same change.
## 1. What imsd-messages is
An SMS app for Linux phones (postmarketOS on the Fairphone 6 first; Plasma
Bus: the GDBus client, imsd's dictionaries, the notifier and the owned name The GLib side of the app. Variant reads imsd's Received dictionary by key and type as its SmsVariant writes it (`to`, the number the text arrived for, a tel: URI read like the status's `ppi`; `operator`, the SIM it arrived under), the GetStatus one with the subscriber's own number and the SIM's operator in it (`ppi`, a tel: URI as the frozen interface gives it; `operator`), and maps a GError to the core's error kinds off GDBus's own mapping. Client is the Sync logic's transport: asynchronous calls with their continuations as user data — every reply guarded where it is delivered (OnCallDone), as are the signal handlers and the name watch's callbacks: a throw is a fault the events hear, not the end of the process — the calls behind imsd's polkit gate allow interaction: Subscribe, List and Delete wait two minutes; Send has no bound of the client's, since imsd sends the text once its prompt lets the call through, however late, and a Send given up on would be failed by Sync and be sent all the same; GetStatus ten seconds — (one call: the Messaging status carries the own number, imsd reading both from one snapshot; AGENTS.md §1 names both interfaces), the Messaging and RegistrationChanged signals, and a watch on net.catcrafts.IMS1 whose appeared callback is where Sync subscribes. Notifier shows one desktop notification per conversation and replaces it as more texts arrive: one Notify at a time per conversation, since the id to replace comes with the answer; its default action asks the app for that conversation; the body is escaped when the server renders markup (GetCapabilities, asked once; Plasma and GNOME do), so a text's '<' or '&' shows as typed. Instance owns net.catcrafts.ImsdMessages and serves org.freedesktop.Application there, the Desktop Entry Specification's interface of a running application: Activate, Open and ActivateAction, each with its platform data — sent empty and not read: nothing in the app can use an activation token yet — and one action, quit, any other refused (the object registered before the name is asked for, so a launch that forwards the moment the name is granted finds it; Own tells a name another instance holds from a request that failed or was refused, and keeps the error's words); it forwards a call to the owner. project.cpp computes the gio flags once for the bus library, the executable and the Decode test. Tested: tests/Decode (every key of imsd's Received dictionary, one with ten of them, GetStatus, the own number, the SIM's operator, the error kinds, the markup escape, the parameters of the instance's three calls).
2026-10-17 23:45:29 +02:00
Mobile and Phosh) whose transport is imsd's D-Bus object `/net/catcrafts/IMS1`
on the system bus: its `net.catcrafts.IMS1.Messaging` interface carries the
texts, the subscriber's own number and the SIM's operator (`GetStatus`'s
`ppi` and `operator`), and the frozen `net.catcrafts.IMS1` interface gives
the registration changes. imsd receives texts over IMS and keeps each one
it could store under `/var/lib/imsd/sms/` until the app deletes it; the app
subscribes to
imsd's signals, imports the stored messages into its own database and
deletes imsd's copy. The interfaces are documented in imsd's AGENTS.md §8.4
and §7.9 (Messaging) and §8.1 (the frozen one).
## 2. Repository layout
| Path | What it is |
|---|---|
Ui: the window on Crafter.Graphics, driven from the GLib main loop The window library. Loop makes the Wayland display a GSource (libwayland's prepare_read protocol) so D-Bus and the window are served from one thread without the library's StartSync, which runs a loop of its own that serves no GMainContext and would starve the bus; the app owns its frame callback too — a redraw is a frame request and a bare commit, the compositor's done runs one Window::Update, and nothing re-arms unless something is dirty or animating — or the day changes: the captions name the day and an idle window draws no frame by itself, so a timer on the wall clock, which wakes at the next local midnight and whenever that clock is set, asks for one when the local date is another one (DayWatch); when the compositor's connection breaks the source stops and says so (App's onDisplayLost), since the process cannot connect its display again. Canvas initialises the device once per process and holds the window, the font with a word wrapper and a text width over its unrounded advances, as DrawText draws them, and four compositing layers (background, the clipped scrolling content, the chrome, an overlay): within one fused dispatch all quads composite before all text, so the layers are separate dispatches in that order. The layers' buffer slots hand their numbers back to the descriptor heap when they go, so the heap is declared before them and outlives them. Screens draw the conversation list (avatars, previews, time captions, unread badges, the new-conversation button, with room under the last row to scroll clear of it) and one conversation (day separators, wrapped bubbles, clock and state captions — only what is in view, the layer's glyph budget being finite) and record the regions a tap can hit. App wires them to the store and Sync: mouse events become gestures (the detector's slop and fling threshold set from the window's scale, the positions being buffer pixels), a tap is resolved against the last frame's regions (which name the conversation or message they drew, not a position a reload may shift), scrolling is by wheel, drag or fling (a press stops a fling; a screen change stops a fling and cancels the press under it, so the scroll left behind keeps no velocity for a return to revive and a release after a link's or a notification's Open is no tap on the new screen), the window is created on the first Show (when the library cannot and says so — no display, a compositor without wl_shm, wl_compositor or xdg_wm_base, no Vulkan driver — Show logs why, Open opens nothing, and the app runs on without one; a later Show fails at once, the device's set-up running only once) and torn down in order on Shutdown. ScreenshotThenQuit renders one frame outside the compositor's pacing and saves it; a window it creates first waits 600 ms for the compositor's configure, which sizes it (to the screen, on a phone). A capture with no window to render it — none could be made, or it went before the frame — is logged and sets App's exitCode to 1. project.cpp gains Crafter.Graphics (--local takes the branch worktree with the Wayland input work until it is merged), the imsd-messages-ui library, and libevdev from the prefix of packaging/build-libevdev.sh on the library's include path and the executable's library path (a sysroot build looks for it in the sysroot instead).
2026-10-18 00:26:09 +02:00
| `project.cpp` | The build description for Crafter.Build: four products (below) and the tests. |
Ui: the compose field and the send bar A text message needs several lines and UTF-8, and the library's InputField is one line edited by byte, so the field is the app's own. Its state and editing are the core's (ImsdMessages:Edit, tested without a window): a plain struct, insertion at the cursor, Backspace and Delete by code point, Home and End within the line, a newline. Ui:Compose turns the keys into those edits and draws the field one to five lines tall — as many as half the area under the header and the banner holds, and one at the least — with the canvas's word wrapper (a longer text shows the lines that end at the caret's, or the first ones while the caret is among them), a placeholder when empty, the caret at the cursor, and a tap placing the cursor at the nearest byte by the widths the glyphs are drawn at, in the text as it is when the tap lands (an edit since the last frame only asked for one; a field no frame has laid out yet takes a tap as one at its text's end; a tap at or past the last line's end asks for the text's end, where a space the wrapper hung off the line may be). The bar under a conversation holds the field and Send, enabled only with text, a sendable status and an address to send to; Send hands the text to Sync with that address and clears the field (a store that refuses the text keeps the draft) (Model's SendAddress: as a link gave it, else the latest message's — the network's form of a received text, the dialled form of ours — never the key, whose completed country code is a guess that groups; a conversation with neither has Send off, and so has one whose address is not international — a national number, a short code; typed, linked or the message's — and was typed or written under another SIM's plan than the one known now, which the plan each row and the view carry tells (the view's is that of the SIM the address was typed under, which Number's AfterStatus keeps; Number's AnotherPlan, its second caller)); Sync's StateChanged moves the bubble's caption. Keys reach the field while a conversation is open (Escape goes back, Ctrl+Enter sends), a held key repeats through a timer since frames are on demand, and the caret blinks on one. A text typed and not sent is its conversation's, not the view's: leaving the conversation (Back, another one opened by a notification or a link) keeps it by the conversation's key for the run, and opening the conversation again takes it up (Edit's Drafts: an empty field keeps nothing and drops nothing; the draft of a typed or linked address follows imsd's status as the open conversation's key does — Number's AfterStatus over the address and the plan kept with it — so one left before the status brought the country code is found under the key the address makes afterwards; and a second text kept under one key — two keys that became one — goes after the first on a line of its own). Tested: tests/Model, the address a text goes to (the typed or linked one, the latest message's, none for an emptied conversation, none under another SIM's plan than it was typed or written under — a national number with or without a trunk prefix under another country's SIM, a short code under another operator's too, though dialled under the same operator, the own number read when it was typed or not; a national number typed before the own number was read, none under another operator — an international one under any — and a typed address judged by its own plan, whatever the latest row's); tests/Edit (code points of one to four bytes, the moves within a line, the edits that change nothing, the first line shown as the caret moves down a long text; the drafts: kept and taken up by key with the cursor, taken once, an empty field keeping and dropping nothing, one per conversation, a second text under one key on a line of its own; a typed address's following the status — moved when the code comes, not while texts are stored under its key, not under another SIM's status, a list conversation's left alone and the store not asked, the learned plan kept, two keys that became one keeping both texts).
2026-10-18 00:35:39 +02:00
| `interfaces/ImsdMessages*.cppm` | `imsd-messages-core`: std + Crafter.DB, no GLib, no window — numbers, time, the model, word wrap, gestures, the message field's editing, the store, the sync logic. |
| `interfaces/ImsdMessages.Bus*.cppm` | `imsd-messages-bus`: GLib/GDBus — imsd's dictionaries, the client, notifications, the app's own bus name, the desktop portal (appearance, background). |
Ui: the window on Crafter.Graphics, driven from the GLib main loop The window library. Loop makes the Wayland display a GSource (libwayland's prepare_read protocol) so D-Bus and the window are served from one thread without the library's StartSync, which runs a loop of its own that serves no GMainContext and would starve the bus; the app owns its frame callback too — a redraw is a frame request and a bare commit, the compositor's done runs one Window::Update, and nothing re-arms unless something is dirty or animating — or the day changes: the captions name the day and an idle window draws no frame by itself, so a timer on the wall clock, which wakes at the next local midnight and whenever that clock is set, asks for one when the local date is another one (DayWatch); when the compositor's connection breaks the source stops and says so (App's onDisplayLost), since the process cannot connect its display again. Canvas initialises the device once per process and holds the window, the font with a word wrapper and a text width over its unrounded advances, as DrawText draws them, and four compositing layers (background, the clipped scrolling content, the chrome, an overlay): within one fused dispatch all quads composite before all text, so the layers are separate dispatches in that order. The layers' buffer slots hand their numbers back to the descriptor heap when they go, so the heap is declared before them and outlives them. Screens draw the conversation list (avatars, previews, time captions, unread badges, the new-conversation button, with room under the last row to scroll clear of it) and one conversation (day separators, wrapped bubbles, clock and state captions — only what is in view, the layer's glyph budget being finite) and record the regions a tap can hit. App wires them to the store and Sync: mouse events become gestures (the detector's slop and fling threshold set from the window's scale, the positions being buffer pixels), a tap is resolved against the last frame's regions (which name the conversation or message they drew, not a position a reload may shift), scrolling is by wheel, drag or fling (a press stops a fling; a screen change stops a fling and cancels the press under it, so the scroll left behind keeps no velocity for a return to revive and a release after a link's or a notification's Open is no tap on the new screen), the window is created on the first Show (when the library cannot and says so — no display, a compositor without wl_shm, wl_compositor or xdg_wm_base, no Vulkan driver — Show logs why, Open opens nothing, and the app runs on without one; a later Show fails at once, the device's set-up running only once) and torn down in order on Shutdown. ScreenshotThenQuit renders one frame outside the compositor's pacing and saves it; a window it creates first waits 600 ms for the compositor's configure, which sizes it (to the screen, on a phone). A capture with no window to render it — none could be made, or it went before the frame — is logged and sets App's exitCode to 1. project.cpp gains Crafter.Graphics (--local takes the branch worktree with the Wayland input work until it is merged), the imsd-messages-ui library, and libevdev from the prefix of packaging/build-libevdev.sh on the library's include path and the executable's library path (a sysroot build looks for it in the sysroot instead).
2026-10-18 00:26:09 +02:00
| `interfaces/ImsdMessages.Ui*.cppm` | `imsd-messages-ui`: the window on Crafter.Graphics, driven from the GLib main loop. |
| `implementations/main.cpp` | The executable `imsd-messages`. |
| `tests/<Name>/main.cpp` | One test per directory, declared in `project.cpp`. |
| `utilities/` | `fake-imsd.py`: imsd's Messaging interface on the session bus, for benches. |
| `assets/` | The bundled font (Noto Sans, OFL 1.1). |
ci: build the aarch64 flatpak and publish it The flatpak is built after the tests for pull requests, when started by hand and for a pushed tag X.Y.Z. Only the tag's run publishes: the flatpak to the Catcrafts flatpak repository as its stable branch, the app's ref file beside the repository with the repository's key in it — the checkout's file, read as the build user like every file of the checkout, made before anything is published, so a file that cannot carry the key publishes nothing, and moved into place after it — and release X.Y.Z on the forge with the metainfo's notes, the bundle and that ref file. A push to main without a tag runs nothing. That is the release model of Crafter.Build 6: every push to main is a release, made by the tag the owner signs and pushes with it. packaging/release-version.sh makes that workflow's checks — the tag is the version of the app and of the metainfo's newest release, annotated and signed by the owner as Forgejo verifies it, on main, and newer than every release published — and in every run checks the app's version against the metainfo's, as the version's comment in Model.cppm now says. Release runs share a concurrency group, so one queues behind another. Two jobs, by trust: check builds a pull request or a run by hand with neither the published repository nor its key, publish builds a pushed tag, and only its volumes feed what is signed. Both run on the organisation's privileged flatpak runner: check cold, with no host volume; publish with the four volumes it mounts — the crafter-build installation the organisation's publish jobs share, this app's own cache, the repository and the key — which the runner's config must allow. It publishes into the repository Crafter.Build's and Crafter.Review's workflows publish to, under the lock each of them holds while it commits and updates the summary, signed with the same key, which stays on the runner host, and keeps its bundle as an artifact. The pacman and flatpak downloads get five tries, 30 s apart: Flathub's CDN and Arch's Fastly mirror answer 502 now and then, flatpak reports a summary it could not fetch as a missing runtime, and a mirror answering 502 can fail a pacman transaction even with another mirror behind it. The README says how to install it and how to stop it starting at login; AGENTS.md describes CI, a release, what guards the volumes and which of them the runner must allow, and names what a released copy leaves on a phone that later releases keep good: the stored rows and their enumerators, the conversation key, the app id and the login entry's command, the instance's interface.
2026-10-20 23:50:39 +02:00
| `packaging/` | The desktop entry, metainfo and icon; the flatpak's sysroot and build scripts, licence texts it ships (`licenses/`; §4 has the whole set), the release check (`release-version.sh`) and the ref file CI publishes (§5). |
| `.forgejo/workflows/flatpak.yaml` | CI: the tests and the flatpak, published for a release's tag (§5). |
## 3. Building and testing
```sh
crafter-build # the executable
crafter-build test # every test
crafter-build lint # the house-style rules (Crafter.LintRules)
ci: build the aarch64 flatpak and publish it The flatpak is built after the tests for pull requests, when started by hand and for a pushed tag X.Y.Z. Only the tag's run publishes: the flatpak to the Catcrafts flatpak repository as its stable branch, the app's ref file beside the repository with the repository's key in it — the checkout's file, read as the build user like every file of the checkout, made before anything is published, so a file that cannot carry the key publishes nothing, and moved into place after it — and release X.Y.Z on the forge with the metainfo's notes, the bundle and that ref file. A push to main without a tag runs nothing. That is the release model of Crafter.Build 6: every push to main is a release, made by the tag the owner signs and pushes with it. packaging/release-version.sh makes that workflow's checks — the tag is the version of the app and of the metainfo's newest release, annotated and signed by the owner as Forgejo verifies it, on main, and newer than every release published — and in every run checks the app's version against the metainfo's, as the version's comment in Model.cppm now says. Release runs share a concurrency group, so one queues behind another. Two jobs, by trust: check builds a pull request or a run by hand with neither the published repository nor its key, publish builds a pushed tag, and only its volumes feed what is signed. Both run on the organisation's privileged flatpak runner: check cold, with no host volume; publish with the four volumes it mounts — the crafter-build installation the organisation's publish jobs share, this app's own cache, the repository and the key — which the runner's config must allow. It publishes into the repository Crafter.Build's and Crafter.Review's workflows publish to, under the lock each of them holds while it commits and updates the summary, signed with the same key, which stays on the runner host, and keeps its bundle as an artifact. The pacman and flatpak downloads get five tries, 30 s apart: Flathub's CDN and Arch's Fastly mirror answer 502 now and then, flatpak reports a summary it could not fetch as a missing runtime, and a mirror answering 502 can fail a pacman transaction even with another mirror behind it. The README says how to install it and how to stop it starting at login; AGENTS.md describes CI, a release, what guards the volumes and which of them the runner must allow, and names what a released copy leaves on a phone that later releases keep good: the stored rows and their enumerators, the conversation key, the app id and the login entry's command, the instance's interface.
2026-10-20 23:50:39 +02:00
crafter-build format --check # the formatting rules
```
A test is an ordinary `int main()`: exit 0 passes. Tests link the core (and
the bus library where they need GLib) and never need a bus, a phone or a GPU.
The build takes Crafter.DB and Crafter.Graphics from the forge at the
commits `project.cpp` pins; `crafter-build -- --local` builds them from
sibling checkouts in `../Crafter/` instead.
packaging: the aarch64 flatpak crafter-build cross-compiles the executable for aarch64, which on an x86_64 machine needs no emulation, and flatpak's build commands assemble the flatpak; there is no flatpak-builder manifest. make-flatpak-sysroot.sh makes the sysroot: the aarch64 Freedesktop Sdk 26.08 with LLVM's libc++ of the release crafter-build carries (23.1.2, the tarball and hash of Crafter.Build's manifest), built for aarch64. build-flatpak.sh builds the executable against it for generic armv8-a and assembles it on the Platform 26.08 with that libc++, libc++abi and LLVM's libunwind in /app/lib: the Platform has no libc++, and its libunwind is libunwind 8. It fails when the executable or a bundled library needs a library neither the Platform nor /app/lib has, and when one of them links libunwind 8, which libc++'s -lunwind found first until the sysroot dropped its link name. The executable it packages is the build it just ran: the output directory's name ends in a hash of the configuration, so an older variant (another sysroot, --debug, --local) left in bin/ is removed first. make-flatpak-sysroot.sh tries each download five times, 30 s apart: Flathub's CDN answers 502 now and then. The sandbox gets Wayland, the GPU, net.catcrafts.IMS1 on the system bus and org.freedesktop.Notifications on the session bus. The metainfo's content rating declares the app's chat (OARS social-chat intense: uncontrolled texting between users), as the baseline Chatty's does, for the software centres and parental controls that read it, and recommends a display of 360 logical pixels or more — the phone screen the window is drawn for; a recommendation, not a requirement. The metainfo's one release is 0.0.0, and the app's version, 0.1.0 in the skeleton, is set to it: the version's comment in Model.cppm says a release moves the two together. AGENTS.md's SPDX rule says what the metainfo carries instead of the two SPDX lines: AppStream's single CC0-1.0 line. The flatpak carries the licences of what it ships under /app/share/licenses/net.catcrafts.ImsdMessages: the app's and the font's, those of the Crafter libraries it links statically and of the code they bring along (packaging/licenses/, with a NOTICE naming what each text covers), and LLVM's for its runtime libraries, which make-flatpak-sysroot.sh keeps beside libc++.
2026-10-21 23:59:17 +02:00
## 4. The flatpak
The app ships as the aarch64 flatpak `net.catcrafts.ImsdMessages` on
org.freedesktop.Platform 26.08. crafter-build cross-compiles it; there is no
flatpak-builder manifest:
```sh
packaging/make-flatpak-sysroot.sh # the sysroot; kept until the Sdk or the recipe changes
packaging/build-flatpak.sh dist/repo # the executable, assembled into an OSTree repo (branch master)
flatpak build-bundle --arch=aarch64 dist/repo dist/imsd-messages.flatpak net.catcrafts.ImsdMessages master
```
The sysroot is the aarch64 Freedesktop Sdk with LLVM's libc++ of the
release crafter-build carries, whose std module source crafter-build
ships. The Platform has no libc++, so the flatpak
bundles libc++, libc++abi and libunwind in `/app/lib`; the build fails when
a library the executable needs is in neither the Platform nor `/app/lib`, or
when the executable or a library in `/app/lib` links the Platform's
libunwind 8 beside LLVM's. Both scripts
keep their state under `imsd-messages/flatpak` in `$XDG_CACHE_HOME`
(`~/.cache` when unset; `IMSD_MESSAGES_FLATPAK_CACHE` names another
directory) and run the crafter-build that `CRAFTER_REF` names
(`net.catcrafts.CrafterBuild//stable` by default).
The flatpak carries the licences of what it ships under
`/app/share/licenses/net.catcrafts.ImsdMessages/`: `LICENSE`,
`assets/OFL.txt`, the texts in `packaging/licenses/` (its `NOTICE` names
what each covers) and LLVM's runtime licences, which
make-flatpak-sysroot.sh keeps beside libc++. The texts in
`packaging/licenses/` follow what the pinned Crafter.Graphics carries and
compiles in: a new pin checks them again.
The sandbox has Wayland, the GPU, `net.catcrafts.IMS1` on the system bus
and `org.freedesktop.Notifications` on the session bus. When `FLATPAK_ID`
is the app's own id, as inside its flatpak, the instance asks the
Background portal when it starts (not for `--send` or `--headless`) to
start `imsd-messages --daemon` at login (`ImsdMessages.Bus:Background`);
the portal writes the login entry again at each request while the
background permission allows it.
ci: build the aarch64 flatpak and publish it The flatpak is built after the tests for pull requests, when started by hand and for a pushed tag X.Y.Z. Only the tag's run publishes: the flatpak to the Catcrafts flatpak repository as its stable branch, the app's ref file beside the repository with the repository's key in it — the checkout's file, read as the build user like every file of the checkout, made before anything is published, so a file that cannot carry the key publishes nothing, and moved into place after it — and release X.Y.Z on the forge with the metainfo's notes, the bundle and that ref file. A push to main without a tag runs nothing. That is the release model of Crafter.Build 6: every push to main is a release, made by the tag the owner signs and pushes with it. packaging/release-version.sh makes that workflow's checks — the tag is the version of the app and of the metainfo's newest release, annotated and signed by the owner as Forgejo verifies it, on main, and newer than every release published — and in every run checks the app's version against the metainfo's, as the version's comment in Model.cppm now says. Release runs share a concurrency group, so one queues behind another. Two jobs, by trust: check builds a pull request or a run by hand with neither the published repository nor its key, publish builds a pushed tag, and only its volumes feed what is signed. Both run on the organisation's privileged flatpak runner: check cold, with no host volume; publish with the four volumes it mounts — the crafter-build installation the organisation's publish jobs share, this app's own cache, the repository and the key — which the runner's config must allow. It publishes into the repository Crafter.Build's and Crafter.Review's workflows publish to, under the lock each of them holds while it commits and updates the summary, signed with the same key, which stays on the runner host, and keeps its bundle as an artifact. The pacman and flatpak downloads get five tries, 30 s apart: Flathub's CDN and Arch's Fastly mirror answer 502 now and then, flatpak reports a summary it could not fetch as a missing runtime, and a mirror answering 502 can fail a pacman transaction even with another mirror behind it. The README says how to install it and how to stop it starting at login; AGENTS.md describes CI, a release, what guards the volumes and which of them the runner must allow, and names what a released copy leaves on a phone that later releases keep good: the stored rows and their enumerators, the conversation key, the app id and the login entry's command, the instance's interface.
2026-10-20 23:50:39 +02:00
## 5. CI and publishing
`.forgejo/workflows/flatpak.yaml` runs for pull requests into `main`, when
started by hand and for a pushed tag `X.Y.Z`: the sysroot, the tests,
then the flatpak as in §4. Only a tag's run publishes: the flatpak to the
Catcrafts repository (flatpak.catcrafts.net) as its `stable` branch, the
app's `.flatpakref` beside the repository with the repository's key in
it, and release `X.Y.Z` on the forge with the release notes, the bundle,
that ref file and their `SHA256SUMS`; it keeps the bundle as an artifact
as well. A push to `main` without a tag runs nothing.
Every push to `main` is a release, made by the signed tag pushed with it.
The range's last commit has the new `version` (`ImsdMessages:Model`) and,
at the top of the metainfo's `<releases>`, its `<release>` entry, dated
the day of the push in UTC. The entry's description is the release notes:
up to three sections, `<p>New</p>`, `<p>Fixes</p>` and `<p>Breaking</p>`
in that order, each followed by a `<ul>` of its items. The owner signs the
tag on the commit `main` is to receive, and both go out in one push:
```sh
git tag -s X.Y.Z -m 'imsd-messages X.Y.Z'
git push --atomic origin HEAD:main X.Y.Z
```
`packaging/release-version.sh` prints a tree's version once the app's and
the metainfo's agree and the notes render; CI runs it before it builds.
For a tag it also checks that the tag is that version, that the forge has
it on the run's commit as an annotated tag and verifies it as signed by
the workflow's `RELEASE_SIGNER`, that the commit is on `main`, and that
neither that version nor a newer one is released. Run it before tagging:
without a pull request or a run started by hand, CI first sees a range at
its tag. Release runs
share the workflow's concurrency group and queue one behind another. A
failed one can be run again while no newer release exists, once a release
it left half made is deleted; when the fix needs a commit, that push is
the next version's release.
Two jobs, by trust: `check` builds a pull request and a run by hand
cold — no host volume, neither the repository nor its key; `publish`
builds a pushed tag with the four volumes it mounts:
`crafter-flatpak-org-system` (the crafter-build installation shared by
every consumer repository's publish job on the runner — crafter-build
`//stable` and its runtime; never mounted for a pull request's job),
`crafter-flatpak-messages-cache` (this app's aarch64 Sdk,
sysroot and build cache, kept between runs), `/var/www/flatpak` and
`/etc/crafter-flatpak`. The last two are the repository and its signing
key that Crafter.Build's workflow publishes with; that workflow writes the
repository's `catcrafts.flatpakrepo`, and this one refuses to publish
into a repository that is not there. Both jobs run on the Catcrafts
organisation's privileged `flatpak` runner (a forgejo-runner on the
Hetzner box that serves every repository), whose config must allow
exactly those four volumes. The split is the workflow's own: a runner
admits its volumes to every job it runs, so a pull request that edits
the workflow can mount them. Forgejo holds the runs of a pull request
whose author has no write access until someone who has approves them,
and approving trusts all of it, not its `.forgejo/` diff alone: the
workflow hands the repository's scripts and tests to an unprivileged
user, which is no boundary — a step's code can add to the path of the
steps after it, and those start as root in a privileged container.
Approve once — an author approved always is not held again until that
trust is revoked: by hand, with a block, or by the forge after three
months without a pull request of theirs. The
workflow uses no secret of the forge but the run's own token, which
creates the release: the signing key is a file on the runner's host.
Crafter.Review's workflow publishes into that repository as well, and
each of the three workflows holds an flock on
`/var/www/flatpak/.publish.lock` while it commits and updates the
summary.
## 6. Making changes
- Commit messages: subject `area: what changes`, the body says why; no AI
attribution trailers; every commit GPG-signed with the repository's
configured identity.
ci: build the aarch64 flatpak and publish it The flatpak is built after the tests for pull requests, when started by hand and for a pushed tag X.Y.Z. Only the tag's run publishes: the flatpak to the Catcrafts flatpak repository as its stable branch, the app's ref file beside the repository with the repository's key in it — the checkout's file, read as the build user like every file of the checkout, made before anything is published, so a file that cannot carry the key publishes nothing, and moved into place after it — and release X.Y.Z on the forge with the metainfo's notes, the bundle and that ref file. A push to main without a tag runs nothing. That is the release model of Crafter.Build 6: every push to main is a release, made by the tag the owner signs and pushes with it. packaging/release-version.sh makes that workflow's checks — the tag is the version of the app and of the metainfo's newest release, annotated and signed by the owner as Forgejo verifies it, on main, and newer than every release published — and in every run checks the app's version against the metainfo's, as the version's comment in Model.cppm now says. Release runs share a concurrency group, so one queues behind another. Two jobs, by trust: check builds a pull request or a run by hand with neither the published repository nor its key, publish builds a pushed tag, and only its volumes feed what is signed. Both run on the organisation's privileged flatpak runner: check cold, with no host volume; publish with the four volumes it mounts — the crafter-build installation the organisation's publish jobs share, this app's own cache, the repository and the key — which the runner's config must allow. It publishes into the repository Crafter.Build's and Crafter.Review's workflows publish to, under the lock each of them holds while it commits and updates the summary, signed with the same key, which stays on the runner host, and keeps its bundle as an artifact. The pacman and flatpak downloads get five tries, 30 s apart: Flathub's CDN and Arch's Fastly mirror answer 502 now and then, flatpak reports a summary it could not fetch as a missing runtime, and a mirror answering 502 can fail a pacman transaction even with another mirror behind it. The README says how to install it and how to stop it starting at login; AGENTS.md describes CI, a release, what guards the volumes and which of them the runner must allow, and names what a released copy leaves on a phone that later releases keep good: the stored rows and their enumerators, the conversation key, the app id and the login entry's command, the instance's interface.
2026-10-20 23:50:39 +02:00
- `test` passing and `format --check` and `lint` reporting clean before a
push; every push goes through the fp6 project's `/prepush` gates.
- Every source file starts with the two SPDX lines and a blank line — after
a shebang or an XML declaration where the file has one, as `#` comments in
ci: build the aarch64 flatpak and publish it The flatpak is built after the tests for pull requests, when started by hand and for a pushed tag X.Y.Z. Only the tag's run publishes: the flatpak to the Catcrafts flatpak repository as its stable branch, the app's ref file beside the repository with the repository's key in it — the checkout's file, read as the build user like every file of the checkout, made before anything is published, so a file that cannot carry the key publishes nothing, and moved into place after it — and release X.Y.Z on the forge with the metainfo's notes, the bundle and that ref file. A push to main without a tag runs nothing. That is the release model of Crafter.Build 6: every push to main is a release, made by the tag the owner signs and pushes with it. packaging/release-version.sh makes that workflow's checks — the tag is the version of the app and of the metainfo's newest release, annotated and signed by the owner as Forgejo verifies it, on main, and newer than every release published — and in every run checks the app's version against the metainfo's, as the version's comment in Model.cppm now says. Release runs share a concurrency group, so one queues behind another. Two jobs, by trust: check builds a pull request or a run by hand with neither the published repository nor its key, publish builds a pushed tag, and only its volumes feed what is signed. Both run on the organisation's privileged flatpak runner: check cold, with no host volume; publish with the four volumes it mounts — the crafter-build installation the organisation's publish jobs share, this app's own cache, the repository and the key — which the runner's config must allow. It publishes into the repository Crafter.Build's and Crafter.Review's workflows publish to, under the lock each of them holds while it commits and updates the summary, signed with the same key, which stays on the runner host, and keeps its bundle as an artifact. The pacman and flatpak downloads get five tries, 30 s apart: Flathub's CDN and Arch's Fastly mirror answer 502 now and then, flatpak reports a summary it could not fetch as a missing runtime, and a mirror answering 502 can fail a pacman transaction even with another mirror behind it. The README says how to install it and how to stop it starting at login; AGENTS.md describes CI, a release, what guards the volumes and which of them the runner must allow, and names what a released copy leaves on a phone that later releases keep good: the stored rows and their enumerators, the conversation key, the app id and the login entry's command, the instance's interface.
2026-10-20 23:50:39 +02:00
a desktop entry or a ref file; the metainfo carries AppStream's single
CC0-1.0 line instead.
- What a released copy leaves on a phone stays good across releases: the
stored rows (a changed column is a version bump that keeps the old
layout, Crafter.DB's rule) and the values of `Direction` and
`MessageState` in them (a new one is appended); the conversation key (a
changed `NormalizeNumber` rule re-keys the stored conversations from
`peer`); the app id, and `imsd-messages --daemon`, which the login entry
runs; and `org.freedesktop.Application` with its `quit` action on
`/net/catcrafts/ImsdMessages` — after an update the old instance runs on
until it restarts, and the new launcher forwards to it.