Skip to content

feat(flatpak): carry notesd and notesctl only - #294

Merged
bketelsen merged 1 commit into
mainfrom
feat/flatpak-notesd-only
Nov 26, 2026
Merged

bketelsen merged 1 commit into
mainfrom
feat/flatpak-notesd-only

Conversation

@bketelsen

Copy link
Copy Markdown
Contributor

Summary

Plan 0011, Phase 2, "The Flatpak carries notesd" (ADR-0050, on #292). org.frostyard.Frostnotes now holds notesd, notesctl, the launcher and the Background helper, and no window: a desktop edits its vault folders with any editor of Markdown files, Obsidian among them, and notesd syncs them. The desktop clients' code stays in the repository; Phase 3 removes it. This PR links ADR-0050, which lands with #292: merge it after #292.

What the Flatpak holds. /app/bin/frostnotes (the launcher), /app/bin/notesd, /app/bin/notesctl, /app/libexec/frostnotes-request-background, the metainfo and the icons. No MyGo or NSGo client, no --mygo, and no desktop entry. App ID, data directory, socket path and the device-token rules of ADR-0045 are unchanged.

Permissions. Kept: --share=network (the hub), --talk-name=org.freedesktop.secrets (the device token), --filesystem=home (vault folders, watched and written in place). Dropped, because only the window used them: --socket=wayland and --socket=fallback-x11 (a display), --share=ipc (X11 shared memory), --device=dri (the GPU that drew the window), --socket=pulseaudio (sound).

The launcher. flatpak run org.frostyard.Frostnotes replaces a notesd of an older build (ADR-0032, unchanged), starts notesd through flatpak-spawn --latest-version frostnotes --notesd when none answers (once per data directory, as before), then runs the Background request and waits for it (with no window, its sandbox ends when it exits, and the portal drops a request whose caller left the bus), and last execs notesctl status, whose output and exit status are the launcher's. --notesd and --background (the autostart entry's command line) are as before; the off line in notesd.log now names notesctl background on. Any other option (--mygo) exits 2 and says Frostnotes has no window; --help names the setup.

