This repository was archived by the owner on Nov 15, 2026. It is now read-only.
Repository navigation
feat(readd): the desktop mode, items.render and items.exportMarkdown (plan 0002 Phase 2) - #25
Merged
Merged
Conversation
…(plan 0002 Phase 2) readd -desktop is the Flatpak's own readd (ADR-0008): only its private socket, the XDG state and configuration, the socket under $XDG_RUNTIME_DIR/app/org.frostyard.Frostread when FLATPAK_ID says so, a flock on <state>/readd.lock (on lodge's host too), the app.json mode check under it, -log with rotation past 1 MiB, -build, status.build and daemon.shutdown. readctl gains -desktop and shutdown. One renderer serves lodge's content route and items.render, which adds the CSP meta and keeps the encoded answer under 12 MiB (tooLarge, 1006). items.exportMarkdown gives a note's Markdown without its marker and link.
… render bound states its id allowance The lock and database checks used XDG_DATA_HOME instead of the state directory readd derives in it. The envelope allowance holds an id of up to 990 bytes, which the kit does not hand a handler; the spec says so, and a socket test measures the whole answer's line near the bound.
…llowance The kit hands a handler no request id, so items.render cannot count a long one. Every connection now refuses a request whose encoded id is longer than 990 bytes with invalidRequest and id null, before dispatch, so every answer stays under the 12 MiB bound (ADR-0008).
Step 1 measured the no-image page with omittedImages 0, but the fallback answers it with every stored image counted, whose digits are on the wire too. Step 1 now measures that answer, and an exact-boundary test with 100 omitted images and a 990-byte id holds it. The spec limits the 12 MiB statement to items.render.
bketelsen
approved these changes
Oct 28, 2026
This was referenced Oct 29, 2026
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan 0002 Phase 2: readd's desktop mode (ADR-0008). This change is Go only: no shell, no web UI and no Flatpak.
What changes
readd -desktop: it serves only the private socket. It opens no lodge socket, serves no/content/and no MCP, builds no notes client, and opens no TCP port.$XDG_DATA_HOME/frostread; configuration in$XDG_CONFIG_HOME/frostread/frostread.json(READ_CONFIGwins).$XDG_RUNTIME_DIR/app/org.frostyard.Frostread/frostread/readd.sockwhenFLATPAK_IDsays so, else$XDG_RUNTIME_DIR/frostread/readd.sock.READ_SOCKETand--socketwin.flockon<state>/readd.lock. It also applies on lodge's host. A second readd exits with "another readd uses ".app.jsonafter it takes the lock. Whenapp.jsonnames lodge, readd releases the lock and exits 0, and it does not open the database.-log FILErotates the log past 1 MiB, after readd takes the lock.-buildprints theapp-commitfrom/.flatpak-info.status.build(optional) anddaemon.shutdown(callerlocal; it stops readd throughjsonrpc.AfterReply). In lodge modedaemon.shutdownanswersunavailable, because systemd runs readd there.items.render {id, scheme?}(callerslocalandsession) uses the same renderer as the content route. Its page adds the CSP meta, and its encoded answer stays under 12 MiB. The order is: the page with no images, then images in document order while they fit, then a measure of the final answer with a fallback. A new errortooLarge(1006).items.exportMarkdown {id}(callerlocal): the Markdown of a note, without theread_itemmarker and without the "Open in Read" link.readctl:-desktop,shutdown, andstatusprints the build.specs/api.mdgets a "Desktop mode" section, a section on rendering and a section on export. Also updated: the schema (schema/rpc/daemon.yamlis new), the design overview, AGENTS.md and the plan's status.Tests (Phase 2 "Done when")
readd -desktopwith a temporary XDG tree andFLATPAK_IDservesrpc.helloandstatuson the derived socket. It polls anhttptestfeed served on a Unix socket.app.jsonthat names lodge, readd returns nil and nofrostread.dbexists. Afterdaemon.shutdown, readd returns nil and the lock is free./proc/self/fdand/proc/self/net/*: no TCP or UDP socket of the process listens, and the only Unix listeners are the private socket and the test's own feed socket.items.render:omittedImages.tooLargeboundary at exactly the limit.make check,make raceandmake crosspass locally.Notes
web/src/rpc/testdata/items.render.jsonis a new golden. Phase 3 adds its TypeScript type. No web code changes.