Background activity (ADR-0033's setting) is on by default and is a notesctl command, notesctl background [on|off], not a launcher flag: notesctl is the setup's one command line, it runs in the app's sandbox with the same config and state directories, it waits for the portal's answer and reads it back, and its Go code has tests on rpctest. Off does not stop a running notesd (it says so: until logout or notesctl shutdown). A refusal names flatpak permission-set background background org.frostyard.Frostnotes yes, since without a desktop entry GNOME Settings does not list the app.

Desktop entry and metainfo. No desktop entry: it would open nothing. AppStream requires a desktop-application to name a desktop entry as its launchable, so the component is a console-application, which must provide a binary (notesctl); the icon is named as a stock icon so appstreamcli compose caches it and the OCI labels carry it to flatpak-index (whose runbook asks only for the metainfo and icons). appstreamcli validate --no-net --pedantic passes locally (1 pedantic note, the same as before: an uppercase letter in the ID). The one screenshot, docs/images/notesctl-setup.png, is a terminal picture of vault add, hub join, sync status, ls and status: the real output of the built notesd and notesctl, run in the Flatpak's environment (its socket path and setting files, FROSTNOTES_SECRETS=file, no session bus) against a hub notesd on loopback, with a stand-in Background helper that grants, and the temporary directories shown as /home/ana and /run/user/1000. It was drawn by a throwaway Go program, not committed. Consequences: the app grid shows no Frostnotes; GNOME Settings' Apps does not list it; whether GNOME's Background Apps menu lists the notesd is not checked.

notesctl. Already there: vault add (--create, --name), hub join URL NAME (pairs when needed, waits for approval, re-pairs once on a revoked token), sync status|conflicts|leave. Added:

  • notesctl status: whether notesd answers, each vault with its sync, the paired hubs, and in the Flatpak the background setting; when notesd does not answer, the last 10 lines of notesd.log and, after the launcher's portal failure, the 3-step fix; exits non-zero then. --json too.
  • notesctl background [on|off].
  • notesctl hub pair URL [--device NAME]: pair, or pair again, without joining a vault (the windows' "Pair again").

internal/desktop/vaults was not reused: hub join already has its pairing, approval and re-pair rules, with tests. The Flatpak's files (paths, notesd.log's end, the background setting) moved from internal/desktop/system to a UI-free internal/flatpakapp (Change and Ask let notesctl wait for the helper); internal/desktop/system names them for the clients, unchanged in behaviour.

What an existing install sees after the update. The same app ID, data directory, socket and Secret Service item, so its vaults and pairing stay. The autostart entry that the portal wrote runs frostnotes --background, which the launcher still takes, so notesd starts at the next login. A background setting a window turned off stays off. The app's desktop entry goes. A notesd of the old build keeps running until logout or the next flatpak run org.frostyard.Frostnotes. The update removes permissions only, which needs no consent.

Also. make flatpak-sources no longer reads the NSGo module (go-sources.json: 228 lines removed, nothing added). stamp-version.sh no longer stamps NSGO_VERSION. CI's export job gains a step that checks the bundle: the 4 programs, no client or desktop entry, no sockets=/devices= in its metadata, and a composed console-application with a cached icon. packaging/nsgo/build-rc.sh copies this launcher, so the NSGo preview now starts notesd and no window; docs/development.md says so, and Phase 3 removes the preview. Plan 0011's status is not edited.

Risk tier

Risk tier: 3 — risk:high paths:

  • packaging/flatpak/org.frostyard.Frostnotes.json (L1): builds ./cmd/notesd ./cmd/notesctl only (no MyGo tag or ldflag, no NSGo build), drops 5 window permissions and adds none, and installs no desktop entry. Safe: only removals in finish-args; app ID, runtime, Go pin and sources are unchanged; the test commands check what /app holds.
  • packaging/flatpak/frostnotes.sh (L1): the default path no longer execs a window; it waits for the Background helper and execs notesctl status. --notesd, --background, the update replacement and every bound are unchanged. Safe: the smoke test covers each path, and the old autostart entries' --background still works.
  • packaging/flatpak/request-background.py (L1): docstrings, comments and the request's reason text only; no logic changed.
  • packaging/flatpak/stamp-version.sh (L1): removes the NSGO_VERSION stamp, whose manifest line is gone. Safe: TestStampVersion* in internal/packagecheck still pass.
  • .github/workflows/flatpak.yml (L1 and L2): adds one run step to the export job that reads the built bundle with ostree; no new action, permission, secret or trigger.

Docs housekeeping

  • Cross-links added in both directions (ADR ↔ design ↔ spec ↔ plan): design/app.md "The Flatpak" names ADR-0050 and plan 0011's Phase 2
  • Conformance aliases and canonical symlinks are unchanged; canonical targets are edited instead (AGENTS.md map)

Verification

  • make check green (host): exit 0 on f2cd7af
  • make flatpak-sources run (the script changed, not go.mod)
  • The smoke test, run on the host outside a Flatpak with the built binaries and stand-in portals (FROSTNOTES_BIN_DIR=… sh packaging/flatpak/smoke-test.sh): "smoke test passed"
  • appstreamcli validate --no-net --pedantic on the metainfo: passed, 1 pedantic note
  • core's check-readme.mjs (core f99acfd, in the nsl machine): ok README.md (app, 905 words)
  • actionlint .github/workflows/flatpak.yml: no findings
  • Workflows changed: the added step uses no action

Not run here: the Flatpak build itself (the Makefile has no target for it; CI's Flatpak job builds and tests it), and nothing on a real desktop: plan 0011's Phase 2 "Done when" (a clean install with notesctl alone, a logout and login, and an existing install's update) still needs a desktop run.

@github-actions github-actions Bot added level:L1 Read every line risk:high Touches a path in .github/risk-paths.json labels Nov 25, 2026
Plan 0011, Phase 2 (ADR-0050): the Flatpak holds notesd, notesctl, the
launcher and the Background helper, and no window. It drops the window's
permissions (wayland, fallback-x11, ipc, dri, pulseaudio), the desktop
entry and the MyGo and NSGo builds, and its AppStream component becomes a
console-application that provides notesctl.

The launcher starts notesd as before, waits for the Background request,
and ends with notesctl status. notesctl gains status (notesd, its vaults,
their sync, the hubs, the background setting, or why notesd is not
running), background [on|off] (ADR-0033's setting, on by default) and
hub pair. The Flatpak's files move from internal/desktop/system to the
UI-free internal/flatpakapp.
@bketelsen
bketelsen force-pushed the feat/flatpak-notesd-only branch from f2cd7af to 6b2d9e8 Compare November 26, 2026 10:47
@bketelsen
bketelsen merged commit 7d2e715 into main Nov 26, 2026
15 checks passed
@bketelsen
bketelsen deleted the feat/flatpak-notesd-only branch November 26, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L1 Read every line risk:high Touches a path in .github/risk-paths.json

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant