<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: freerave</title>
    <description>The latest articles on DEV Community by freerave (@freerave).</description>
    <link>https://dev.to/freerave</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3563889%2F6ecf3060-63f8-46f1-9869-b61412ef894c.png</url>
      <title>DEV Community: freerave</title>
      <link>https://dev.to/freerave</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/freerave"/>
    <language>en</language>
    <item>
      <title>Teaching a file converter to listen and to read</title>
      <dc:creator>freerave</dc:creator>
      <pubDate>Sat, 28 Nov 2026 11:11:00 +0000</pubDate>
      <link>https://dev.to/freerave/teaching-a-file-converter-to-listen-and-to-read-2mb3</link>
      <guid>https://dev.to/freerave/teaching-a-file-converter-to-listen-and-to-read-2mb3</guid>
      <description>&lt;p&gt;A few weeks after &lt;a href="https://dev.to/freerave/i-built-a-radial-menu-that-converts-any-file-on-linux-4c4m"&gt;part 1&lt;/a&gt; went out, someone opened an issue on DotMorph asking for one thing: drag an audio file onto the wheel and get its text back, as a file or straight to the clipboard.&lt;/p&gt;

&lt;p&gt;It was a good request, and it changed how I thought about the app. Until then DotMorph converted &lt;em&gt;formats&lt;/em&gt;: PNG to WebP, MOV to MP4. A transcript isn't another format of the same audio. It's what the audio &lt;em&gt;says&lt;/em&gt;. The same goes for a screenshot of an error message, or a scanned invoice. So 2.2 teaches DotMorph to listen and to read, without breaking the rule that nothing leaves your machine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpsiuxuygcxsd6t4ecwil.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpsiuxuygcxsd6t4ecwil.png" alt="The DotMorph wheel for a voice memo: the Docs fan offers TXT, SRT and VTT" width="620" height="620"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why whisper.cpp, and not "pip install whisper"
&lt;/h2&gt;

&lt;p&gt;OpenAI's Whisper is the obvious model. The obvious way to run it is the Python package, which pulls in PyTorch: gigabytes of dependencies for one feature of a file converter. That was never going to ship in a .deb.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ggml-org/whisper.cpp" rel="noopener noreferrer"&gt;whisper.cpp&lt;/a&gt; runs the same models in plain C++ on the CPU, and it's already packaged: &lt;code&gt;whisper.cpp-tools&lt;/code&gt; on Debian and Kali, &lt;code&gt;whisper-cpp&lt;/code&gt; on Fedora, &lt;code&gt;whisper.cpp&lt;/code&gt; on Arch. It gives you a &lt;code&gt;whisper-cli&lt;/code&gt; binary, and DotMorph is built around exactly that kind of tool. In &lt;a href="https://dev.to/freerave/8-backends-one-engine-and-the-svg-bug-that-started-it-all-3ooo"&gt;part 2&lt;/a&gt; I described how every converter is a backend that declares what it needs, and the registry only offers what's installed. Transcription is just one more backend:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;WHISPER&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Requirement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"whisper-cli"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"apt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"whisper.cpp-tools"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"dnf"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"whisper-cpp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                      &lt;span class="s2"&gt;"pacman"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"whisper.cpp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"zypper"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"whisper-cpp"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                      &lt;span class="s2"&gt;"speech to text"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="no"&gt;TARGETS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"txt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"srt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"vtt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"copy-text"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;WhisperBackend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Backend&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"whisper"&lt;/span&gt;
    &lt;span class="n"&gt;requirements&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;WHISPER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;FFMPEG&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;MODEL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three requirements: the binary, ffmpeg (more on that below), and a model file. If any of them is missing, TXT, SRT and VTT simply don't appear for audio files, and &lt;code&gt;dotmorph doctor&lt;/code&gt; says what to install. No error dialogs, no half-working menu entries.&lt;/p&gt;

&lt;h2&gt;
  
  
  The model is the one download
&lt;/h2&gt;

&lt;p&gt;The binary is small, but it needs a model: a &lt;code&gt;ggml-*.bin&lt;/code&gt; file from the whisper.cpp project. They range from 75 MB (&lt;code&gt;tiny&lt;/code&gt;) to 1.6 GB (&lt;code&gt;large-v3-turbo&lt;/code&gt;). DotMorph defaults to &lt;code&gt;base&lt;/code&gt;, 142 MB, which handles clear speech in most languages and runs fine on a laptop CPU.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo apt install whisper.cpp-tools
dotmorph whisper --download          &lt;span class="c"&gt;# base, 142 MB&lt;/span&gt;
dotmorph whisper --download small    &lt;span class="c"&gt;# or tiny, medium, large-v3-turbo&lt;/span&gt;
dotmorph whisper --list              &lt;span class="c"&gt;# what's installed, and where&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the only time DotMorph goes online, and only because you typed that command. Models go to &lt;code&gt;~/.local/share/dotmorph/whisper/&lt;/code&gt;, are downloaded to a &lt;code&gt;.part&lt;/code&gt; file first and checked against the server's length before being renamed, so a dropped connection never leaves a broken model behind.&lt;/p&gt;

&lt;p&gt;Finding the model is a small function with an order that matters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;find_model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""$DOTMORPH_WHISPER_MODEL, else the default model, else the best one installed."""&lt;/span&gt;
    &lt;span class="n"&gt;env&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"DOTMORPH_WHISPER_MODEL"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;
    &lt;span class="n"&gt;models&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;installed_models&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;DEFAULT_MODEL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="nb"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;iter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model check is itself a &lt;code&gt;Requirement&lt;/code&gt; subclass whose &lt;code&gt;present()&lt;/code&gt; calls &lt;code&gt;find_model()&lt;/code&gt;, and whose install hint is &lt;code&gt;dotmorph whisper --download&lt;/code&gt;. So the doctor, the wheel and the CLI all agree on one answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  From a voice memo to subtitles
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fczgkk09p7s1x6wmq8lo9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fczgkk09p7s1x6wmq8lo9.png" alt="The transcription pipeline: ffmpeg makes a 16 kHz mono WAV, whisper-cli writes SRT, DotMorph finalizes the file or copies the text" width="800" height="298"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;whisper.cpp wants 16 kHz mono PCM. Your files are MP3s, Opus voice notes from your phone, MKV screen recordings. So the backend runs ffmpeg first, then whisper-cli:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;run_tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;ffmpeg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-nostdin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-hide_banner"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-i"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="s2"&gt;"-vn"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-ac"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-ar"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"16000"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-c:a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"pcm_s16le"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wav&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;run_tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;exe&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-m"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-f"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wav&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-l"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;spoken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;language&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="no"&gt;OUTPUT_FLAG&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-of"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tmpdir&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="s2"&gt;"out"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-pp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-t"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;threads&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on_err_line&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the audio goes through ffmpeg anyway, video works for free: any MP4 or MKV becomes SRT subtitles. &lt;code&gt;-l auto&lt;/code&gt; lets Whisper detect the language; &lt;code&gt;--lang ar&lt;/code&gt; on the command line pins it.&lt;/p&gt;

&lt;p&gt;Everything runs inside the same &lt;code&gt;workdir()&lt;/code&gt; + &lt;code&gt;finalize()&lt;/code&gt; pattern as every other backend: whisper writes into a private temp folder, and only a finished file is moved next to your original, under a name that never overwrites anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Progress from stderr
&lt;/h2&gt;

&lt;p&gt;The wheel has a progress arc, and a long recording can take minutes. whisper.cpp has a &lt;code&gt;-pp&lt;/code&gt; flag that prints lines like &lt;code&gt;progress = 37%&lt;/code&gt;, but on &lt;strong&gt;stderr&lt;/strong&gt;, while ffmpeg's &lt;code&gt;-progress&lt;/code&gt; output (which the rest of DotMorph already parsed) is on stdout.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;run_tool()&lt;/code&gt;, the one function every backend uses to run a tool (process group, cancel, timeout), already pumped stderr in a thread to keep its last lines for error messages. It got one new hook:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;proc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stderr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;err_chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;on_err_line&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;on_err_line&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rstrip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"\n"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and the backend turns those lines into the arc, keeping the first 5% for the ffmpeg step:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;_PROGRESS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="s2"&gt;"progress\s*=\s*(\d+)%"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;_PROGRESS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.05&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;0.9&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;group&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cancel works the same as for a video encode: the whole process group is killed, the temp folder disappears, nothing is left behind.&lt;/p&gt;

&lt;h2&gt;
  
  
  A real result
&lt;/h2&gt;

&lt;p&gt;To have something I can show without anyone's voice, I made a 9-second clip with &lt;code&gt;espeak&lt;/code&gt; and ran it through DotMorph with the smallest model, &lt;code&gt;tiny&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;espeak -v en-us -s 150 -w memo-en.wav &lt;span class="s2"&gt;"Meeting notes. We ship version two point two on Friday. \
  Kareem writes the release notes, and the tests must pass on Python three ten."&lt;/span&gt;
dotmorph convert memo-en.wav --to srt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1
00:00:00,000 --&amp;gt; 00:00:06,720
 meeting notes. We ship version 2.2 on Friday. Karim writes the release notes, and the

2
00:00:06,720 --&amp;gt; 00:00:09,200
 test must pass on Python 310.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's unedited. Notice what it got right: "two point two" became &lt;code&gt;2.2&lt;/code&gt;, the punctuation is there, the timestamps split at a sensible point. And what it didn't: my name became Karim, "tests" lost its s, and "Python three ten" became &lt;code&gt;310&lt;/code&gt;. That's the tiny model on a robotic voice. &lt;code&gt;base&lt;/code&gt; and &lt;code&gt;small&lt;/code&gt; do noticeably better on real speech, which is why &lt;code&gt;base&lt;/code&gt; is the default.&lt;/p&gt;

&lt;h2&gt;
  
  
  Copy text
&lt;/h2&gt;

&lt;p&gt;The issue asked for "copy/paste of the transcribed file", and that's the most useful form: you record a voice note, right-click it, and the text is in your clipboard. &lt;strong&gt;Copy text&lt;/strong&gt; is a tool in the wheel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_copy_commands&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;cmds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"WAYLAND_DISPLAY"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;shutil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;which&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"wl-copy"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;cmds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"wl-copy"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"--type"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"text/plain;charset=utf-8"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"DISPLAY"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;shutil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;which&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"xclip"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;cmds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"xclip"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-selection"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"clipboard"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-in"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;shutil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;which&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"xsel"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;cmds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"xsel"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"--clipboard"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"--input"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;cmds&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One subtlety: on Linux the clipboard isn't a buffer you write into. The program that copied the text has to &lt;em&gt;stay alive&lt;/em&gt; and hand it out when someone pastes. &lt;code&gt;wl-copy&lt;/code&gt; and &lt;code&gt;xclip&lt;/code&gt; fork into the background to do that. If one of them doesn't, &lt;code&gt;communicate()&lt;/code&gt; times out while it's busy serving the selection, which is exactly what success looks like, so a timeout counts as copied.&lt;/p&gt;

&lt;p&gt;It also keeps a &lt;code&gt;.txt&lt;/code&gt; next to the file. A transcript can take minutes to compute; a clipboard is gone the next time you copy something.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reading: OCR with Tesseract
&lt;/h2&gt;

&lt;p&gt;Once "the text of this file" existed for audio, it was a small step to images. &lt;a href="https://github.com/tesseract-ocr/tesseract" rel="noopener noreferrer"&gt;Tesseract&lt;/a&gt; is the OCR engine every distro ships, so OCR became another backend with the same three outputs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;TXT&lt;/strong&gt; for images: the text in a file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Copy text&lt;/strong&gt;: the same text on the clipboard. Screenshot an error message, right-click, paste it into a search box.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OCR&lt;/strong&gt;: a searchable PDF, the image with an invisible text layer on top, so you can search and select it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsv2v4xcfml19a0q15cxp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsv2v4xcfml19a0q15cxp.png" alt="A scanned invoice on the left; on the right, the text DotMorph read from it" width="800" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That invoice is a synthetic scan I generated: slightly rotated, blurred, with paper speckle. Tesseract read every line correctly.&lt;/p&gt;

&lt;p&gt;Scanned &lt;strong&gt;PDFs&lt;/strong&gt; are harder, because Tesseract reads images, not PDFs. If &lt;a href="https://github.com/ocrmypdf/OCRmyPDF" rel="noopener noreferrer"&gt;ocrmypdf&lt;/a&gt; is installed, DotMorph hands the whole job to it: it keeps the original images, skips pages that already have text and does a better job overall. Without it, DotMorph does the same thing in three steps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;pages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_pages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tmpdir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;       &lt;span class="c1"&gt;# pdftoppm -r 300 -gray: one PNG per page&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_tesseract&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tmpdir&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"ocr-{i:04d}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"pdf"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# page -&amp;gt; PDF + text&lt;/span&gt;
&lt;span class="c1"&gt;# then Ghostscript merges the per-page PDFs back into one&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the same invoice saved as a PDF, &lt;code&gt;pdftotext&lt;/code&gt; found exactly 1 character before (a form feed) and all of the text after.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which language?
&lt;/h3&gt;

&lt;p&gt;Tesseract needs a language pack per language, and guessing wrong gives garbage. DotMorph reads English plus your interface language, if its pack is installed; an Arabic desktop gets &lt;code&gt;eng+ara&lt;/code&gt;. Ask for a language whose pack is missing and the error names the exact package, so the fix is one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;no OCR language pack for ara: install tesseract-ocr-ara
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--lang&lt;/code&gt; takes the same ISO codes as everywhere else in DotMorph (&lt;code&gt;ar&lt;/code&gt;, &lt;code&gt;de&lt;/code&gt;, &lt;code&gt;pt-BR&lt;/code&gt;), mapped to Tesseract's own names (&lt;code&gt;ara&lt;/code&gt;, &lt;code&gt;deu&lt;/code&gt;, &lt;code&gt;por&lt;/code&gt;). Getting that mapping right for &lt;code&gt;pt-BR&lt;/code&gt; and &lt;code&gt;ar+en&lt;/code&gt; was one of the things a review of this release caught before it shipped.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing a feature that needs a 142 MB model
&lt;/h2&gt;

&lt;p&gt;CI can't download a speech model on every run, and the tests must not depend on how well a model hears. So the whisper tests use a &lt;strong&gt;fake &lt;code&gt;whisper-cli&lt;/code&gt;&lt;/strong&gt;: a tiny Python script that checks its arguments, prints &lt;code&gt;progress = N%&lt;/code&gt; lines on stderr and writes a known transcript. That tests everything DotMorph is responsible for (the ffmpeg step, the flags, &lt;code&gt;--lang&lt;/code&gt;, progress, SRT and VTT, the clipboard, the safe file names) in milliseconds.&lt;/p&gt;

&lt;p&gt;OCR is different: Tesseract is small and in every distro, so CI installs it and the tests run the real thing on images drawn with Pillow, including a two-page scanned PDF that must come out searchable.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;Listening and reading were about what a file &lt;em&gt;says&lt;/em&gt;. &lt;strong&gt;Part 6&lt;/strong&gt; is about a much older question: why won't Discord take my video? It's about "Fit under 10 MB", where the interesting part turned out to be the math: a binary search on JPEG quality, the bitrate a video's length allows, and a Ghostscript setting that made PDFs &lt;em&gt;bigger&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;DotMorph is free and open source: &lt;a href="https://github.com/kareem2099/DotMorph" rel="noopener noreferrer"&gt;github.com/kareem2099/DotMorph&lt;/a&gt;. Version 2.2 is on PyPI, as an AppImage, a .deb and on Arch.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>python</category>
      <category>opensource</category>
      <category>ai</category>
    </item>
    <item>
      <title>Shipping a Linux app five ways from one signed tag</title>
      <dc:creator>freerave</dc:creator>
      <pubDate>Fri, 27 Nov 2026 13:28:52 +0000</pubDate>
      <link>https://dev.to/freerave/shipping-a-linux-app-five-ways-from-one-signed-tag-54kf</link>
      <guid>https://dev.to/freerave/shipping-a-linux-app-five-ways-from-one-signed-tag-54kf</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to/freerave/making-a-file-converter-feel-alive-with-qml-5gl6"&gt;Part 3&lt;/a&gt; ended with a wheel that works great on my machine. This post is about getting it onto everyone else's, and about the moment AppImageHub showed me that "works on my machine" also covered my CI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five packages, on purpose
&lt;/h2&gt;

&lt;p&gt;Linux users install software in very different ways, so DotMorph ships five:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Package&lt;/th&gt;
&lt;th&gt;For&lt;/th&gt;
&lt;th&gt;Uses the system's Qt?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;pipx&lt;/strong&gt; (PyPI)&lt;/td&gt;
&lt;td&gt;anyone with Python 3.10+&lt;/td&gt;
&lt;td&gt;no, pulls PySide6-Essentials&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AppImage&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;"just give me one file"&lt;/td&gt;
&lt;td&gt;no, everything is inside&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;.deb&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Debian, Ubuntu, Kali&lt;/td&gt;
&lt;td&gt;yes (&lt;code&gt;python3-pyside6.*&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Arch package&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Arch and friends, today&lt;/td&gt;
&lt;td&gt;yes (&lt;code&gt;pyside6&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AUR&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;yay -S dotmorph&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;There's &lt;strong&gt;no Flatpak&lt;/strong&gt;, and that's deliberate. DotMorph runs ffmpeg, LibreOffice and friends from your system, adds itself to your file manager, registers a global hotkey, and installs systemd user units for watched folders. A Flatpak sandbox blocks every one of those, so it would only be a lesser copy of the AppImage.&lt;/p&gt;

&lt;h2&gt;
  
  
  One tag, every package
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhlexmyi728e8o4zvxnng.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhlexmyi728e8o4zvxnng.png" alt="The release pipeline: a signed tag, tests, build and smoke tests, checksums and signatures, then GitHub Release, PyPI and AUR" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pushing a &lt;code&gt;vX.Y.Z&lt;/code&gt; tag runs &lt;code&gt;.github/workflows/release.yml&lt;/code&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Tests&lt;/strong&gt; on Python 3.10, 3.12 and 3.13, including the real QML wheel offscreen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build and smoke-test&lt;/strong&gt; every package: the wheel and sdist (&lt;code&gt;twine check&lt;/code&gt;), the &lt;code&gt;.deb&lt;/code&gt; (it must run &lt;code&gt;--version&lt;/code&gt;), the AppImage, and an Arch package built with &lt;code&gt;makepkg&lt;/code&gt; in an &lt;code&gt;archlinux&lt;/code&gt; container, checked with &lt;code&gt;namcap&lt;/code&gt;, installed and run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checksums and signatures&lt;/strong&gt;: one &lt;code&gt;SHA256SUMS&lt;/code&gt; file and a detached &lt;code&gt;.asc&lt;/code&gt; GPG signature for every file. The workflow verifies all of them before going further.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Publish&lt;/strong&gt;: the GitHub Release (notes taken from the CHANGELOG), then PyPI, then the AUR.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;PyPI uses &lt;strong&gt;trusted publishing&lt;/strong&gt;. There's no API token in the repository at all: PyPI trusts this specific workflow file in this specific repository, through a GitHub environment that only release tags can use. The uploads also carry PEP 740 attestations.&lt;/p&gt;

&lt;p&gt;The tags themselves are signed (&lt;code&gt;git tag -s&lt;/code&gt;), so GitHub shows them as &lt;strong&gt;Verified&lt;/strong&gt;. A manual run of the workflow is a dry run: everything except the publishing steps. The whole thing takes about four minutes.&lt;/p&gt;

&lt;p&gt;All of the packaging logic lives in one script, &lt;code&gt;packaging/build.py&lt;/code&gt; (&lt;code&gt;assets&lt;/code&gt;, &lt;code&gt;deb&lt;/code&gt;, &lt;code&gt;appimage&lt;/code&gt;, &lt;code&gt;aur&lt;/code&gt;, &lt;code&gt;sums&lt;/code&gt;…), so CI and my laptop run exactly the same code.&lt;/p&gt;

&lt;h2&gt;
  
  
  The AppImage, three bugs in
&lt;/h2&gt;

&lt;p&gt;The AppImage is built with &lt;a href="https://github.com/niess/python-appimage" rel="noopener noreferrer"&gt;python-appimage&lt;/a&gt;: a relocatable Python, with pip installing PySide6 and DotMorph into it. Here's what that taught me.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bug 1: &lt;code&gt;cannot open 6.10&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;PySide6 6.10+ wheels need glibc 2.34. PySide6 6.9 needs 2.28, which means Ubuntu 20.04, Debian 11 and RHEL 8. So I pinned &lt;code&gt;PySide6-Essentials&amp;lt;6.10&lt;/code&gt;, and the build failed with &lt;code&gt;cannot open 6.10&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;python-appimage passes requirements through a shell, unquoted, so &lt;code&gt;&amp;lt;6.10&lt;/code&gt; became "read input from a file named 6.10". The fix is an operator with no shell meaning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# manylinux_2_28 wheels: runs on glibc 2.28+. Written with ~= (6.9.x): python-appimage passes&lt;/span&gt;
&lt;span class="c1"&gt;# requirements through the shell unquoted, so "&amp;lt;" or "&amp;gt;" would become redirections.&lt;/span&gt;
&lt;span class="no"&gt;APPIMAGE_PYSIDE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"PySide6-Essentials~=6.9.0"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Bug 2: &lt;code&gt;Settings-x86_64.AppImage&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The first release produced a file called &lt;code&gt;Settings-x86_64.AppImage&lt;/code&gt;. python-appimage names the image after the &lt;strong&gt;last&lt;/strong&gt; &lt;code&gt;Name=&lt;/code&gt; line in the desktop file, and the last one belonged to the launcher's "Settings" action. The desktop file inside the AppImage now keeps only the main entry.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bug 3: 109 MB for a file converter
&lt;/h3&gt;

&lt;p&gt;DotMorph's own code is under 1 MB. The AppImage was 109 MB. I unpacked it and measured: 272 MB of the 357 MB inside was PySide6, and a lot of it is developer tooling that a running app never touches. &lt;code&gt;lupdate&lt;/code&gt; alone was 53 MB, plus Qt Designer, &lt;code&gt;qmlls&lt;/code&gt;, test and compiler libraries, unused Quick Controls styles, type stubs and pip.&lt;/p&gt;

&lt;p&gt;python-appimage can leave the AppDir unpacked (&lt;code&gt;--no-packaging&lt;/code&gt;), so the build now trims it before packing it with appimagetool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;APPIMAGE_TRIM&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"pip"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"pip-*.dist-info"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"PySide6/{tool}"&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s2"&gt;"lupdate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"lrelease"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"linguist"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"assistant"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"designer"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"qmlls"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"qmlformat"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"PySide6/*.pyi"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"PySide6/include"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"PySide6/typesystems"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"PySide6/glue"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"PySide6/Qt/lib/libQt6{lib}.so*"&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;lib&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s2"&gt;"Designer"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"DesignerComponents"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"WaylandCompositor"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"QmlCompiler"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Help"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deleting files from a bundle is how you ship a broken app, so there's a guard in two places. &lt;code&gt;APPIMAGE_KEEP&lt;/code&gt; lists what the app does load (QtQuick, Shapes, Effects, Particles, Dialogs, the Basic and Fusion styles, the xcb and wayland platform plugins, ICU…), and the build fails if trimming removed any of it. A unit test also parses every &lt;code&gt;import&lt;/code&gt; in the QML files and checks that no trim pattern matches those modules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Result: 109 MB → 73 MB&lt;/strong&gt;, with the same features.&lt;/p&gt;

&lt;h2&gt;
  
  
  "Works on my machine", including CI
&lt;/h2&gt;

&lt;p&gt;I submitted the AppImage to &lt;a href="https://appimage.github.io" rel="noopener noreferrer"&gt;AppImageHub&lt;/a&gt;, the community catalog that app stores like AppImagePool read from. Their bot downloads the AppImage, starts it on the oldest supported Ubuntu LTS with no network, and expects a window within 30 seconds. It replied:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ERROR: The application exited within 11 seconds instead of showing a window&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The log said &lt;code&gt;libxkbcommon-x11.so.0: cannot open shared object file&lt;/code&gt;, and Qt added that it needs &lt;code&gt;libxcb-cursor0&lt;/code&gt; for its X11 plugin.&lt;/p&gt;

&lt;p&gt;My smoke tests had all passed, for two reasons. My desktop has those libraries because it has a full desktop with Qt apps. And my CI runner had them because &lt;strong&gt;I had installed them myself&lt;/strong&gt; in the workflow so that the smoke test could run. The smoke test also used Qt's &lt;code&gt;offscreen&lt;/code&gt; platform, which never loads the X11 plugin at all.&lt;/p&gt;

&lt;p&gt;So I reproduced their machine instead of guessing. I used a clean &lt;code&gt;ubuntu:22.04&lt;/code&gt; container with only an X server and the libraries the AppImage spec expects every host to provide (libX11, libxcb, libGL, fontconfig…), and no network:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ImportError: libxkbcommon.so.0: cannot open shared object file: No such file or directory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Comparing what Qt's xcb plugin needs with what that machine has gave a list of 16 libraries: &lt;code&gt;libxkbcommon&lt;/code&gt;, &lt;code&gt;libxkbcommon-x11&lt;/code&gt;, &lt;code&gt;libxcb-cursor&lt;/code&gt;, &lt;code&gt;-icccm&lt;/code&gt;, &lt;code&gt;-image&lt;/code&gt;, &lt;code&gt;-keysyms&lt;/code&gt;, &lt;code&gt;-render-util&lt;/code&gt; and nine more XCB extensions. None of them are in PySide6, and none are on the "host provides it" list.&lt;/p&gt;

&lt;p&gt;Bundling them raises one more question: built where? Copying them from a modern distro could quietly raise the glibc requirement and break the "glibc 2.28" promise. The build takes them from &lt;strong&gt;AlmaLinux 8&lt;/strong&gt;, the base of manylinux_2_28, and the newest glibc symbol any of them uses is 2.17:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fetch_x11_libs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dest&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Copy APPIMAGE_X11_LIBS from an AlmaLinux 8 container into dest (next to Qt's libraries,
    which find them through their $ORIGIN runpath)."""&lt;/span&gt;
    &lt;span class="n"&gt;script&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s2"&gt;"set -e; dnf -q -y install epel-release &amp;gt;/dev/null; "&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"dnf -q -y install {' '.join(X11_LIBS_PACKAGES)} &amp;gt;/dev/null; "&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"for l in {' '.join(APPIMAGE_X11_LIBS)}; do cp -L /usr/lib64/$l /out/; done; "&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No &lt;code&gt;patchelf&lt;/code&gt; was needed. &lt;code&gt;libQt6XcbQpa&lt;/code&gt; has a &lt;code&gt;$ORIGIN&lt;/code&gt; runpath and links every one of those libraries directly, so placing them next to it is enough. The total cost is &lt;strong&gt;1.1 MB&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The test that keeps it fixed
&lt;/h3&gt;

&lt;p&gt;The important part was making sure this can't come back silently. &lt;code&gt;build.py appimage-test&lt;/code&gt; now does what AppImageHub does. It builds the clean Ubuntu 22.04 image, starts the extracted AppImage offline under Xvfb on the real X11 plugin, and requires a DotMorph window after 15 seconds. The release workflow runs it on every build. I checked it in both directions: the old 2.0.1 AppImage fails it with the same error, and 2.0.2 passes.&lt;/p&gt;

&lt;p&gt;That test hung on its first run, for an unexpected reason. Inside the container, &lt;code&gt;xvfb-run&lt;/code&gt; ended up as &lt;strong&gt;PID 1&lt;/strong&gt;. It waits for a signal from Xvfb saying the server is ready, and PID 1 doesn't get default signal handling, so it waited forever. &lt;code&gt;docker run --init&lt;/code&gt; puts a tiny init in front of it. The test also has a hard time limit now, so a hang fails the build instead of stalling it.&lt;/p&gt;

&lt;p&gt;AppImageHub's bot re-tested 2.0.2: &lt;strong&gt;Test passed&lt;/strong&gt;, with a screenshot of the wheel. Once the screenshot was approved, the same bot merged the pull request, and DotMorph went &lt;a href="https://appimage.github.io" rel="noopener noreferrer"&gt;into the catalog&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Updates without re-downloading 73 MB
&lt;/h3&gt;

&lt;p&gt;AppImages can carry update information. DotMorph's says "look at the latest GitHub release for a file matching &lt;code&gt;DotMorph-*x86_64.AppImage.zsync&lt;/code&gt;":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;APPIMAGE_UPDATE_INFO&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"gh-releases-zsync|{REPO.replace('/', '|')}|latest"&lt;/span&gt;
                        &lt;span class="s2"&gt;"|DotMorph-*x86_64.AppImage.zsync"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;appimagetool -u&lt;/code&gt; embeds it and writes the &lt;code&gt;.zsync&lt;/code&gt; file next to the image, and the release ships, sums and signs it. AppImageUpdate and AppImageLauncher then download only the blocks that changed.&lt;/p&gt;

&lt;p&gt;This feature hung CI too, of course. On the runner the AppImage runs with &lt;code&gt;APPIMAGE_EXTRACT_AND_RUN=1&lt;/code&gt;, because there's no FUSE there. With that variable set, the runtime ignores &lt;code&gt;--appimage-updateinformation&lt;/code&gt; and simply starts the app, so the step never finished. Now that check runs without the variable, and every smoke-test step has a time limit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Catalogs: one source of truth
&lt;/h2&gt;

&lt;p&gt;Packages are only half of it; people also need to find them. Besides PyPI, DotMorph is listed in two catalogs, and neither one needed a separate upload:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://appimage.github.io" rel="noopener noreferrer"&gt;The AppImage catalog&lt;/a&gt;&lt;/strong&gt;: the entry is a single file containing the GitHub repository URL. Their bot picks the newest release's AppImage on its own, so new versions need no new pull request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.opendesktop.org/p/2380213/" rel="noopener noreferrer"&gt;OpenDesktop&lt;/a&gt;&lt;/strong&gt; (the same listing also appears on &lt;a href="https://www.appimagehub.com/p/2380213/" rel="noopener noreferrer"&gt;AppImageHub.com&lt;/a&gt;): its file manager has an "Add URL" button that copies a file from a link. The three packages there come straight from the signed GitHub release, so OpenDesktop serves exactly the bytes that &lt;code&gt;SHA256SUMS&lt;/code&gt; describes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Builds are uploaded to exactly one place, the GitHub release, and the workflow does that, not me.&lt;/p&gt;

&lt;h2&gt;
  
  
  The .deb and Arch packages use your Qt
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;.deb&lt;/code&gt; is built with plain &lt;code&gt;dpkg-deb&lt;/code&gt; and depends on the distribution's PySide6 and QML modules, version 6.6 or newer. On a release that's too old, apt &lt;strong&gt;refuses&lt;/strong&gt; to install it, which beats installing something that crashes on start. The Arch package is built from the same &lt;code&gt;PKGBUILD&lt;/code&gt; the AUR gets, inside an Arch container, so the AUR recipe is tested on every release before anyone runs it.&lt;/p&gt;

&lt;h2&gt;
  
  
  CI that doesn't randomly fail
&lt;/h2&gt;

&lt;p&gt;Most of my red CI runs had nothing to do with my code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;apt mirrors stall.&lt;/strong&gt; Every apt call now retries with 30-second timeouts (&lt;code&gt;Acquire::Retries&lt;/code&gt;, &lt;code&gt;Acquire::http::Timeout&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;man-db rebuilds its index after every install&lt;/strong&gt;, sometimes for minutes, so CI disables that.&lt;/li&gt;
&lt;li&gt;Every job and every slow step has a &lt;code&gt;timeout-minutes&lt;/code&gt;, so a stuck run fails in minutes instead of six hours later.&lt;/li&gt;
&lt;li&gt;Timing-sensitive tests (watch folders, the daemon, cancel) wait for real readiness signals instead of fixed sleeps, so they pass with every CPU core saturated.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Verify what you download
&lt;/h2&gt;

&lt;p&gt;Every release file has a checksum and a signature:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gpg --import dotmorph-signing-key.asc          &lt;span class="c"&gt;# attached to every release&lt;/span&gt;
gpg --fingerprint kareem209907@gmail.com       &lt;span class="c"&gt;# must be 0F04 6781 3146 DE68 272E  DC82 145D 3459 56DE 18D2&lt;/span&gt;
gpg --verify SHA256SUMS.asc SHA256SUMS         &lt;span class="c"&gt;# the checksums really come from the release&lt;/span&gt;
sha256sum --ignore-missing -c SHA256SUMS       &lt;span class="c"&gt;# your files match them&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The fingerprint is also printed in the README and in &lt;code&gt;SECURITY.md&lt;/code&gt;, so you can compare it against a second source.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Test on the machine your users have, not the one you have.&lt;/strong&gt; A clean container is cheap, and "my CI is green" proved nothing about a fresh install.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Every "remove files" step needs a "these must survive" check.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Put a time limit on everything in CI.&lt;/strong&gt; Both of my hangs would have been 6-hour stalls without one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make releases boring.&lt;/strong&gt; One script, one tag, a dry-run mode, and every artifact verified before anything is published.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's how 2.0 shipped. Since then, DotMorph 2.2 learned to transcribe, read scans, fit files under a size limit, play sounds and speak nine languages, and the same pipeline shipped it with one signed tag. &lt;strong&gt;Part 5&lt;/strong&gt; starts that story.&lt;/p&gt;

&lt;p&gt;DotMorph is free and open source:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/kareem2099/DotMorph" rel="noopener noreferrer"&gt;kareem2099/DotMorph&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Project page:&lt;/strong&gt; &lt;a href="https://dotsuite.dev/en/product/dotmorph" rel="noopener noreferrer"&gt;dotsuite.dev/en/product/dotmorph&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Install:&lt;/strong&gt; &lt;code&gt;pipx install 'dotmorph[gui]'&lt;/code&gt;, or the AppImage, &lt;code&gt;.deb&lt;/code&gt; and Arch package from the &lt;a href="https://github.com/kareem2099/DotMorph/releases" rel="noopener noreferrer"&gt;releases&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Also on:&lt;/strong&gt; &lt;a href="https://www.appimagehub.com/p/2380213/" rel="noopener noreferrer"&gt;AppImageHub&lt;/a&gt; · &lt;a href="https://www.opendesktop.org/p/2380213/" rel="noopener noreferrer"&gt;OpenDesktop&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>linux</category>
      <category>python</category>
      <category>devops</category>
      <category>githubactions</category>
    </item>
    <item>
      <title>DotShare 3.8.1: Charging for X posts like a card payment</title>
      <dc:creator>freerave</dc:creator>
      <pubDate>Wed, 25 Nov 2026 12:21:17 +0000</pubDate>
      <link>https://dev.to/freerave/dotshare-381-charging-for-x-posts-like-a-card-payment-512p</link>
      <guid>https://dev.to/freerave/dotshare-381-charging-for-x-posts-like-a-card-payment-512p</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to/freerave/dotshare-38-x-charges-per-post-so-every-post-now-has-a-receipt-43pc"&gt;DotShare 3.8&lt;/a&gt; started charging for X posts. X bills DotSuite for every post made through DotShare's X app, so each plan got a monthly X budget, and each post was charged the larger of two numbers: X's list price, or what DotSuite's X credit balance actually dropped by.&lt;/p&gt;

&lt;p&gt;The first real thread showed that rule was wrong. This post is about what replaced it in &lt;strong&gt;DotShare 3.8.1&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;dotshare-cli&lt;/code&gt; 3.2.1&lt;/strong&gt;, and the database bug that stopped the thread from posting at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  The thread that wouldn't post
&lt;/h2&gt;

&lt;p&gt;The first time I posted a real thread to X through the CLI, it failed. The second attempt failed too.&lt;/p&gt;

&lt;p&gt;Production logs explained it: X publishing had never been switched on. DotSuite Core applies its database migrations at startup, and three of them, including the one that creates the X billing tables, had failed with &lt;code&gt;permission denied for schema public&lt;/code&gt;. Core and the web app share one PostgreSQL database under separate roles, and neither role owns the schema. That's on purpose, since a compromised app can't create or drop tables. But it also means Core can't apply a migration that creates tables.&lt;/p&gt;

&lt;p&gt;Core treats a failed migration as "this feature stays off", logs it and carries on. That part worked. The part that didn't was hidden in the pool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Before: run on the pool. A failure left that connection mid-transaction.&lt;/span&gt;
&lt;span class="n"&gt;sqlx&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;raw_sql&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sql&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The migration file runs as one transaction. When it failed halfway, the connection went back to the pool still inside an aborted transaction, and the next query on that connection failed with &lt;code&gt;current transaction is aborted&lt;/code&gt;. Now a failed migration runs on its own connection, and that connection is closed instead of returned:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="kd"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;acquire&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;match&lt;/span&gt; &lt;span class="n"&gt;sqlx&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;raw_sql&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sql&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="kd"&gt;mut&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kc"&gt;Ok&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;Ok&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kc"&gt;Err&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;detach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="kc"&gt;Err&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;into&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A test proves it with a pool of exactly one connection: run a migration that fails, then check that the next query on the pool still works. The migrations themselves were applied as the database owner, and the role script in the repository now matches production exactly, so the next new table won't surprise me.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4gn3uit2ulq6wvhv1pxl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4gn3uit2ulq6wvhv1pxl.png" alt="Before: a migration run on the pool failed halfway through its transaction, the connection went back to the pool still inside it, and the next query failed with &amp;quot;current transaction is aborted&amp;quot;. After: each migration gets its own connection, a failed one is closed instead of returned, and a test with a pool of one connection proves the next query still works." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then the thread posted.&lt;/p&gt;

&lt;h2&gt;
  
  
  What X actually took
&lt;/h2&gt;

&lt;p&gt;The thread had four parts: a post with an image, two replies, and a reply with a link. DotSuite records the estimate, the measured cost and the charge for every part:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Part&lt;/th&gt;
&lt;th&gt;Estimate&lt;/th&gt;
&lt;th&gt;X took&lt;/th&gt;
&lt;th&gt;Charged&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Post with image&lt;/td&gt;
&lt;td&gt;$0.020&lt;/td&gt;
&lt;td&gt;$0.020&lt;/td&gt;
&lt;td&gt;$0.020&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reply&lt;/td&gt;
&lt;td&gt;$0.015&lt;/td&gt;
&lt;td&gt;$0.010&lt;/td&gt;
&lt;td&gt;$0.015&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reply&lt;/td&gt;
&lt;td&gt;$0.015&lt;/td&gt;
&lt;td&gt;$0.010&lt;/td&gt;
&lt;td&gt;$0.015&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reply with a link&lt;/td&gt;
&lt;td&gt;$0.200&lt;/td&gt;
&lt;td&gt;$0.010&lt;/td&gt;
&lt;td&gt;$0.200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.250&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.050&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.250&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;X's list price for a post containing a link is $0.20. Replies in a thread were billed $0.01 each, link or not. I'd charged five times what the thread cost, and the user in this case was me.&lt;/p&gt;

&lt;p&gt;Could X have charged the link a few minutes later? The X Developer Console answered that. It showed $0.10 for the last 30 days across nine requests, including that thread. A late $0.20 charge couldn't fit in that total.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdolto79gv3395pnqvrd8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdolto79gv3395pnqvrd8.png" alt="The first real thread: a post with an image estimated at $0.020, two replies at $0.015 and a reply with a link at $0.200. X took $0.020, $0.010, $0.010 and $0.010, $0.05 in total, but the old rule charged $0.25, five times what it cost." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not just lower the prices
&lt;/h2&gt;

&lt;p&gt;The obvious fix is to price replies at $0.01. But I don't know every case where X charges less, and X can change its prices. If I price something low and X bills more, I pay the difference on every post. In 3.8 I made one rule: never under-charge. Lowering the prices breaks it.&lt;/p&gt;

&lt;p&gt;What I wanted was to charge exactly what X takes, without ever risking less. Card payments already solve this. A hotel or a gas pump puts a hold on your card for the most it might cost, then settles for the real amount and releases the rest.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hold, pending, settle
&lt;/h2&gt;

&lt;p&gt;Every X post now goes through three steps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hold.&lt;/strong&gt; Before anything is sent, every part is priced at the most X could charge: anything that might be a link is priced as a link post, even a reply X will bill for less. One PostgreSQL transaction holds the total against the monthly budget, the user's daily post limit and an app-wide daily spend cap. A request the budget can't cover is refused before it reaches X.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pending.&lt;/strong&gt; Each part is posted under a global lock, so a change in X's balance belongs to exactly one post. DotSuite reads its X credit balance before and after. If the deduction hasn't shown up yet, the part stays pending and the balance is read again, up to three times, two seconds apart.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Settle.&lt;/strong&gt; When the deduction shows up, that's the charge, and the rest of the hold goes back to the budget. If X took more than the hold, the real amount is charged anyway.&lt;/p&gt;

&lt;p&gt;The interesting case is when the deduction doesn't show up. Maybe the balance couldn't be read, or it only dropped by less than X's cheapest post, which means the charge hasn't arrived. Then the whole hold is charged. Not confirming is never cheaper for the user than confirming, but it's never a loss for DotSuite either.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="c1"&gt;/// A deduction counts as X's charge only when it's at least X's cheapest post.&lt;/span&gt;
&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;confirmed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;seen&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Option&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;i64&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prices&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nc"&gt;XPrices&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;Option&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;i64&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;seen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;prices&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;min_post_micros&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;charge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="k"&gt;match&lt;/span&gt; &lt;span class="nf"&gt;confirmed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;seen&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prices&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kc"&gt;Some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;actual&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;actual&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="c1"&gt;// what X took, even above the hold&lt;/span&gt;
    &lt;span class="kc"&gt;None&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;plan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;estimated&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="c1"&gt;// unconfirmed: the whole hold&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All amounts are integer micro-dollars, and X's cheapest post is an environment variable (&lt;code&gt;X_PRICE_MIN_POST_MICROS&lt;/code&gt;, $0.01 by default), like every other price.&lt;/p&gt;

&lt;p&gt;Under this rule the thread above holds $0.25 and charges $0.05. And it did: the next four-post thread, on November 23, held $0.25 and was charged $0.05.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0hjf1dmnzhm13daj2klv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0hjf1dmnzhm13daj2klv.png" alt="Hold: every part is priced at the most X could charge and held against the budget. Pending: posts go out one at a time and DotSuite re-reads its X balance up to three times, two seconds apart, until the deduction shows. Settle: the measured deduction is charged and the rest of the hold is released. If X took more, the real amount is charged; if it can't be confirmed, the whole hold is charged; nothing is added later." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Nothing is added later
&lt;/h2&gt;

&lt;p&gt;A card can be charged after the fact. DotSuite never does that to users. Once a post settles, its charge is final.&lt;/p&gt;

&lt;p&gt;A charge that turns up later still needs to be noticed, though. An hourly job compares X's balance with what was charged. Posts run one at a time, so any drop between one post's final reading and the next reading wasn't charged to anyone. Those drops add up, and the job logs an error for me with the amount and a pointer to the X console. If X ever bills late, I pay for it and find out within the hour. I'd rather carry that than surprise a user.&lt;/p&gt;

&lt;p&gt;The first version had a bug that would have reported every post as unexplained. I recorded the reading after each post as an ordinary reading, so the next check counted the post's own charge as missing. The fix was a separate "this drop was charged" reading, and a test that walks a balance through measured posts, an unmeasured drop and a top-up, and checks that only the unmeasured drop is reported.&lt;/p&gt;

&lt;h2&gt;
  
  
  What users see
&lt;/h2&gt;

&lt;p&gt;The preview had promised an exact price. With a hold that's no longer true, so it now says:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x-cloud: up to $0.25 of your X budget will be held for 4 post(s), 1 with a link.
You pay what X actually deducts and the rest is released; at least $14.75 of this
month's X budget will be left.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The DotSuite dashboard already showed three columns per charge: the estimate, what X deducted, and what you paid. Now the last two match whenever the deduction was confirmed. The privacy policy explains the hold in all five languages it's written in.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it was tested
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Core:&lt;/strong&gt; 63 tests. The full publish flow runs against a mock X API and real PostgreSQL in Docker. New cases: a reply with a link holds $0.20 and is charged $0.01; a deduction that only shows up on a re-read is still charged correctly; a post whose deduction never shows up is charged the whole hold. The pool test above runs with a pool of one connection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DotShare:&lt;/strong&gt; 405 Jest tests, including the new preview wording.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Production:&lt;/strong&gt; the migrations applied, &lt;code&gt;/ready&lt;/code&gt; returning 200, and the thread above published, measured and compared against the X console.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;DotShare 3.8.1 is on the &lt;a href="https://marketplace.visualstudio.com/items?itemName=freerave.dotshare" rel="noopener noreferrer"&gt;Marketplace&lt;/a&gt; and &lt;a href="https://open-vsx.org/extension/freerave/dotshare" rel="noopener noreferrer"&gt;Open VSX&lt;/a&gt;, and the CLI is on npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install -g dotshare-cli
dotshare-agent cloud login
dotshare-agent accounts connect my-x --platform x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The billing change runs on DotSuite, so it applies to every version that posts to X through it. The &lt;a href="https://github.com/kareem2099/DotShare/blob/master/CHANGELOG.md" rel="noopener noreferrer"&gt;changelog&lt;/a&gt; and the &lt;a href="https://dotsuite.dev/en/dotshare/privacy" rel="noopener noreferrer"&gt;privacy policy&lt;/a&gt; have the details.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I used AI assistance (Claude) to build, test and write up this release. The numbers and behavior described come from the shipped code, its tests and the production ledger.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>postgres</category>
      <category>opensource</category>
      <category>mcp</category>
    </item>
    <item>
      <title>DotShare 3.8: X charges per post, so every post now has a receipt</title>
      <dc:creator>freerave</dc:creator>
      <pubDate>Tue, 24 Nov 2026 11:16:47 +0000</pubDate>
      <link>https://dev.to/freerave/dotshare-38-x-charges-per-post-so-every-post-now-has-a-receipt-43pc</link>
      <guid>https://dev.to/freerave/dotshare-38-x-charges-per-post-so-every-post-now-has-a-receipt-43pc</guid>
      <description>&lt;p&gt;I was publishing a post to X through DotShare when I noticed that X now needs prepaid credits for every post. That's how X's API works now: pay per use, with credits bought in advance. The obvious question followed. Every DotShare user who signs in to X goes through &lt;em&gt;my&lt;/em&gt; X app. Whose credits pay for their posts?&lt;/p&gt;

&lt;p&gt;Mine. That one question turned into &lt;strong&gt;DotShare 3.8.0&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;dotshare-cli&lt;/code&gt; 3.2.0&lt;/strong&gt;: X posts now go through DotSuite, each plan includes a monthly X budget, and every post is charged what it actually cost. On the way there, writing a privacy policy found three things in DotShare that didn't do what the README said they did.&lt;/p&gt;

&lt;p&gt;This follows the &lt;a href="https://dev.to/freerave/dotshare-37-fixing-a-token-leak-moving-oauth-home-and-teaching-agents-to-sign-in-2aa4"&gt;3.7 post&lt;/a&gt;, where sign-in moved to dotsuite.dev.&lt;/p&gt;

&lt;h2&gt;
  
  
  What X's terms allow
&lt;/h2&gt;

&lt;p&gt;Before writing any code I read X's developer agreement, the pay-per-use agreement and the developer policy. Three things shaped the design.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The app owner pays.&lt;/strong&gt; Credits are bought in the Developer Console and deducted "from your account based on your usage". The terms don't spell out who pays for a post a user authorized through your app. But the user isn't a party to the agreement, and the credits are yours, so that leaves you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You can't resell credits.&lt;/strong&gt; They are non-transferable and non-refundable. "Buy X credits from me" was never an option. "Your plan includes this much X usage" is a different thing: that's selling my own service.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You can't spread the load across apps.&lt;/strong&gt; The policy is direct: "You may not register multiple applications for a single use case." I had wondered about running two or three X apps to split the traffic. That's out. The way to scale is X's Enterprise plan.&lt;/p&gt;

&lt;p&gt;At X's current list prices, a post costs &lt;strong&gt;$0.015&lt;/strong&gt; and a post containing a link costs &lt;strong&gt;$0.200&lt;/strong&gt;, about thirteen times more. For a tool that announces releases, links are the whole point.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rule: never under-charge
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Update since 3.8.1:&lt;/strong&gt; DotSuite now holds the most a post can cost, then charges exactly what X deducted and releases the rest, and previews say "up to $X will be held". The first real thread showed that the rule below charged five times what X took. &lt;a href="https://dev.to/freerave/dotshare-381-charging-for-x-posts-like-a-card-payment-512p"&gt;The next post&lt;/a&gt; covers the change.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A price mistake only hurts in one direction. If a post costs 20 cents and I charge 25, nobody notices. If it costs 10 and I charge 5, I pay the difference on every post. So every decision leans toward charging slightly more rather than less.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Integer micro-dollars.&lt;/strong&gt; Every amount is an integer number of millionths of a dollar. Nothing gets lost to floating-point rounding, and a ledger total matches the budget to the micro-dollar.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Assume it's a link.&lt;/strong&gt; X auto-links bare domains, so &lt;code&gt;dotsuite.dev&lt;/code&gt; costs the same as &lt;code&gt;https://dotsuite.dev&lt;/code&gt;. My detector treats any &lt;code&gt;name.tld&lt;/code&gt; token as a link. That means &lt;code&gt;README.md&lt;/code&gt; is charged as a link too, because &lt;code&gt;.md&lt;/code&gt; is a real top-level domain and X really might link it. Overcharging a filename is the cheaper mistake.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Measure what X actually took.&lt;/strong&gt; The price table is an estimate, and X can change its prices. So DotSuite reads its own X credit balance right before and right after each post, and charges the user &lt;strong&gt;the larger of the estimate and the difference&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Never charge less than X took or than the price table says.&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;charged&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;plan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;estimated&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;seen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;unwrap_or&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That only works if each balance change belongs to exactly one post. So X posts across all DotSuite servers go out one at a time, under a PostgreSQL advisory lock scoped to a transaction. The lock releases however the function exits, including an early error return. I'd written it as a session lock first, and an error path would have left it held on a pooled connection forever.&lt;/p&gt;

&lt;p&gt;A balance change is only trusted when it's plausible: a top-up between the two readings, or a drop of more than a dollar from something unrelated, is ignored rather than billed. Every post's estimate, the amount X actually took, and the charge are all recorded. An admin report compares them per day. If X ever charges more than the table says, it shows up there, and the fix is an environment variable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reserve first, then post
&lt;/h2&gt;

&lt;p&gt;Nothing reaches X without a reservation. One PostgreSQL transaction checks the monthly budget, the user's daily post limit and an app-wide daily spend cap, then reserves the whole request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;x_budget_months&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;reserved_micros&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reserved_micros&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nv"&gt;$3&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$1&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;month&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$2&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;spent_micros&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;reserved_micros&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nv"&gt;$3&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;budget_micros&lt;/span&gt;
&lt;span class="k"&gt;RETURNING&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The condition lives in the &lt;code&gt;UPDATE&lt;/code&gt;, so concurrent requests can't both pass a check and then both spend. To prove it, a test fires ten simultaneous 20-cent requests at a user with 77 cents left, on a real PostgreSQL running in Docker. Exactly three succeed.&lt;/p&gt;

&lt;p&gt;After posting, each part of a thread settles to one of three outcomes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Published:&lt;/strong&gt; charged as described above.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rejected by X:&lt;/strong&gt; nothing was posted, so it's free, apart from images X had already accepted. The remaining parts of the thread aren't sent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No answer from X:&lt;/strong&gt; X may have published it, so it's charged and &lt;strong&gt;never resent automatically&lt;/strong&gt;. Retrying could post it twice.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every request has an idempotency key, so repeating it returns the recorded outcome without posting or charging again. A reservation orphaned by a crash is settled after 30 minutes as "uncertain", charged, and never resent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbb0ls6u9c62y36qn73lp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbb0ls6u9c62y36qn73lp.png" alt="Reserve first, then post: one transaction checks the monthly X budget, the daily post limit and an app-wide cap; posts go out one at a time under an advisory lock with X's balance read before and after; each part settles as published and charged, rejected and free, or no answer, charged and never resent. A test sends ten 20-cent posts at once with 77 cents left, and exactly three get through." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Writing this exposed an older bug. When a scheduled post failed on one platform, the scheduler retried the whole post, X included. One flaky Mastodon instance could have posted the same thing to X twice. X now has its own ledger entry per scheduled post, and a retry never sends it again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing the leak
&lt;/h2&gt;

&lt;p&gt;Metering is useless if tokens can post without it. Until 3.8, signing in to X put an access token and a refresh token on the user's machine, and nothing stopped that token from posting directly.&lt;/p&gt;

&lt;p&gt;Two changes closed it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;X became a confidential client.&lt;/strong&gt; Refreshing a token now needs the app's client secret, which lives only on DotSuite's servers. Tokens already in the wild expire within two hours and can't be renewed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tokens stay on the server.&lt;/strong&gt; With &lt;code&gt;X_SERVER_ONLY&lt;/code&gt; on, an X sign-in is saved to the user's DotSuite account. The editor or CLI is only told that X is connected, and X posts go through &lt;code&gt;POST /v1/x/posts&lt;/code&gt;. The old refresh endpoint returns &lt;code&gt;410 Gone&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There was a cost. DotShare 3.7, which had shipped hours earlier, can't post to X until it's updated. I accepted that, rather than leave a window where anyone with a token could post on my balance.&lt;/p&gt;

&lt;p&gt;People who would rather pay X directly can still do that. The CLI accepts an access token from their own X developer app, and then DotSuite isn't involved at all.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhlqx93mt00z65xc6z808.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhlqx93mt00z65xc6z808.png" alt="Until 3.8, signing in to X put an access and refresh token on the device, which could post straight to X outside any budget. In 3.8 the X sign-in is saved to the DotSuite account, the device only knows X is connected, posts go through POST /v1/x/posts, and the old refresh endpoint returns 410 Gone." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Showing the cost
&lt;/h2&gt;

&lt;p&gt;A budget only feels fair if you can see it. Before a post goes out, an agent's preview now says exactly what it will cost:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x-cloud: X will charge $0.215 for 2 post(s), 1 with a link; $4.785 of this month's X budget will be left.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A post the budget can't cover is refused before anything is sent. The extension shows the charge and what's left after each post. The DotSuite dashboard lists recent charges in three columns: the estimate, what X actually deducted, and what you paid. The defaults are $1 a month on Free (roughly 66 text posts, or 5 with links), $5 on Pro and $15 on Max. All of them, and the prices, are environment variables.&lt;/p&gt;

&lt;h2&gt;
  
  
  The privacy policy found three bugs
&lt;/h2&gt;

&lt;p&gt;LinkedIn and X want a privacy policy URL, so DotShare got its own page. I wrote every sentence against the code rather than from memory, and three sentences turned out to be false.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"Clear All Credentials" didn't exist.&lt;/strong&gt; The README mentioned it, and the cleanup function existed, but no button or command called it. It's now a button in Settings and a command, behind a native confirmation, so a webview message alone can't trigger it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The live CodeSnap link pointed at a domain that never existed.&lt;/strong&gt; "Copy Dynamic CodeSnap Markdown" produced &lt;code&gt;codesnap.dotsuite.dev&lt;/code&gt; links, which didn't resolve. DotSuite now draws a gist as a syntax-highlighted image at &lt;code&gt;/api/codesnap/gist/{id}&lt;/code&gt;, and refreshes it within ten minutes of an edit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deleting your DotSuite account left your data behind.&lt;/strong&gt; It removed the account record and nothing else: connected platform tokens, scheduled posts and their images, API keys and licence data all stayed. Now Core deletes all of it first, including the images in object storage. If any of that fails, the account is kept so the user can retry, instead of leaving data no account can reach. The dashboard also gained a &lt;strong&gt;Disconnect&lt;/strong&gt; button for every connected platform.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4vs66hy2n90ofomb13ft.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4vs66hy2n90ofomb13ft.png" alt="Three bugs the privacy policy found: Clear All Credentials existed in code but nothing called it, now a button and a command; live CodeSnap links pointed at a domain that never existed, now dotsuite.dev draws the gist; deleting a DotSuite account left data behind, now Core deletes all of it first." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The policy is fully written in English, Arabic, German, French and Russian. It has a section on X costs that says what's recorded for each post: the time, whether it counted as a link post, the image count, the estimate, the measured cost, the charge and the post ID. Post text isn't recorded.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it was tested
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Core:&lt;/strong&gt; 58 tests. With a test database configured, two more run against real PostgreSQL in Docker. One covers reservations, limits, concurrency, settlement and deletion. The other runs the full publish flow against a mock X API built from axum: chained thread replies, a replay that posts nothing, an X overcharge billed at the real amount, a rejection mid-thread, and a request that times out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DotShare:&lt;/strong&gt; 405 Jest tests, plus the end-to-end MCP, library and security scripts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live:&lt;/strong&gt; real LinkedIn and X sign-ins through dotsuite.dev, a real X token refresh with rotation, and the switch-over confirmed on production with the refresh endpoint returning &lt;code&gt;410&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What I haven't seen yet is a month of real usage. The admin report comparing charged and measured costs is the first thing I'll check.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;DotShare 3.8.0 is on the &lt;a href="https://marketplace.visualstudio.com/items?itemName=freerave.dotshare" rel="noopener noreferrer"&gt;Marketplace&lt;/a&gt; and &lt;a href="https://open-vsx.org/extension/freerave/dotshare" rel="noopener noreferrer"&gt;Open VSX&lt;/a&gt;, and the CLI is on npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install -g dotshare-cli
dotshare-agent cloud login
dotshare-agent accounts connect my-x --platform x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://github.com/kareem2099/DotShare/blob/master/CHANGELOG.md" rel="noopener noreferrer"&gt;changelog&lt;/a&gt;, the &lt;a href="https://github.com/kareem2099/DotShare/blob/master/docs/AGENT_INTEGRATION.md" rel="noopener noreferrer"&gt;agent guide&lt;/a&gt; and the &lt;a href="https://dotsuite.dev/en/dotshare/privacy" rel="noopener noreferrer"&gt;privacy policy&lt;/a&gt; have the details.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I used AI assistance (Claude) to build, test and write up this release. The numbers and behavior described come from the shipped code and its tests.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>rust</category>
      <category>postgres</category>
      <category>opensource</category>
    </item>
    <item>
      <title>DotShare 3.7: Fixing a token leak, moving OAuth home, and teaching agents to sign in</title>
      <dc:creator>freerave</dc:creator>
      <pubDate>Mon, 23 Nov 2026 12:45:48 +0000</pubDate>
      <link>https://dev.to/freerave/dotshare-37-fixing-a-token-leak-moving-oauth-home-and-teaching-agents-to-sign-in-2aa4</link>
      <guid>https://dev.to/freerave/dotshare-37-fixing-a-token-leak-moving-oauth-home-and-teaching-agents-to-sign-in-2aa4</guid>
      <description>&lt;p&gt;The small OAuth server behind DotShare's LinkedIn and X sign-in could hand a user's LinkedIn or X tokens to anyone who sent them the right link. I found it while planning something unrelated: moving DotShare's sign-in from a separate Vercel app onto dotsuite.dev, so every DotShare service would live under one domain.&lt;/p&gt;

&lt;p&gt;This post covers that fix, the move, and what the move made possible. AI agents can now sign in through the browser instead of pasting tokens. X tokens renew themselves. Saved drafts can be scheduled. Agents can post videos and read how their posts are doing. It all ships as &lt;strong&gt;DotShare 3.7.0&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;dotshare-cli&lt;/code&gt; 3.1.0&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This isn't Part 2 of the series: &lt;a href="https://dev.to/freerave/dotshare-part-2-review-receipts-and-an-encrypted-publishing-library-491h"&gt;Part 2&lt;/a&gt; covers revision-bound approval and encrypted storage. This one is about sign-in, and what changes once sign-in is done properly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The old server, and three problems in it
&lt;/h2&gt;

&lt;p&gt;DotShare is an open-source VS Code extension that turns commits and release notes into posts for LinkedIn, X, Bluesky, Mastodon, Telegram, Discord and Dev.to. Since 3.6.0 it also ships a local MCP server, so an agent like Codex or Claude Code can draft and publish through the same library.&lt;/p&gt;

&lt;p&gt;LinkedIn and X need OAuth, and OAuth needs a server that holds the client secret. For DotShare that was &lt;code&gt;dotshare-auth-server&lt;/code&gt;, a small Next.js app on Vercel. The extension opened &lt;code&gt;/auth/x?scheme=vscode&lt;/code&gt; in the browser. The page ran PKCE, the provider sent the user back, the page exchanged the code, and then it sent the tokens to the editor with a deep link:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;href&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`${scheme}://freerave.dotshare/auth?${params}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;1. &lt;code&gt;scheme&lt;/code&gt; came straight from the URL.&lt;/strong&gt; It was meant to be &lt;code&gt;vscode&lt;/code&gt;, &lt;code&gt;cursor&lt;/code&gt; and so on, because each editor registers its own URI scheme. Nothing checked it, though. With &lt;code&gt;?scheme=https://attacker.example/?&lt;/code&gt;, the "deep link" became an ordinary web URL, and after a perfectly normal LinkedIn or X sign-in, the victim's access and refresh tokens went to the attacker. The attacker only had to get someone to click a sign-in link.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The token exchange accepted a &lt;code&gt;userId&lt;/code&gt; from the request body&lt;/strong&gt; and saved the tokens to that DotSuite account through an internal endpoint. Nothing in DotShare sent &lt;code&gt;userId&lt;/code&gt;, but the endpoint was public. Anyone with their own authorization code could attach their social account to someone else's DotSuite user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. LinkedIn sign-in had no &lt;code&gt;state&lt;/code&gt; parameter&lt;/strong&gt;, which left the classic login CSRF open. X had one, because PKCE flows usually do. LinkedIn didn't.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frbylofcswvu0er6a6pyq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frbylofcswvu0er6a6pyq.png" alt="Before: the sign-in page put any scheme into the deep link, so ?scheme=https://attacker.example/? sent the tokens to the attacker. After: only editor schemes are allowed, anything else becomes vscode. Also fixed: userId from the request body, and LinkedIn's missing state." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The fix for the first one is an allowlist with a safe default:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;EDITOR_SCHEMES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="s1"&gt;'vscode'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'vscode-insiders'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'vscodium'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'code-oss'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'cursor'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'windsurf'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'kiro'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'trae'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'positron'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;editorScheme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;EditorScheme&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;EDITOR_SCHEMES&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;scheme&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;scheme&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&gt;'vscode'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;userId&lt;/code&gt; field and the sync behind it are gone. Tokens from that server now go only to the user's own editor, and &lt;code&gt;state&lt;/code&gt; is required for both providers. The fix went to Vercel before anything else in this post, and it's live there now.&lt;/p&gt;

&lt;h2&gt;
  
  
  Moving sign-in onto dotsuite.dev
&lt;/h2&gt;

&lt;p&gt;With the holes closed, I moved sign-in into the DotSuite site, which is also Next.js. Instead of copying the client-side flow, I rewrote it to run entirely on the server:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;GET /api/connect/x&lt;/code&gt; creates the state and PKCE verifier and stores them, with the target editor, in an &lt;strong&gt;HMAC-signed, httpOnly cookie&lt;/strong&gt; that lasts 10 minutes. Then it redirects to X.&lt;/li&gt;
&lt;li&gt;X redirects back to &lt;code&gt;/api/connect/x/callback&lt;/code&gt;. The server checks the signature, compares the state in constant time, and exchanges the code. The client secret never reaches a browser.&lt;/li&gt;
&lt;li&gt;The cookie is cleared whatever the outcome, so each sign-in can be used once.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frbnfpvuinc7ivvutfm8e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frbnfpvuinc7ivvutfm8e.png" alt="Sign-in on dotsuite.dev: GET /api/connect/x stores state and the PKCE verifier in a signed httpOnly cookie, X asks the user, and the callback checks the cookie, compares state in constant time and exchanges the code. The result goes to the editor, the DotSuite account, or the CLI." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nothing depends on &lt;code&gt;sessionStorage&lt;/code&gt; anymore. A sign-in that expired, or that started in a different browser, ends with a clear message and a &lt;strong&gt;Try again&lt;/strong&gt; button instead of a blank page.&lt;/p&gt;

&lt;p&gt;The same callback now serves three destinations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;editor&lt;/strong&gt;: a small page that opens &lt;code&gt;vscode://freerave.dotshare/auth?...&lt;/code&gt; (or Cursor, Windsurf, VSCodium and the others) and offers a button in case the browser asks first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;cloud&lt;/strong&gt;: saves the account to the signed-in DotSuite user for scheduled posts. The user comes from the session, and the callback checks that the same user both started and finished the sign-in.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;cli&lt;/strong&gt;: the new one, covered next.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I used a path on the main domain (&lt;code&gt;dotsuite.dev/api/connect&lt;/code&gt;) instead of &lt;code&gt;auth.dotsuite.dev&lt;/code&gt;. On the same origin, the dashboard's &lt;strong&gt;Connect&lt;/strong&gt; button can use the DotSuite session as it is, with no cross-subdomain cookies to manage.&lt;/p&gt;

&lt;p&gt;The Vercel server keeps running for now. DotShare 3.6.x calls it directly and refuses HTTP redirects, so redirecting it would quietly break X token refresh for everyone who hasn't updated. It retires once traffic reaches zero.&lt;/p&gt;

&lt;h2&gt;
  
  
  Agents sign in through the browser
&lt;/h2&gt;

&lt;p&gt;Until 3.7, adding a LinkedIn or X account to the agent CLI meant pasting an access token. For LinkedIn, that meant using LinkedIn's token generator, which failed during launch with a "state parameter" error. Now it's one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotshare-agent accounts connect work-x --platform x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The browser opens, you approve DotShare on X, and the terminal prints the saved account. There's nothing to copy.&lt;/p&gt;

&lt;p&gt;The interesting part is how the tokens get back to the terminal. The CLI listens on &lt;code&gt;127.0.0.1&lt;/code&gt; on a random port, and the obvious approach is to redirect the browser to &lt;code&gt;http://127.0.0.1:PORT/callback?access_token=...&lt;/code&gt;. That puts live tokens in a URL, in browser history, and in front of anything else listening on that machine.&lt;/p&gt;

&lt;p&gt;Instead, the CLI generates a fresh &lt;strong&gt;X25519&lt;/strong&gt; key pair for each sign-in and sends dotsuite.dev only the public key and a random nonce. The server encrypts the result to that key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;own&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;generateKeyPairSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'x25519'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;shared&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;diffieHellman&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;privateKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;own&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;privateKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;publicKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;cliKey&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;hkdfSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'sha256'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;salt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'dotshare-connect-v1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// AES-256-GCM over { nonce, platform, token }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The loopback URL carries only ciphertext. The private key exists in the memory of that one CLI process and nowhere else, so the payload is useless even if it ends up in history.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgaku484gcglj55ktvupx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgaku484gcglj55ktvupx.png" alt="The CLI makes an X25519 key pair and a nonce and opens the browser with the public key. dotsuite.dev encrypts the token with AES-256-GCM to that key and redirects to 127.0.0.1 with ciphertext only. The CLI decrypts it, checks the nonce and saves the account to the OS keyring." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Encryption alone doesn't stop one thing: anyone can encrypt to a public key. A malicious page could send its own tokens to the CLI's port and connect the user to the attacker's account. The nonce prevents that. It sits inside the ciphertext, the CLI checks it, and the attacker never sees it.&lt;/p&gt;

&lt;p&gt;My first version failed the whole sign-in when a result didn't verify. That's a denial of service: any page could cancel your sign-in just by hitting the port. Now results that don't verify are ignored, and only the genuine one (or the timeout) ends the wait. A test sends a forged payload, a wrong platform, garbage and a forged cancel before the real one, and checks that only the real one is saved.&lt;/p&gt;

&lt;h2&gt;
  
  
  X tokens that last two hours
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Update since 3.8:&lt;/strong&gt; X posts now go through DotSuite, which keeps the X token on the server. X tokens no longer reach your device, and the refresh endpoint described here is retired. This section describes how 3.7 handled them.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;X OAuth 2.0 access tokens expire after about two hours. The agent used to store only the access token, so MCP posting to X stopped working shortly after an account was added.&lt;/p&gt;

&lt;p&gt;Accounts connected through the browser now keep the refresh token. Before publishing (or a &lt;code&gt;doctor&lt;/code&gt; check), DotShare swaps it through &lt;code&gt;dotsuite.dev/api/connect/refresh/x&lt;/code&gt; when the access token has less than five minutes left. Two details mattered.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;X rotates refresh tokens.&lt;/strong&gt; The old one dies as soon as X accepts the request, so the new pair is written to the OS keyring before it's used. If two MCP clients refresh at the same moment, one of them loses. The loser doesn't fail: it re-reads the keyring, sees that the other process already saved a new pair, and uses that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Refreshing mustn't invalidate a saved preview.&lt;/strong&gt; DotShare binds approval to a preview, and the preview records a fingerprint of every account it targets, so changed credentials force a new review. Hashing the access token would have expired every X preview within two hours. A connected account now gets a &lt;code&gt;connectionId&lt;/code&gt; at sign-in, and the fingerprint covers that instead of the rotating tokens. A refresh leaves previews valid. Connecting a different login still invalidates them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scheduling a saved draft
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;schedule_post&lt;/code&gt; existed, but it took one text for every platform and public image URLs only. The new &lt;strong&gt;&lt;code&gt;schedule_draft&lt;/code&gt;&lt;/strong&gt; takes a previewed draft, with the same revision and preview checks as &lt;code&gt;publish_draft&lt;/code&gt;, and sends DotSuite one post per platform, each with that platform's own version. Local images are uploaded to DotSuite first, so a failed upload schedules nothing. The draft's status becomes &lt;code&gt;Scheduled&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The cloud scheduler can't do everything yet, and the tool says so instead of half-doing it. It refuses threads, LinkedIn first comments, videos, Discord and Dev.to with a reason, and it refuses drafts where two accounts on the same platform have different text, because DotSuite holds one connection per platform.&lt;/p&gt;

&lt;p&gt;Writing it turned up an old bug. The CLI read the scheduled post's ID from &lt;code&gt;id&lt;/code&gt;, but DotSuite returns &lt;code&gt;post_id&lt;/code&gt;. Every schedule succeeded, but the receipt never recorded which post to cancel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Video, GIFs, and one thing I didn't ship
&lt;/h2&gt;

&lt;p&gt;Agents can now attach MP4 and MOV videos on X, LinkedIn, Mastodon, Telegram and Discord (WebM on Mastodon and Discord), and GIFs on X, Mastodon, Telegram and Discord. Files are identified by their first bytes, not just the extension, and preview shows each platform's size limit before anything uploads.&lt;/p&gt;

&lt;p&gt;X needed real work. DotShare's video path used X's v1.1 &lt;code&gt;INIT/APPEND/FINALIZE&lt;/code&gt; upload, which doesn't accept OAuth 2.0 user tokens. So video and GIF uploads to X could never have worked with those tokens. Following X's current docs, I replaced it with the v2 chunked upload: &lt;code&gt;initialize&lt;/code&gt;, then 4 MB &lt;code&gt;append&lt;/code&gt; segments, then &lt;code&gt;finalize&lt;/code&gt;, then polling the status until processing succeeds before the post is created.&lt;/p&gt;

&lt;p&gt;Bluesky video isn't in this release. Its upload goes through a separate video service with its own auth, and I couldn't get the current documentation or the lexicon files from any source I tried. I wasn't going to ship it from memory, so the preview says plainly that Bluesky accepts images only.&lt;/p&gt;

&lt;h2&gt;
  
  
  Smaller things
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bluesky mentions.&lt;/strong&gt; &lt;code&gt;@handle.domain&lt;/code&gt; becomes a real mention facet when the handle resolves. Unknown handles stay plain text, as they do in the Bluesky app. Links and hashtags were fixed in 3.6.1.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;get_post_stats&lt;/code&gt;.&lt;/strong&gt; Read-only engagement for something DotShare published: likes, reposts, replies and quotes on X, Bluesky and Mastodon, plus impressions on X, likes and comments on LinkedIn, and views, reactions and comments on Dev.to. Telegram and Discord don't offer message metrics. LinkedIn and X may withhold them depending on the app's access or API plan, and the result says why when that happens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One-command setup for Claude Code and Cursor.&lt;/strong&gt; &lt;code&gt;setup --client claude&lt;/code&gt; registers the server through &lt;code&gt;claude mcp add-json&lt;/code&gt;. &lt;code&gt;--client cursor&lt;/code&gt; merges into &lt;code&gt;~/.cursor/mcp.json&lt;/code&gt; while keeping your other servers, and saves a backup.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A skill for agents.&lt;/strong&gt; The npm package now ships &lt;code&gt;skills/dotshare/SKILL.md&lt;/code&gt;, which teaches an agent the draft → preview → approval → publish workflow and the per-platform rules. I checked every tool and field name in it against the server code. That check caught two mistakes in my own first draft: a wrong field name in the template tools, and a claim about Bluesky mentions that wasn't true yet. It's true now.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How it was tested
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;399 Jest tests pass, 18 of them new for this release. The loopback tests use a real HTTP server.&lt;/li&gt;
&lt;li&gt;A cross-repository check ran the real &lt;code&gt;connectAccount&lt;/code&gt; from the CLI against the real encryption code from dotsuite.dev, for both LinkedIn and X.&lt;/li&gt;
&lt;li&gt;The existing end-to-end scripts drive the real MCP transport (now 25 tools), the VS Code library bridge and the encrypted store.&lt;/li&gt;
&lt;li&gt;The CLI tarball was installed into a clean prefix and run from there.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Live sign-ins against the production LinkedIn and X apps on dotsuite.dev, including a real X token refresh with rotation, have since been tested too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install -g dotshare-cli
dotshare-agent setup --client claude        &lt;span class="c"&gt;# or --client cursor, or Codex by default&lt;/span&gt;
dotshare-agent accounts connect work-linkedin --platform linkedin
dotshare-agent doctor --check-accounts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The VS Code extension is on the &lt;a href="https://marketplace.visualstudio.com/items?itemName=freerave.dotshare" rel="noopener noreferrer"&gt;Marketplace&lt;/a&gt; and &lt;a href="https://open-vsx.org/extension/freerave/dotshare" rel="noopener noreferrer"&gt;Open VSX&lt;/a&gt;. The &lt;a href="https://github.com/kareem2099/DotShare/blob/master/CHANGELOG.md" rel="noopener noreferrer"&gt;full changelog&lt;/a&gt; and the &lt;a href="https://github.com/kareem2099/DotShare/blob/master/docs/AGENT_INTEGRATION.md" rel="noopener noreferrer"&gt;agent guide&lt;/a&gt; cover everything above in more detail.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I used AI assistance (Claude) to build, test and write up this release. The numbers and behavior described come from the shipped code and its tests.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>security</category>
      <category>oauth</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Building DotShredzilla (Part 7): Logging From the Lock Screen, 36 Free Badges, and the Backup That Signed Everyone Out</title>
      <dc:creator>freerave</dc:creator>
      <pubDate>Sun, 22 Nov 2026 11:57:55 +0000</pubDate>
      <link>https://dev.to/freerave/building-dotshredzilla-part-7-logging-from-the-lock-screen-36-free-badges-and-the-backup-that-2h55</link>
      <guid>https://dev.to/freerave/building-dotshredzilla-part-7-logging-from-the-lock-screen-36-free-badges-and-the-backup-that-2h55</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to/freerave/building-dotshredzilla-part-6-pro-without-forced-ads-and-ad-rewards-a-server-can-trust-1kpb"&gt;Part 6&lt;/a&gt; ended with version 1.6.0 in Play review: no forced ads, Pro for life, and ad hours a server can trust. Version 1.7.0 came from the same place as every other release, a training session.&lt;/p&gt;

&lt;p&gt;Between sets my phone is in my pocket or on the bench, locked. Unlocking it with chalk on my hands to tap "Log set" got old fast. So the biggest feature of 1.7.0 doesn't live in the app at all. It lives in the notification shade.&lt;/p&gt;

&lt;p&gt;DotShredzilla is an Android workout tracker from &lt;strong&gt;FreeRave (DotSuite)&lt;/strong&gt;, written in Kotlin with Jetpack Compose and Firebase, and open source under &lt;strong&gt;Apache License 2.0&lt;/strong&gt;: &lt;a href="https://github.com/kareem2099/Shredzilla" rel="noopener noreferrer"&gt;github.com/kareem2099/Shredzilla&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Logging a set without unlocking your phone
&lt;/h2&gt;

&lt;p&gt;When a workout starts, a notification shows what you're doing and what comes next, on the lock screen too. Its buttons cover most of a workout:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Log 60 kg × 10&lt;/strong&gt; repeats your last set with one tap.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;+1 rep&lt;/strong&gt; for the set where you got one more than last time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Next: Leg Press&lt;/strong&gt; once the target sets are done, and &lt;strong&gt;Finish&lt;/strong&gt; on the last exercise.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edit&lt;/strong&gt; opens an inline reply. Type &lt;code&gt;8&lt;/code&gt; for eight reps at the same load, or &lt;code&gt;9 8&lt;/code&gt; for 9 kg × 8.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbl1uqqpvirxij1g3c7mo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbl1uqqpvirxij1g3c7mo.png" alt="The DotShredzilla workout notification before and after Log: Leg Extension set 1 ready with Log 10 plates × 18, +1 rep and Edit, then set 2 resting with the countdown and the next set suggested" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The timer in the notification is the system's, not mine. The notification is posted once with a target time, and Android draws the clock. It counts up the workout time and counts down the rest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="nc"&gt;NotificationCompat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Builder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CHANNEL_ID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;// Counts down the rest, otherwise counts up the workout time&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setWhen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resting&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;notice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;restEndsAt&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="n"&gt;notice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;startedAt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setShowWhen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setUsesChronometer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setChronometerCountDown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resting&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setOngoing&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setOnlyAlertOnce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setCategory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;NotificationCompat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;CATEGORY_WORKOUT&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setVisibility&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;NotificationCompat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;VISIBILITY_PUBLIC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;VISIBILITY_PUBLIC&lt;/code&gt; is what makes the buttons usable without unlocking. That's a choice worth making on purpose: the lock screen shows the list, the exercise and your last set, and nothing else from your account.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reading "9 8" from a keyboard
&lt;/h3&gt;

&lt;p&gt;The reply box gets whatever the keyboard sends. On my phone that can be Arabic-Indic digits (&lt;code&gt;٩ ٨&lt;/code&gt;) or a decimal comma, so the parser normalizes first, then counts the numbers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;parseSetInput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;SetEntry&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;SetEntry&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;normalized&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
        &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="s1"&gt;'٠'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;'٩'&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'0'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'٠'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="s1"&gt;'۰'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="s1"&gt;'۹'&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'0'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'۰'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="s1"&gt;'٫'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;','&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'.'&lt;/span&gt;
            &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;joinToString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Regex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"""\d+(?:\.\d+)?"""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;normalized&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toDouble&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toList&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="k"&gt;base&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;template&lt;/span&gt; &lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="nc"&gt;SetEntry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;template&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;reps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;load&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reps&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;
            &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="k"&gt;base&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plates&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;base&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;plates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;load&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reps&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;base&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;perSide&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;base&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;weight&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;load&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reps&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;base&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;weight&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;load&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reps&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;takeIf&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reps&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;notes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One number means reps at the same load. Two numbers mean load and reps, and the load follows the last set's kind: plates stay plates, and a per-side machine doubles what you typed. Anything else gets a short "Try 8, or 9 8" message instead of a wrong set.&lt;/p&gt;

&lt;h3&gt;
  
  
  What a notification can't do
&lt;/h3&gt;

&lt;p&gt;Buttons on a notification go to a &lt;code&gt;BroadcastReceiver&lt;/code&gt;, and a receiver isn't allowed to open screens. So &lt;strong&gt;Finish&lt;/strong&gt; is a normal tap target that opens the app on the workout summary, not a background action.&lt;/p&gt;

&lt;p&gt;The receiver also needs the running workout. If Android has killed the app in the meantime, the buttons say "Open DotShredzilla to continue your workout" rather than logging a set into nothing. Tapping the notification itself brings the workout back.&lt;/p&gt;

&lt;h3&gt;
  
  
  Four looks
&lt;/h3&gt;

&lt;p&gt;Detailed and Compact are free. &lt;strong&gt;Rest focus&lt;/strong&gt; puts the countdown first, and &lt;strong&gt;Progress bar&lt;/strong&gt; uses &lt;code&gt;NotificationCompat.ProgressStyle&lt;/code&gt; with a segment per exercise. On Android 16 it also asks to be promoted, which turns it into a Live Update chip in the status bar:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="n"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setStyle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setRequestPromotedOngoing&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setShortCriticalText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resting&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;"Rest"&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="s2"&gt;"${notice.progress}/${notice.totalSets}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's the whole thing in 20 seconds, recorded on my own phone:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/jH8eO6-3yfs" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Reminders that know your training
&lt;/h2&gt;

&lt;p&gt;1.7.0 also added the first notifications that aren't about a workout in progress. Every one of them is judged against your own training, not a fixed schedule:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Workout reminder&lt;/strong&gt; after the number of days without training you choose, then again every that many days while the break lasts. It opens the next day of your split, not just the app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Weekly goal alert&lt;/strong&gt; on the last day you can still hit your goal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Measurement reminder&lt;/strong&gt; following the rhythm you measure in, weekly or monthly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pro time ending&lt;/strong&gt; when banked ad hours are about to run out.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The permission isn't requested on first launch. It's requested on your first rest, the moment a notification is obviously useful. Quiet hours (10 PM to 8 AM by default) hold everything back, and each kind has its own switch.&lt;/p&gt;

&lt;p&gt;The rules themselves are plain functions that take a snapshot of your training and return what's due today. A WorkManager job runs them in the background, and unit tests cover the edges, like a deload week that shouldn't trigger a weekly goal alert.&lt;/p&gt;

&lt;h2&gt;
  
  
  36 badges, free for everyone
&lt;/h2&gt;

&lt;p&gt;Pro is the layer that interprets your data. Badges are motivation, and motivation shouldn't be paywalled. So all 36 are free: milestones, training, strength, consistency, body and community.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjb3knboazxwz54493kgp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjb3knboazxwz54493kgp.png" alt="The badges page: body badges and the community badges, including Founding member #9, Pro for life, Supporter and Big supporter" width="800" height="1630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Two lessons from earlier parts showed up again:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Count all-time, not 90 days.&lt;/strong&gt; History loads 90 days, so the Centurion badge (train on 100 different days) can't be counted from it. Training days, sets and records are counters on the account, the same way records moved to their own collection in Part 4.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compare in one unit.&lt;/strong&gt; The weight clubs are 60 to 180 kg, or 135 to 405 lb. Progress is stored in tenths of a kilogram, so 225 lb logged in pounds reaches the 225 lb goal exactly, without a rounding error in between.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Badges earned before the feature existed are saved quietly. The first launch after the update would otherwise have shown a stack of banners for things you did months ago. After that, each new badge gets its own banner.&lt;/p&gt;

&lt;p&gt;My favorite one is &lt;strong&gt;Pocket logger&lt;/strong&gt;: log a set from the notification.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Event badges&lt;/strong&gt; come from Remote Config. A JSON list in &lt;code&gt;badge_events&lt;/code&gt; defines a title, a window and a goal ("train 3 times this week"), so an event can start without an app update. A broken entry is skipped instead of breaking the badges page, and an earned event badge stays on the account after the event ends.&lt;/p&gt;

&lt;h2&gt;
  
  
  Founding member: from a date to a number
&lt;/h2&gt;

&lt;p&gt;The first version of the Founding member badge used a Remote Config date: sign up before it, get the badge. That had two problems. A date doesn't mean "the first 100", and the app decided who qualified.&lt;/p&gt;

&lt;p&gt;Version 1.7.1 gives out numbers instead, #1 to #100, from a Cloud Function in a Firestore transaction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;runTransaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;foundingMeta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;existing&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;founderRef&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;existing&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"already"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exists&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="no"&gt;FOUNDING_LIMIT&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"full"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;founderRef&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Timestamp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;foundingMeta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;FOUNDING_LIMIT&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;merge&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sb"&gt;`#${count + 1}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The number lives in &lt;code&gt;founders/{uid}&lt;/code&gt;, which its member can read and nobody can write from the app. I first wanted to put it in the profile document, but version 1.6.0 creates email accounts with a plain &lt;code&gt;set()&lt;/code&gt;, which replaces the whole document. A field there could be wiped by an app version that's still installed. A separate document no app version ever writes is safer than any rule about fields.&lt;/p&gt;

&lt;p&gt;Since then the function has moved from "account created" to "onboarding finished", so a sign-up someone abandons halfway doesn't take one of the hundred numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  The backup that signed everyone out
&lt;/h2&gt;

&lt;p&gt;The worst bug of this release was simple to describe: on some installs, the app forgot the sign-in every time it closed. Sign in, close, open: signed out.&lt;/p&gt;

&lt;p&gt;The cause was Android's Auto Backup. Firebase Auth stores the signed-in user encrypted, with a key from the &lt;strong&gt;Android Keystore&lt;/strong&gt;. Auto Backup happily restored Firebase's files to the new install, including the encrypted keyset. The Keystore key that opens it never leaves the device, by design. So Firebase found a keyset it couldn't use, couldn't save any sign-in with it, and every launch started signed out.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fps86f1nw0n4vov4rl61r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fps86f1nw0n4vov4rl61r.png" alt="How Auto Backup broke sign-in: the saved sign-in and its keyset were restored to a new install, but the Keystore key that opens the keyset never leaves a phone; the fixes exclude those files from backups and delete an unusable keyset at startup" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The fix has two halves. New backups leave those files out, in both rule files, because Android 12 and later read &lt;code&gt;data_extraction_rules.xml&lt;/code&gt; and older versions read &lt;code&gt;backup_rules.xml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;cloud-backup&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;exclude&lt;/span&gt; &lt;span class="na"&gt;domain&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"sharedpref"&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"com.google.firebase.auth.api.crypto.….xml"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;exclude&lt;/span&gt; &lt;span class="na"&gt;domain&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"sharedpref"&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"com.google.firebase.auth.api.Store.….xml"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/cloud-backup&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Phones that already restored a broken keyset needed more. At startup, if no sign-in is saved, the old keyset protects nothing, so it's removed before Firebase Auth starts and Firebase creates a working one on the next sign-in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;resetUnusableAuthKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getSharedPreferences&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"com.google.firebase.auth.api.Store.$suffix"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;MODE_PRIVATE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"com.google.firebase.auth.FIREBASE_USER"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;crypto&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"com.google.firebase.auth.api.crypto.$suffix"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;getSharedPreferences&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;MODE_PRIVATE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;all&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isNotEmpty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;deleteSharedPreferences&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While I was in there, I removed a second way to get signed out. The app used to sign out when the profile couldn't be loaded, which on a weak gym connection happened often. Now only an account that was deleted or disabled is signed out. Anything else opens the app and syncs later.&lt;/p&gt;

&lt;p&gt;1.7.0 had already been approved by Play. I never published it, and shipped 1.7.1 with the fix instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Smaller things
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Separate units&lt;/strong&gt; for weights (kg or lb) and body measurements (cm or in), chosen during onboarding and defaulting to your region.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No camera permission.&lt;/strong&gt; "Take photo" hands off to the system camera app, which needs no permission at all.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;About 900 KB smaller.&lt;/strong&gt; The R8 rules no longer keep whole libraries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set numbers that make sense.&lt;/strong&gt; Left and right share a number (1, 1, 2, 3), warm-ups show "W", and a one-sided set counts once both sides are logged.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I'd tell myself before 1.7.0
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Put the action where your hands already are. For a gym app, that's the lock screen.&lt;/li&gt;
&lt;li&gt;Anything restored from a backup has to survive without the old device's keys.&lt;/li&gt;
&lt;li&gt;Hand out scarce things, like the first 100 numbers, from a server in a transaction.&lt;/li&gt;
&lt;li&gt;Don't sign people out because the network is slow.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Version 1.7.1 is live on Google Play. Next, DotShredzilla learns five languages, including right-to-left Arabic.&lt;/p&gt;

&lt;p&gt;What would you want to do from a notification without opening the app?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Google Play:&lt;/strong&gt; &lt;a href="https://play.google.com/store/apps/details?id=com.FreeRave.shredzilla" rel="noopener noreferrer"&gt;DotShredzilla&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="https://github.com/kareem2099/Shredzilla" rel="noopener noreferrer"&gt;github.com/kareem2099/Shredzilla&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Privacy &amp;amp; terms:&lt;/strong&gt; &lt;a href="https://dotsuite.dev/en/dotshredzilla/privacy" rel="noopener noreferrer"&gt;dotsuite.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Support:&lt;/strong&gt; &lt;a href="mailto:support@dotsuite.dev"&gt;support@dotsuite.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>kotlin</category>
      <category>jetpackcompose</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Building DotShredzilla (Part 6): Pro Without Forced Ads, and Ad Rewards a Server Can Trust</title>
      <dc:creator>freerave</dc:creator>
      <pubDate>Sat, 21 Nov 2026 19:45:49 +0000</pubDate>
      <link>https://dev.to/freerave/building-dotshredzilla-part-6-pro-without-forced-ads-and-ad-rewards-a-server-can-trust-1kpb</link>
      <guid>https://dev.to/freerave/building-dotshredzilla-part-6-pro-without-forced-ads-and-ad-rewards-a-server-can-trust-1kpb</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to/freerave/building-dotshredzilla-part-5-shipping-to-google-play-the-parts-nobody-sees-15k1"&gt;Part 5&lt;/a&gt; ended with version 1.5.1 in Play review. Before that release even went live, I decided I didn't want its biggest annoyance anymore: an ad every time the app opened.&lt;/p&gt;

&lt;p&gt;A workout tracker is opened between sets, with chalk on your hands and a timer running. An interstitial at that moment isn't a business model, it's friction. So version 1.6.0 removes every forced ad and replaces them with three things you choose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pro for life&lt;/strong&gt;, a one-time purchase.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pro hours&lt;/strong&gt;: watch one optional ad, get one hour of Pro.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tips&lt;/strong&gt;: a pre-workout shot, a protein scoop or a creatine tub. They say thanks and add a Supporter badge, nothing else.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;DotShredzilla is an Android workout tracker from &lt;strong&gt;FreeRave (DotSuite)&lt;/strong&gt;, written in Kotlin with Jetpack Compose and Firebase, and open source under &lt;strong&gt;Apache License 2.0&lt;/strong&gt;: &lt;a href="https://github.com/kareem2099/Shredzilla" rel="noopener noreferrer"&gt;github.com/kareem2099/Shredzilla&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb0twbyovh2ghurydabir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb0twbyovh2ghurydabir.png" alt="The DotShredzilla Pro page: &amp;quot;You're Pro for life&amp;quot; with the Supporter badge, and the list of what Pro adds: next-set coach, last-time comparison, body insights and advanced stats" width="800" height="1600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Deciding what Pro is
&lt;/h2&gt;

&lt;p&gt;The hardest part wasn't code. It was drawing the line between free and Pro without making the free app feel crippled.&lt;/p&gt;

&lt;p&gt;The rule I settled on: &lt;strong&gt;everything you need to train stays free&lt;/strong&gt;. Logging, lists, programs, workout mode, supersets, the rest timer, the plate calculator, personal records, streaks, deload reminders, measurements, history and sharing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro is the layer that interprets your data:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The next-set coach and the "+2 reps" comparison with last session.&lt;/li&gt;
&lt;li&gt;Body-measurement insights and trend charts.&lt;/li&gt;
&lt;li&gt;A new stats screen: hard sets per muscle each week against the usual 10 to 20, an estimated 1RM trend per exercise, and eight weeks of sets, volume and training time.&lt;/li&gt;
&lt;li&gt;Four accent themes and two extra share-card styles.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Locked features don't disappear. Each one shows a small gold card saying what it would do, and the stats screen renders your real numbers blurred behind an "Unlock" button. Seeing your own data is a much better pitch than a feature list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Play Billing: three rules
&lt;/h2&gt;

&lt;p&gt;Billing Library 8 is pleasant to use, but three details matter:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Acknowledge non-consumables.&lt;/strong&gt; If Pro for life isn't acknowledged within three days, Google refunds it automatically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consume tips.&lt;/strong&gt; A tip that isn't consumed can't be bought again ("You already own this item").&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Play is the source of truth.&lt;/strong&gt; Pro for life is restored from &lt;code&gt;queryPurchasesAsync&lt;/code&gt; on every connection, so it follows the Google Play account to new phones. A cached flag only covers offline launches.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;ProCatalog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;PRO_LIFETIME&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;purchase&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;purchase&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isAcknowledged&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
        &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;acknowledgePurchase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;AcknowledgePurchaseParams&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;newBuilder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setPurchaseToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;purchase&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;purchaseToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* ProUnlocked */&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nc"&gt;SupportTip&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forProduct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;purchase&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;products&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
        &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;consumeAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ConsumeParams&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;newBuilder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setPurchaseToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;purchase&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;purchaseToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="cm"&gt;/* TipReceived */&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Purchase events go through a buffered &lt;code&gt;Channel&lt;/code&gt;, collected at the app root rather than on the Pro page. A payment can finish while you're somewhere else in the app, and the thank-you still has to appear.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first version of ad hours trusted the phone
&lt;/h2&gt;

&lt;p&gt;My first implementation of "one ad, one hour" did the obvious thing: when AdMob reported a reward, the app wrote a new &lt;code&gt;proUntil&lt;/code&gt; timestamp to the user's Firestore document.&lt;/p&gt;

&lt;p&gt;It worked, and it was trivially abusable. Anyone could write &lt;code&gt;proUntil: 2099&lt;/code&gt; to their own document, change the phone's clock to reset a "5 ads per day" limit, or replay the write.&lt;/p&gt;

&lt;p&gt;So the rule became: &lt;strong&gt;the app never writes Pro time. A server does, and only after Google confirms the ad was watched.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  AdMob server-side verification
&lt;/h2&gt;

&lt;p&gt;AdMob supports exactly this. You give the ad unit a callback URL. When someone finishes a rewarded ad, Google calls that URL with the reward details and an ECDSA signature made with keys it publishes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpnqnj8sir27lfxoesowm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpnqnj8sir27lfxoesowm.png" alt="How an ad hour is granted: the app shows the rewarded ad with the user ID, AdMob calls the admobReward Cloud Function, which checks Google's signature and moves proUntil forward in Firestore on the server's clock; the app writing proUntil itself is denied by Firestore rules" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The app sets the Firebase user ID on the ad before showing it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="n"&gt;ad&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setServerSideVerificationOptions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nc"&gt;ServerSideVerificationOptions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Builder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setUserId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The callback is a Firebase Cloud Function. It verifies the signature against Google's published keys, then grants the hour inside a Firestore transaction using &lt;strong&gt;the server's clock&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;grantAdHour&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;transactionId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transactions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;transactionId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;granted&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"duplicate"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;recent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;adTimes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;DAY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;recent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;granted&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"daily_limit"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;untilMillis&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;HOUR&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="no"&gt;HOUR&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;granted&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"bank_full"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;granted&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;untilMillis&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;untilMillis&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;HOUR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;adTimes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;recent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;transactions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transactions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;transactionId&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three details in there came from thinking about how it could go wrong:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A rolling 24 hours instead of "per day".&lt;/strong&gt; A calendar day depends on a time zone, and the phone's time zone is under the user's control.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transaction IDs are remembered.&lt;/strong&gt; AdMob retries callbacks, and a retry must not grant a second hour.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The function answers 200 even when a limit is hit.&lt;/strong&gt; The callback was genuine, so retrying won't change anything.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The logic is a plain function with no Firebase imports, so it has unit tests. The signature check has tests too, using a key pair generated in the test itself.&lt;/p&gt;

&lt;h3&gt;
  
  
  Locking the fields with Firestore rules
&lt;/h3&gt;

&lt;p&gt;The server can only be the sole writer if the client is stopped from writing. Firestore rules can compare an update with the stored document:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rego"&gt;&lt;code&gt;&lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;serverOwned&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'proUntil'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'proAdTimes'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'proAdTxns'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;allow&lt;/span&gt; &lt;span class="n"&gt;update&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;isOwner&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;resource&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;diff&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resource&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;affectedKeys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hasAny&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;serverOwned&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;document&lt;/span&gt;&lt;span class="o"&gt;=**&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;allow&lt;/span&gt; &lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;isOwner&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That inner match first read &lt;code&gt;match /{document=**}&lt;/code&gt;, and it would have quietly undone everything. A recursive wildcard matches &lt;strong&gt;zero&lt;/strong&gt; or more segments, so it also matched the profile document itself and granted full write access to it. Putting &lt;code&gt;{collection}&lt;/code&gt; first forces at least one segment.&lt;/p&gt;

&lt;p&gt;I only trusted the rules after running them in the Firestore emulator: 11 tests covering normal profile edits, attempts to grant yourself Pro time, set-merge tricks, new accounts and other users. One test failed, and the bug was in the test, not the rules. Writing &lt;code&gt;[]&lt;/code&gt; over an empty array changes nothing, so it was allowed. Seeding a real value fixed it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 403 that taught me how Google signs
&lt;/h2&gt;

&lt;p&gt;The first time AdMob's "Verify URL" button called the function, it returned &lt;strong&gt;403&lt;/strong&gt;. The signature was being rejected.&lt;/p&gt;

&lt;p&gt;I was verifying the raw query string exactly as received. Google's own verifier, in Tink's &lt;code&gt;RewardedAdsVerifier&lt;/code&gt;, reads the query with Java's &lt;code&gt;URI.getQuery()&lt;/code&gt;, which &lt;strong&gt;percent-decodes&lt;/strong&gt; it before checking. Matching that was a one-line change:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;decodeURIComponent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rawQuery&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rawQuery&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&amp;amp;signature="&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also made a failed download of Google's keys return 503 instead of 403, so AdMob retries later instead of treating it as forged. After a redeploy, AdMob showed "Your callback URL has been verified".&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing real ads without risking the AdMob account
&lt;/h2&gt;

&lt;p&gt;Google's shared test ad unit never calls your server, so it can't test this flow. Clicking real ads on your own phone can get an AdMob account suspended.&lt;/p&gt;

&lt;p&gt;The answer is a registered test device: the real ad unit serves labelled test ads, and the callback still fires. The device ID AdMob expects is the MD5 of the app's &lt;code&gt;ANDROID_ID&lt;/code&gt;, so debug builds register whatever device they run on:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;BuildConfig&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;DEBUG&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;MessageDigest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getInstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"MD5"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;androidId&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toByteArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;joinToString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s2"&gt;"%02X"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nc"&gt;MobileAds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setRequestConfiguration&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nc"&gt;RequestConfiguration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Builder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setTestDeviceIds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;listOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the first try, Logcat said "This request is sent from a test device", and the function logged &lt;code&gt;granted: true&lt;/code&gt; for my account.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two things the Today page got wrong
&lt;/h2&gt;

&lt;p&gt;While building Pro I kept finding smaller problems.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Every set was number 1.&lt;/strong&gt; The loader for the Today page hard-coded &lt;code&gt;setNumber = 1&lt;/code&gt;. Sets are now numbered in the order they were logged, per exercise and per side, and warm-ups show "W".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Training time didn't exist.&lt;/strong&gt; Workouts started from workout mode already stored their duration, but sets logged from the exercise list had nothing. Today now groups any sets logged outside a workout into sessions, splitting at gaps longer than 45 minutes so morning and evening training stay apart, and merges overlaps so nothing is counted twice. The stats screen uses the same function to show time per week.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fec25ab6uxrsstaoa233v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fec25ab6uxrsstaoa233v.png" alt="How training time is counted: sets with a 20-minute pause stay in one session, a gap over 45 minutes starts a new one, the last set adds 2 minutes, and warm-ups logged before Start merge with the workout, giving 49m plus 1h, 1h 49m in total" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The paperwork
&lt;/h2&gt;

&lt;p&gt;Selling things on Google Play brought its own list of steps, most of them outside the code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A merchant account.&lt;/strong&gt; I reused my existing individual payments profile, the one AdMob already pays into. You don't need a company to sell as an individual.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The 15% service fee.&lt;/strong&gt; It isn't automatic: you create an account group and accept the terms. Otherwise Google takes 30%.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Products need an uploaded build.&lt;/strong&gt; The one-time products page stays locked until a bundle with the &lt;code&gt;BILLING&lt;/code&gt; permission is in a track. I uploaded 1.6.0 to Internal testing first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;License testers.&lt;/strong&gt; I created a list with just my own email. The existing tester list wasn't used, because license testers buy for free.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data safety.&lt;/strong&gt; Purchase history is now declared as collected, optional and used for app functionality.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Terms and privacy in five languages.&lt;/strong&gt; Both gained a section on Pro, purchases and server-verified ad hours. The website changes were pushed together with the release, not earlier, so the published policy never described an app that wasn't on the store.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then I tested everything from the Internal testing track with Play's test card: Pro for life, all three tips, and the same tip twice to prove it was consumed. The receipts said "Test:", the prices showed in local currency, and the Supporter badge appeared.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd tell myself before adding payments
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Decide what stays free before writing any code. It shapes every screen.&lt;/li&gt;
&lt;li&gt;If a reward has value, the client must not be able to grant it. Put the grant behind a server and lock the fields with rules.&lt;/li&gt;
&lt;li&gt;Test security rules in the emulator, including the attempts that should fail.&lt;/li&gt;
&lt;li&gt;When a signature doesn't verify, read the reference verifier before assuming the keys are wrong.&lt;/li&gt;
&lt;li&gt;Buy everything once on a test track, including the same consumable twice, before sending a release to review.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Version 1.6.0 is in Play review as I write this. Free training stays free, and nobody sees an ad unless they ask for one.&lt;/p&gt;

&lt;p&gt;How do you monetize a small app you'd still want to use yourself: one-time purchase, subscription, optional ads or tips?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Google Play:&lt;/strong&gt; &lt;a href="https://play.google.com/store/apps/details?id=com.FreeRave.shredzilla" rel="noopener noreferrer"&gt;DotShredzilla&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="https://github.com/kareem2099/Shredzilla" rel="noopener noreferrer"&gt;github.com/kareem2099/Shredzilla&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Privacy &amp;amp; terms:&lt;/strong&gt; &lt;a href="https://dotsuite.dev/en/dotshredzilla/privacy" rel="noopener noreferrer"&gt;dotsuite.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Support:&lt;/strong&gt; &lt;a href="mailto:support@dotsuite.dev"&gt;support@dotsuite.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>kotlin</category>
      <category>firebase</category>
      <category>monetization</category>
    </item>
    <item>
      <title>Building DotShredzilla (Part 5): Shipping to Google Play, the Parts Nobody Sees</title>
      <dc:creator>freerave</dc:creator>
      <pubDate>Fri, 20 Nov 2026 18:01:01 +0000</pubDate>
      <link>https://dev.to/freerave/building-dotshredzilla-part-5-shipping-to-google-play-the-parts-nobody-sees-15k1</link>
      <guid>https://dev.to/freerave/building-dotshredzilla-part-5-shipping-to-google-play-the-parts-nobody-sees-15k1</guid>
      <description>&lt;p&gt;Parts 2 to 4 covered the visible work: the glass redesign, the gym-driven data model, and the training features. This part is about everything between "it works on my phone" and "it's on Google Play".&lt;/p&gt;

&lt;p&gt;Most of it isn't visible in the app at all. A lot of it only showed up because I tested the actual release build and read every warning in Play Console instead of clicking past it.&lt;/p&gt;

&lt;p&gt;DotShredzilla is an Android workout tracker from &lt;strong&gt;FreeRave (DotSuite)&lt;/strong&gt;, open source under &lt;strong&gt;Apache License 2.0&lt;/strong&gt;: &lt;a href="https://github.com/kareem2099/Shredzilla" rel="noopener noreferrer"&gt;github.com/kareem2099/Shredzilla&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  A rest timer you can trust with the screen off
&lt;/h2&gt;

&lt;p&gt;The old rest timer re-posted its notification every 100 ms, used the colored launcher icon as a status-bar icon, and restarted the app when tapped. Worse, with the screen off the phone could sleep, so "rest over" sometimes arrived late.&lt;/p&gt;

&lt;p&gt;The new one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Posts the notification &lt;strong&gt;once&lt;/strong&gt; and lets the system count down, also on the lock screen:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setWhen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;endsAtMillis&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setUsesChronometer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setChronometerCountDown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Holds a partial wake lock only for the length of the rest, so the end is on time.&lt;/li&gt;
&lt;li&gt;Vibrates with alarm usage when the rest ends, so it's felt even on silent in a gym bag.&lt;/li&gt;
&lt;li&gt;Brings the running app forward on tap, the way the launcher icon does, instead of restarting it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The crash that only existed in release
&lt;/h2&gt;

&lt;p&gt;Every build I'd tested was a debug build. Before uploading, I installed the minified release APK on my phone, and it crashed on launch:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Failed to create an instance of androidx.work.impl.WorkDatabase&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Nothing in my code uses WorkManager. AdMob does, and it pulled in &lt;strong&gt;WorkManager 2.7.0 with Room 2.2.5&lt;/strong&gt;. That Room version creates its database class by reflection without shipping the keep rules R8 needs, so R8 removed the class. Depending on a current WorkManager directly brings a newer Room with its consumer rules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="c1"&gt;// AdMob pulls in WorkManager 2.7 with Room 2.2, whose database is created by reflection and&lt;/span&gt;
&lt;span class="c1"&gt;// stripped by R8 (release crash on launch); a current WorkManager brings Room's keep rules&lt;/span&gt;
&lt;span class="nf"&gt;implementation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;libs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;androidx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;work&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;runtime&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The lesson is boring and important: install the release build on a real device before uploading, every time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fud2sygohzbwirpzd8q27.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fud2sygohzbwirpzd8q27.png" alt="The chain behind the release-only crash: AdMob pulls in WorkManager 2.7.0, which uses Room 2.2.5, which creates WorkDatabase by reflection without keep rules, so R8 removes it; the fix is a direct WorkManager dependency" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Updates without leaving users behind
&lt;/h2&gt;

&lt;p&gt;Older versions used a small library that read an &lt;code&gt;update-info.json&lt;/code&gt; from Firebase Hosting and showed a dialog. It always had a "Dismiss" button, so it couldn't require anything.&lt;/p&gt;

&lt;p&gt;From 1.5.0 onward, updates go through &lt;strong&gt;Google Play In-App Updates&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When Play has a newer version, the app offers it at most once a day and downloads it in the background, then asks for a restart.&lt;/li&gt;
&lt;li&gt;A Firebase &lt;strong&gt;Remote Config&lt;/strong&gt; parameter, &lt;code&gt;min_supported_version_code&lt;/code&gt;, sets the lowest version allowed to run. Anything below it gets a full-screen "Update required" screen that uses Play's immediate update flow.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The minimum can be raised from the Firebase console without a release. The old JSON still exists for installs that predate this, now pointing at the new version.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu0wzj77wrrx9wuvg238p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu0wzj77wrrx9wuvg238p.png" alt="How updates work: at start the app reads min_supported_version_code from Remote Config; below it, a full-screen Update required uses Play's immediate update, otherwise a newer version is offered at most once a day" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Android 16 and Play's checks
&lt;/h2&gt;

&lt;p&gt;The release targets API 37 (Android 17), above Play's Android 16 requirement, with minimum API 29 unchanged. Edge-to-edge and predictive back were already handled during the redesign.&lt;/p&gt;

&lt;p&gt;Before uploading I checked the bundle itself:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;16 KB page alignment.&lt;/strong&gt; Play requires it for native libraries. The only native code was a small AndroidX library, and its &lt;code&gt;LOAD&lt;/code&gt; segments were aligned at &lt;code&gt;0x4000&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Version and signing.&lt;/strong&gt; The final merged manifest's &lt;code&gt;versionCode&lt;/code&gt; and &lt;code&gt;targetSdkVersion&lt;/code&gt;, and the upload key's certificate.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The upload that Play blocked
&lt;/h2&gt;

&lt;p&gt;Two surprises waited in Play Console.&lt;/p&gt;

&lt;p&gt;The first: the version live on Google Play was &lt;strong&gt;1.2.0&lt;/strong&gt;. Versions 1.3.0 and 1.4.0 had never been uploaded. So this release was a much bigger jump than the version number suggested.&lt;/p&gt;

&lt;p&gt;The second: Play's pre-review checks blocked versionCode 8 under the &lt;strong&gt;photo and video permissions policy&lt;/strong&gt;. The app requested &lt;code&gt;READ_MEDIA_IMAGES&lt;/code&gt; just to pick a profile picture. Version &lt;strong&gt;1.5.1&lt;/strong&gt; switches to the system photo picker, which needs no storage permission and gives the app access only to the chosen image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;galleryLauncher&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;rememberLauncherForActivityResult&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ActivityResultContracts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;PickVisualMedia&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;uri&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;let&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nf"&gt;usePhoto&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"user_profile_gallery_"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Old testing tracks that still shipped the broad permission were paused, because the policy applies to every track.&lt;/p&gt;

&lt;h2&gt;
  
  
  Being accurate about data
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;Data safety&lt;/strong&gt; form claimed the app collected only device IDs. In reality it collects workouts, weight and body measurements, and uses analytics. The listing now declares health and fitness information and app interactions as collected for app functionality and analytics, with device IDs shared only for ads.&lt;/p&gt;

&lt;p&gt;The account also needed a &lt;strong&gt;trader status&lt;/strong&gt; declaration, plus an app-level confirmation and a link to app-specific terms. That's a legal decision about how you publish, not a checkbox to click through.&lt;/p&gt;

&lt;h2&gt;
  
  
  Legal pages in five languages
&lt;/h2&gt;

&lt;p&gt;DotShredzilla's privacy policy, account deletion page and terms of use now live on &lt;a href="https://dotsuite.dev/en/privacy#dotshredzilla" rel="noopener noreferrer"&gt;dotsuite.dev&lt;/a&gt; in English, Arabic, German, French and Russian:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;privacy section&lt;/strong&gt; describes what's stored, explains that health and fitness data isn't sold or used for ads, and includes in-app deletion.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;terms&lt;/strong&gt; include a section on training, health and safety: the app isn't medical advice, its suggestions are general, and you should stop if something hurts.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;source documents&lt;/strong&gt; live in the app's repository under &lt;code&gt;docs/legal&lt;/code&gt;, and a script bundles them into the website so the published text and the repository can't drift apart.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;DotSuite already had the same pages for DotReminder, so I turned those into shared components rather than copying them. Each app now provides only its own text.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cleaning up Firebase
&lt;/h2&gt;

&lt;p&gt;The Firebase project still showed its age:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hosting&lt;/strong&gt; showed the default "Welcome to Firebase Hosting" page. It now redirects &lt;code&gt;/privacy&lt;/code&gt;, &lt;code&gt;/terms&lt;/code&gt; and &lt;code&gt;/delete-account&lt;/code&gt; to dotsuite.dev, and serves the update JSON uncached.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The old privacy policy&lt;/strong&gt; on GitHub Pages now forwards to the new one, so two different policies aren't public at the same time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The public-facing name&lt;/strong&gt; shown in Firebase emails was &lt;code&gt;project-501485535836&lt;/code&gt;. It's now DotShredzilla.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Firestore delete protection&lt;/strong&gt; is on.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A legacy shared collection&lt;/strong&gt; from the old app was removed, and the rules now allow nothing outside each user's own documents.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scheduled backups&lt;/strong&gt; need billing, so they'll come once real users are storing real training history.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A new icon
&lt;/h2&gt;

&lt;p&gt;The launcher icon became an adaptive vector: claw marks behind a dumbbell, in the brand violet and blue, with a monochrome variant for Android 13 themed icons.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5mfkqg7ata9i66mv1qbs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5mfkqg7ata9i66mv1qbs.png" alt="The new DotShredzilla icon: claw marks behind a dumbbell in violet and blue" width="512" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd tell myself before the next release
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Install the minified release build on a real device.&lt;/li&gt;
&lt;li&gt;Read every Play pre-review check. They found a real policy problem before review did.&lt;/li&gt;
&lt;li&gt;Keep the Data safety form, the privacy policy and the code saying the same thing.&lt;/li&gt;
&lt;li&gt;Look at what's actually live on the store before assuming you know the version history.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Version 1.5.1 is going through Play review as I write this. Every part of this series came from using the app, and the next improvements will too.&lt;/p&gt;

&lt;p&gt;Part 6 covers what came next: removing every forced ad, selling Pro with Play Billing, and granting ad rewards only after a server has verified them.&lt;/p&gt;

&lt;p&gt;What's the most surprising thing Play Console has flagged on one of your releases?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Google Play:&lt;/strong&gt; &lt;a href="https://play.google.com/store/apps/details?id=com.FreeRave.shredzilla" rel="noopener noreferrer"&gt;DotShredzilla&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="https://github.com/kareem2099/Shredzilla" rel="noopener noreferrer"&gt;github.com/kareem2099/Shredzilla&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Privacy &amp;amp; terms:&lt;/strong&gt; &lt;a href="https://dotsuite.dev/en/privacy#dotshredzilla" rel="noopener noreferrer"&gt;dotsuite.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Support:&lt;/strong&gt; &lt;a href="mailto:support@dotsuite.dev"&gt;support@dotsuite.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>googleplay</category>
      <category>firebase</category>
      <category>kotlin</category>
    </item>
    <item>
      <title>Building DotShredzilla (Part 4): Workout Mode, Records, Deloads and Body Insights</title>
      <dc:creator>freerave</dc:creator>
      <pubDate>Thu, 19 Nov 2026 19:49:53 +0000</pubDate>
      <link>https://dev.to/freerave/building-dotshredzilla-part-4-workout-mode-records-deloads-and-body-insights-387d</link>
      <guid>https://dev.to/freerave/building-dotshredzilla-part-4-workout-mode-records-deloads-and-body-insights-387d</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to/freerave/building-dotshredzilla-part-3-what-a-real-gym-session-taught-my-data-model-1ng7"&gt;Part 3&lt;/a&gt; reshaped how a set is stored: plates, bodyweight, per-side loads, left and right, warm-ups and tempo. With that data in place, the next question was what the app should &lt;em&gt;do&lt;/em&gt; with it during and after a workout.&lt;/p&gt;

&lt;p&gt;The guiding idea came from my own training notes. I kept writing "+2 reps compared to last week" by hand. The app should be doing that comparison for me.&lt;/p&gt;

&lt;p&gt;DotShredzilla is an Android workout tracker from &lt;strong&gt;FreeRave (DotSuite)&lt;/strong&gt;, open source under &lt;strong&gt;Apache License 2.0&lt;/strong&gt;: &lt;a href="https://github.com/kareem2099/Shredzilla" rel="noopener noreferrer"&gt;github.com/kareem2099/Shredzilla&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Workout mode
&lt;/h2&gt;

&lt;p&gt;Logging from a list worked, but mid-workout you want one screen that answers three questions: what's next, what did I do last time, and how long do I rest.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Start workout&lt;/strong&gt; on a list opens a guided session:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The current exercise, its target sets (from a program) and the sets done so far.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Last time&lt;/strong&gt;: every working set from the previous session of this exercise.&lt;/li&gt;
&lt;li&gt;One big button that logs the next set and starts the rest timer.&lt;/li&gt;
&lt;li&gt;Once the target is reached, the button becomes "Next: Leg Press", with "Log another set" one tap away.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each new set shows how it compares to the matching set from last time: "+2 reps", "+1 plate", or "Same". When the load changed, the load difference wins over reps, because that's the change that usually matters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Supersets&lt;/strong&gt; link the current exercise with the next one. A set of the first exercise jumps straight to the second without rest; a set of the second starts the rest and goes back to the first.&lt;/p&gt;

&lt;p&gt;A session isn't stored separately while it runs. It's simply every set logged since you pressed Start, which also means it works offline like everything else. When you finish, a summary is saved to &lt;code&gt;users/{uid}/workouts&lt;/code&gt;, with duration, sets, volume, records and each exercise's best set, and it appears on a History page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9r5l7xfdpzpo7o588u3b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9r5l7xfdpzpo7o588u3b.png" alt="Workout mode on a push day: the current exercise with its target, a superset with Shoulder Press, the hint &amp;quot;Try 60 kg × 11 · last session 60 kg × 10&amp;quot; and last session's sets" width="800" height="1422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A progression hint, not a coach
&lt;/h2&gt;

&lt;p&gt;The record sheet suggests the next step using &lt;strong&gt;double progression&lt;/strong&gt;, a common approach: work up to the top of a rep range at a load, then add load and drop back down.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Take the top set from the last session (warm-ups excluded).&lt;/li&gt;
&lt;li&gt;Below 12 reps: suggest one more rep at the same load.&lt;/li&gt;
&lt;li&gt;At 12 reps: suggest +2.5 kg (or +5 lb, or one more plate) at 8 reps.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It appears as "Try 60 kg × 11 · last session 60 kg × 10", and &lt;strong&gt;Use&lt;/strong&gt; fills the values in. It's a hint. The app doesn't know if your shoulder hurts today, and the terms of use say so.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo9h9ygmh7qjamztpwenc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo9h9ygmh7qjamztpwenc.png" alt="Double progression across four sessions: 60 kg × 10, then 60 kg × 11, then 60 kg × 12 at the top of the range, then 62.5 kg × 8" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Personal records that survive beyond 90 days
&lt;/h2&gt;

&lt;p&gt;History loads the last 90 days, so records calculated from that window would quietly reset over time. All-time bests are therefore stored separately in &lt;code&gt;users/{uid}/records/{exerciseId}&lt;/code&gt;, one best per kind, because a plate count and a kilogram value aren't comparable.&lt;/p&gt;

&lt;p&gt;Checking a new set looks at both the stored record and the loaded history:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;checkRecord&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;LoggedSet&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stored&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;PersonalRecord&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;SetEntry&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;unitSystem&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;UnitSystem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;RecordCheck&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;isPlates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plates&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;load&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plates&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toDouble&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="nf"&gt;displayToKg&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;weight&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;unitSystem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;load&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bodyweight&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setType&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nc"&gt;SetType&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;WARMUP&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;RecordCheck&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;NONE&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;storedBest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;isPlates&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;stored&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mostPlates&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="n"&gt;stored&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;heaviest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;load&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;historyBest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isPlates&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;isPlates&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;countsForRecords&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;maxOfOrNull&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;load&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;previousBest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;listOfNotNull&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;storedBest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;historyBest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;maxOrNull&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;RecordCheck&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;FIRST&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;load&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;previousBest&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;LOAD_EPSILON&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nc"&gt;RecordCheck&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;BEATEN&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="nc"&gt;RecordCheck&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;NONE&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;FIRST&lt;/code&gt; means there was nothing to beat yet. It's saved quietly, because celebrating someone's very first set as a "record" feels silly. &lt;code&gt;BEATEN&lt;/code&gt; shows a banner and saves the new best.&lt;/p&gt;

&lt;p&gt;Records started with this feature, so older bests are backfilled from loaded history. That only happens after the records snapshot has arrived; otherwise every best would look new. A Records page lists the bests, with a reset for the occasional mistyped 600 kg set.&lt;/p&gt;

&lt;h2&gt;
  
  
  Weekly goal, streak and deload
&lt;/h2&gt;

&lt;p&gt;The weekly goal set during onboarding finally has a home on the Today tab: a progress ring ("3/4 workouts this week") and a streak of consecutive weeks that met the goal. Weeks start on the device locale's first day, which is Saturday on my phone.&lt;/p&gt;

&lt;p&gt;I also wanted a reminder I actually follow: a &lt;strong&gt;deload week&lt;/strong&gt; every six weeks or so, lighter loads and about half the sets, to let joints and the nervous system recover. The app counts consecutive training weeks. After six, Today shows a card suggesting a deload, and you can mark the week or dismiss the card until next week. It's advice, never enforced.&lt;/p&gt;

&lt;p&gt;Marked deload weeks &lt;strong&gt;pause&lt;/strong&gt; the streak instead of breaking it. Taking the recommended rest shouldn't cost you your streak.&lt;/p&gt;

&lt;h2&gt;
  
  
  Body measurements, with restraint
&lt;/h2&gt;

&lt;p&gt;I track arms, forearms, thighs and calves on both sides, plus chest, waist and body weight. The Body page stores sessions in &lt;code&gt;users/{uid}/measurements&lt;/code&gt; and shows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The latest reading of each site, the change since the previous one, and the right-vs-left difference.&lt;/li&gt;
&lt;li&gt;A trend chart for any site or side, including body weight.&lt;/li&gt;
&lt;li&gt;Plain-language insights from simple rules: weight up with the waist steady reads as lean gain; both up suggests some of the gain is fat; both down reads as fat loss.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The app encourages measuring &lt;strong&gt;weekly or monthly&lt;/strong&gt;. If you measure sooner than your chosen rhythm, it gently notes that day-to-day numbers mostly reflect water and food. It accepts past dates, so older paper notes can be entered, and it parses Arabic-Indic digits typed on an Arabic keyboard.&lt;/p&gt;

&lt;p&gt;These insights are heuristics on your own numbers. They're useful for spotting a trend and not meant to be anything more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0nkmm1t66qk2liqugdcq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0nkmm1t66qk2liqugdcq.png" alt="The Body page: the measuring rhythm, the latest reading with changes since the previous one, right and left arms, and the start of the insights" width="800" height="1422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Sharing a workout
&lt;/h2&gt;

&lt;p&gt;The workout summary is also a share card: brand mark, date, time, sets, volume, records and each exercise's best set. The card is drawn into a Compose graphics layer as it renders, so sharing snapshots exactly what's on screen. The image is framed on an opaque background first, because some apps turn transparent rounded corners black, then handed to the system share sheet through a &lt;code&gt;FileProvider&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What made these features easier
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Most features are queries over the same set data. That only worked because Part 3 got the set model right.&lt;/li&gt;
&lt;li&gt;Warm-ups excluded in one place fixed counts, volume, records and suggestions together.&lt;/li&gt;
&lt;li&gt;Anything that sounds like health advice is phrased as a suggestion, and the legal pages say the same thing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Part 5 covers getting all of this onto Google Play: a release-only crash, Play policies, legal pages in five languages, and cleaning up the Firebase project.&lt;/p&gt;

&lt;p&gt;Which would you use most: last-session comparison, the progression hint, or deload reminders?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Google Play:&lt;/strong&gt; &lt;a href="https://play.google.com/store/apps/details?id=com.FreeRave.shredzilla" rel="noopener noreferrer"&gt;DotShredzilla&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="https://github.com/kareem2099/Shredzilla" rel="noopener noreferrer"&gt;github.com/kareem2099/Shredzilla&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project:&lt;/strong&gt; &lt;a href="https://dotsuite.dev" rel="noopener noreferrer"&gt;DotSuite&lt;/a&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>kotlin</category>
      <category>jetpackcompose</category>
      <category>fitness</category>
    </item>
    <item>
      <title>Building DotShredzilla (Part 3): What a Real Gym Session Taught My Data Model</title>
      <dc:creator>freerave</dc:creator>
      <pubDate>Wed, 18 Nov 2026 13:07:28 +0000</pubDate>
      <link>https://dev.to/freerave/building-dotshredzilla-part-3-what-a-real-gym-session-taught-my-data-model-1ng7</link>
      <guid>https://dev.to/freerave/building-dotshredzilla-part-3-what-a-real-gym-session-taught-my-data-model-1ng7</guid>
      <description>&lt;p&gt;After the redesign in &lt;a href="https://dev.to/freerave/building-dotshredzilla-part-2-a-glass-design-system-with-two-palettes-3f79"&gt;Part 2&lt;/a&gt;, DotShredzilla looked finished. Then I took it to the gym and logged a real leg day with it.&lt;/p&gt;

&lt;p&gt;Three problems showed up before the first exercise was done:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The gym had poor signal, and the app wasn't built for that.&lt;/li&gt;
&lt;li&gt;Most machines use a weight stack, and you count plates, not kilograms. The app only accepted kilograms.&lt;/li&gt;
&lt;li&gt;I wanted leg curl first, but the list order was fixed.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This part is about turning that session into changes in the data model. DotShredzilla is an Android workout tracker from &lt;strong&gt;FreeRave (DotSuite)&lt;/strong&gt;, written in Kotlin, Jetpack Compose and Firestore, and open source under &lt;strong&gt;Apache License 2.0&lt;/strong&gt;: &lt;a href="https://github.com/kareem2099/Shredzilla" rel="noopener noreferrer"&gt;github.com/kareem2099/Shredzilla&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Offline-first with Firestore
&lt;/h2&gt;

&lt;p&gt;Firestore already queues writes offline, so I assumed the app worked without signal. It mostly didn't. Three things were waiting on the server:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Refreshing after a save.&lt;/strong&gt; The UI refreshed history in the write's success listener. Offline, that listener doesn't fire until the device reconnects, so a saved set seemed to vanish. Local writes are applied to the cache immediately, so the refresh now runs right after the write is issued.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A transaction for adding an exercise.&lt;/strong&gt; Transactions need the server. Because the exercise id is derived from its name, a merge write does the same job and queues offline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Loading 90 days of history from the server.&lt;/strong&gt; On weak signal that was slow and sometimes empty. History now loads from the cache first, so it shows instantly, then refreshes from the server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An offline banner appears when the default network isn't &lt;em&gt;validated&lt;/em&gt;, so gym Wi-Fi that's connected but has no real internet counts as offline too.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bug hiding in an "empty" history
&lt;/h2&gt;

&lt;p&gt;While testing history I found a deeper bug: the progress chart and exercise history were always empty, even with sets logged.&lt;/p&gt;

&lt;p&gt;Sets were written to &lt;code&gt;users/{uid}/dailyActivity/{date}/recordedSets/{id}&lt;/code&gt;, but the day document &lt;code&gt;dailyActivity/{date}&lt;/code&gt; itself was never created. Firestore can't list documents that don't exist, even when they have subcollections, so listing the days returned nothing.&lt;/p&gt;

&lt;p&gt;The fix had two parts. History reads the last 90 days by date key instead of listing the collection, and every new set also writes its day document with a merge. Existing days are backfilled the first time they're read.&lt;/p&gt;

&lt;h2&gt;
  
  
  Loads aren't just kilograms
&lt;/h2&gt;

&lt;p&gt;A set's "load" turned out to have four shapes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Weight&lt;/strong&gt;, stored in kilograms and shown in the user's unit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plates&lt;/strong&gt; on a weight-stack machine: "6 plates × 13".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bodyweight&lt;/strong&gt;, optionally with weight added on top: "BW + 10 kg".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Per side&lt;/strong&gt; on plate-loaded machines: "30 kg/side". The total (60 kg) is stored, so volume and records stay correct.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The record sheet has one load card with a &lt;code&gt;kg | Plates | Bodyweight&lt;/code&gt; switch, and the next set starts from the last one you logged. Choose plates once on the leg press and it stays on plates.&lt;/p&gt;

&lt;p&gt;New Firestore fields are written only when they differ from the default. Older sets simply read as "normal set, kilograms, both sides", and no migration was needed. Edits explicitly delete fields that were turned off, so switching a set from plates back to kilograms doesn't leave a stale plate count behind.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpl1ccvkx40bc9srr24sx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpl1ccvkx40bc9srr24sx.png" alt="The record sheet on a cable machine: reps for both sides or one, the Load switch set to plates (15 plates), set type and tempo" width="800" height="1556"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  One leg at a time
&lt;/h2&gt;

&lt;p&gt;My measurements showed one thigh noticeably bigger than the other, and the usual answer is to train one side at a time. That needed more than a "left/right" label:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The next set opens on the &lt;strong&gt;other side&lt;/strong&gt; automatically.&lt;/li&gt;
&lt;li&gt;The rest timer starts only after &lt;strong&gt;both&lt;/strong&gt; sides are done, not between them.&lt;/li&gt;
&lt;li&gt;A left and a right set count as &lt;strong&gt;one&lt;/strong&gt; set toward the target, so "3 sets" means three per leg.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The counting rule is small enough to show in full:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;LoggedSet&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;workingSetCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Int&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;working&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;filter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setType&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="nc"&gt;SetType&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;WARMUP&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;working&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;side&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
        &lt;span class="nf"&gt;maxOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;working&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;side&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nc"&gt;Side&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;LEFT&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;working&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;side&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nc"&gt;Side&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;RIGHT&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the rest timer waits until the pair is complete:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="c1"&gt;// One side at a time: rest once both sides of the pair are done, not between them&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;pairComplete&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;side&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="n"&gt;todaySets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;side&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;side&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;todaySets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;side&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;side&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;opposite&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Warm-ups and tempo
&lt;/h2&gt;

&lt;p&gt;My training log was full of notes like "warm-up", "5 seconds down", "2 second hold at the top", and "rest-pause: to 7 reps, 5 seconds, then to 13". Typing those every set was tedious, and warm-ups were inflating my volume.&lt;/p&gt;

&lt;p&gt;Each set now has a &lt;strong&gt;type&lt;/strong&gt; (normal, warm-up, rest-pause, drop set, to failure) and a &lt;strong&gt;tempo&lt;/strong&gt; (lowering and hold seconds, as quick chips). Tempo carries over to the next set, so "5 seconds down" is chosen once per exercise.&lt;/p&gt;

&lt;p&gt;Warm-ups are still logged but stay out of set counts, daily totals, volume, personal records and progression suggestions. That one rule fixed several numbers at once.&lt;/p&gt;

&lt;h2&gt;
  
  
  Putting leg curl first
&lt;/h2&gt;

&lt;p&gt;The last problem was the simplest: lists now support drag-to-reorder through a handle on each row. The order updates live while dragging and saves once when you let go. It's one Firestore write, and it queues offline like everything else.&lt;/p&gt;

&lt;h2&gt;
  
  
  A smaller catalog problem
&lt;/h2&gt;

&lt;p&gt;Several machines from my log weren't in the app, and adding one meant knowing that the search box doubled as a "create" field. The add-exercise page now has a catalog grouped by muscle (legs, chest, back, shoulders, biceps, triceps, forearms, core) with the common machines, and typing still creates anything missing.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I took from it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Test offline on purpose: airplane mode, then a weak connection, then back online.&lt;/li&gt;
&lt;li&gt;If a Firestore path has subcollections, write the parent document too, or you can't list it later.&lt;/li&gt;
&lt;li&gt;Model a set around how people actually train. "Kilograms × reps" is one case, not the whole model.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, in Part 4: the features built on top of this data, including workout mode with supersets, last-session comparison, personal records, deload reminders and body-measurement insights.&lt;/p&gt;

&lt;p&gt;How do you log machine exercises: by plate number, by weight, or not at all?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Google Play:&lt;/strong&gt; &lt;a href="https://play.google.com/store/apps/details?id=com.FreeRave.shredzilla" rel="noopener noreferrer"&gt;DotShredzilla&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="https://github.com/kareem2099/Shredzilla" rel="noopener noreferrer"&gt;github.com/kareem2099/Shredzilla&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project:&lt;/strong&gt; &lt;a href="https://dotsuite.dev" rel="noopener noreferrer"&gt;DotSuite&lt;/a&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>kotlin</category>
      <category>firebase</category>
      <category>fitness</category>
    </item>
    <item>
      <title>DotShare Part 2: Review, receipts, and an encrypted publishing library</title>
      <dc:creator>freerave</dc:creator>
      <pubDate>Sat, 14 Nov 2026 11:26:58 +0000</pubDate>
      <link>https://dev.to/freerave/dotshare-part-2-review-receipts-and-an-encrypted-publishing-library-491h</link>
      <guid>https://dev.to/freerave/dotshare-part-2-review-receipts-and-an-encrypted-publishing-library-491h</guid>
      <description>&lt;p&gt;In &lt;a href="https://dev.to/freerave/dotshare-part-1-from-an-ai-draft-to-a-reviewed-social-post-21jn"&gt;Part 1&lt;/a&gt;, a post started in Codex, passed through a saved preview in VS Code, and ended with a public Mastodon receipt. The engineering work behind that flow came down to three questions. What exactly did I approve? What happens if the process dies during delivery? Where do drafts and credentials live?&lt;/p&gt;

&lt;p&gt;I wanted those answers to survive a restart. DotShare &lt;strong&gt;3.6.0&lt;/strong&gt; and CLI &lt;strong&gt;3.0.0&lt;/strong&gt; ship the same publishing library across the VS Code interface, CLI, and local MCP server. The library stores drafts, their revisions, and publication attempts. The platform adapter reports what it actually delivered. &lt;a href="https://github.com/kareem2099/DotShare/releases/tag/v3.6.0" rel="noopener noreferrer"&gt;Release and changelog&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  A preview belongs to a specific revision
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;create_draft&lt;/code&gt; returns a saved draft ID and revision. &lt;code&gt;update_draft&lt;/code&gt; checks the expected revision before saving an edit. That matters when I have the library open in VS Code while an agent edits the same record. If one edit wins, the other client needs to reload before saving against the new revision.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;preview_draft&lt;/code&gt; validates the saved revision and creates a preview ID. The preview records the account plan, including the effective copy, thread parts, and media. Before publishing, DotShare revalidates the plan and the local image fingerprints. A change to the draft, an account binding, or the image bytes can require a fresh preview.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzco3y5ugzkhfp1893r29.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzco3y5ugzkhfp1893r29.png" alt="Draft revisions move from Draft to Preview to Publishing and then Published. Edits require a new preview, and uncertain delivery leads to NeedsReview." width="800" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To publish a saved preview from the CLI, use the draft ID and the revision and preview ID returned by &lt;code&gt;drafts preview&lt;/code&gt;. Give that action one stable request ID.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotshare-agent drafts publish DRAFT_ID \
  --revision 1 \
  --preview-id PREVIEW_ID \
  --request-id reviewed-release-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;1&lt;/code&gt; is an example revision. Use the revision you actually reviewed. This command can publish to real accounts, so run it after checking the saved preview and its destinations. &lt;a href="https://github.com/kareem2099/DotShare/blob/master/docs/AGENT_INTEGRATION.md#saved-drafts-draft-preview-and-published" rel="noopener noreferrer"&gt;Saved draft commands&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Templates follow a similar versioning rule. The tool checks which template revision you filled, substitutes literal values, then creates an independent draft with its source template recorded. Effective content is resolved in this order: account override, platform version, shared copy. A preview always uses the resolved version for each selected destination.&lt;/p&gt;

&lt;h2&gt;
  
  
  A retry starts with the receipt journal
&lt;/h2&gt;

&lt;p&gt;DotShare reserves a publication operation before sending requests. It records delivery results and receipts per account, including receipts for individual parts of a thread. Repeating the same request ID lets the caller recover that operation instead of sending a second copy.&lt;/p&gt;

&lt;p&gt;The hard case is a connection drop after a platform accepted the post but before DotShare could confirm it. That case can land in &lt;code&gt;NeedsReview&lt;/code&gt;. I inspect the journal and the destination before deciding what to do next. For a multi-account publish, the journal can show which destinations already received their posts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotshare-agent operation reviewed-release-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Published&lt;/code&gt; records a completed publication. When Dev.to accepts an article sent with &lt;code&gt;published: false&lt;/code&gt;, DotShare records &lt;code&gt;SavedRemotely&lt;/code&gt; and returns the unpublished article’s receipt. &lt;a href="https://github.com/kareem2099/DotShare/blob/master/docs/AGENT_INTEGRATION.md#saved-drafts-draft-preview-and-published" rel="noopener noreferrer"&gt;Publication states and recovery&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the key and the encrypted records separate
&lt;/h2&gt;

&lt;p&gt;The CLI keeps platform tokens in the OS credential store. Linux requires Secret Service. The draft store uses a separate, randomly generated master key, also held in the OS keyring. DotShare uses AES-256-GCM to encrypt the contents of saved drafts, custom templates, and operation journals. Authentication ties each encrypted record to its identity, so a swapped or modified record fails verification.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnajxewkhnp48kje5t8tj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnajxewkhnp48kje5t8tj.png" alt="The OS credential store holds platform credentials and a separate vault key. The vault key encrypts local drafts, custom templates, and publication journals." width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This protects the shared library records on disk. Account labels and other non-secret metadata use private files. The OS credential provider, original images, VS Code’s separate composer drafts, and data held by DotSuite’s cloud backend have their own storage rules. &lt;a href="https://github.com/kareem2099/DotShare/blob/master/SECURITY.md" rel="noopener noreferrer"&gt;Local security model&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I also removed the legacy CLI route that forwarded platform credentials through a relay. The new CLI publishes directly through named accounts. Local image uploads are limited to directories explicitly configured for the MCP server. DotSuite cloud scheduling uses a separate set of connected accounts. &lt;a href="https://github.com/kareem2099/DotShare/blob/master/CHANGELOG.md#cli-300-upgrade" rel="noopener noreferrer"&gt;CLI upgrade notes&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Upgrade and practice a restore
&lt;/h2&gt;

&lt;p&gt;For an existing library, stop active publications, install the current CLI, and run the migration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install -g dotshare-cli
dotshare-agent security status
dotshare-agent security protect
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;protect&lt;/code&gt; verifies access to the keyring, fixes local permissions where needed, and encrypts older plaintext records in place. It reads back each migrated record to verify the original content survived. If the MCP launcher path changed, review the replacement configuration with &lt;code&gt;dotshare-agent setup --dry-run --replace&lt;/code&gt;. After applying it, restart the MCP clients and VS Code, then run &lt;code&gt;dotshare-agent doctor --check-accounts&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For the restore test, I used a disposable library with a draft and a publication receipt. I copied the encrypted files and &lt;code&gt;security.json&lt;/code&gt; to a new directory. A missing key and an incorrect key both caused reads to fail. Restoring the matching test key through the OS keyring recovered the draft and the original receipt. That’s the recovery dependency to plan for: keep the encrypted library and its matching keyring backup. &lt;a href="https://github.com/kareem2099/DotShare/blob/master/SECURITY.md#recovery-and-rotation" rel="noopener noreferrer"&gt;Recovery instructions&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I verified before shipping
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Automated checks.&lt;/strong&gt; 353 tests passed across 33 suites. The CLI and MCP smoke checks also exercised templates, variants, and saved drafts through the installed package.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Upgrade and restore.&lt;/strong&gt; A legacy test draft and receipt survived encryption and could be read back. Repeating the migration had no additional records to convert. The restore test exercised the actual OS keyring with a disposable key.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live publishing.&lt;/strong&gt; One real draft went from Codex to the VS Code library to a public Mastodon post. I verified the saved &lt;code&gt;Published&lt;/code&gt; status and receipt. &lt;a href="https://mastodon.social/@FreeRave/117574826108449747" rel="noopener noreferrer"&gt;Public test post&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Distribution.&lt;/strong&gt; The CLI installed from npm as &lt;code&gt;3.0.0&lt;/code&gt;. The &lt;code&gt;3.6.0&lt;/code&gt; extension was available from Visual Studio Marketplace, Open VSX, and the GitHub release. The DotSuite product page also gained a Docs tab with both guides. &lt;a href="https://www.npmjs.com/package/dotshare-cli" rel="noopener noreferrer"&gt;npm&lt;/a&gt; · &lt;a href="https://marketplace.visualstudio.com/items?itemName=freerave.dotshare" rel="noopener noreferrer"&gt;Marketplace&lt;/a&gt; · &lt;a href="https://open-vsx.org/extension/freerave/dotshare" rel="noopener noreferrer"&gt;Open VSX&lt;/a&gt; · &lt;a href="https://dotsuite.dev/en/product/dotshare/docs" rel="noopener noreferrer"&gt;DotSuite docs&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you try the workflow, I’d like to know which part of your own publishing process you’d keep in the editor. Account variants and review steps are especially interesting because teams often handle them differently. &lt;a href="https://github.com/kareem2099/DotShare" rel="noopener noreferrer"&gt;DotShare on GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I used AI assistance to draft and edit this write-up. The implementation, release checks, and live test are linked above.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>security</category>
      <category>opensource</category>
      <category>vscode</category>
    </item>
    <item>
      <title>Building DotShredzilla (Part 1): The Best Sign-In Screen Is the One You See Once</title>
      <dc:creator>freerave</dc:creator>
      <pubDate>Thu, 12 Nov 2026 18:53:14 +0000</pubDate>
      <link>https://dev.to/freerave/building-dotshredzilla-part-1-the-best-sign-in-screen-is-the-one-you-see-once-2oaf</link>
      <guid>https://dev.to/freerave/building-dotshredzilla-part-1-the-best-sign-in-screen-is-the-one-you-see-once-2oaf</guid>
      <description>&lt;p&gt;A sign-in screen has an odd job. It's the first thing every new user sees, and the thing a returning user should never see again. Someone opening a workout tracker between sets wants their training, not a login form.&lt;/p&gt;

&lt;p&gt;So before redesigning anything, I rebuilt what sits between launching DotShredzilla and seeing your training: signing in, deciding which screen to open, and loading your history.&lt;/p&gt;

&lt;p&gt;DotShredzilla is an Android workout tracker from &lt;strong&gt;FreeRave (DotSuite)&lt;/strong&gt;, written in Kotlin with Jetpack Compose and Firebase, and open source under &lt;strong&gt;Apache License 2.0&lt;/strong&gt;: &lt;a href="https://github.com/kareem2099/Shredzilla" rel="noopener noreferrer"&gt;github.com/kareem2099/Shredzilla&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  One sheet for every way to sign in
&lt;/h2&gt;

&lt;p&gt;The app used the old Google Sign-In SDK, which Google has deprecated. It also needed an &lt;code&gt;ActivityResultLauncher&lt;/code&gt; in &lt;code&gt;MainActivity&lt;/code&gt;, so the activity, the launcher callback and the navigation code all had to know about each other.&lt;/p&gt;

&lt;p&gt;I moved to &lt;strong&gt;Credential Manager&lt;/strong&gt; (&lt;code&gt;androidx.credentials&lt;/code&gt;). It shows one system bottom sheet that offers both the user's Google accounts and the passwords saved for the app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;googleIdOption&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;GetGoogleIdOption&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Builder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setFilterByAuthorizedAccounts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filterByAuthorizedAccounts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setServerClientId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;activity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;R&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;default_web_client_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setAutoSelectEnabled&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filterByAuthorizedAccounts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;GetCredentialRequest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Builder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addCredentialOption&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;googleIdOption&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addCredentialOption&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;GetPasswordOption&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;isAutoSelectAllowed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;filterByAuthorizedAccounts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sign-in tries twice, and the order matters:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Returning users first.&lt;/strong&gt; Only accounts that already used the app are offered, and if there is exactly one, it's picked automatically. For most people, signing in again is one tap or none.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Everyone else.&lt;/strong&gt; If nothing was found (&lt;code&gt;NoCredentialException&lt;/code&gt;), the same request runs again with every Google account on the phone.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Whatever the user picks, the result becomes a Firebase sign-in. A Google ID token goes through &lt;code&gt;GoogleAuthProvider&lt;/code&gt;. A saved password goes through Firebase's email and password sign-in, so the sheet works for accounts that never used Google at all.&lt;/p&gt;

&lt;p&gt;The best part was what disappeared. Sign-in is now one function that a coroutine can call from anywhere:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="n"&gt;suspend&lt;/span&gt; &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;signInWithGoogle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Result&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;FirebaseUser&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No launcher, no activity callback, and no navigation code inside &lt;code&gt;MainActivity&lt;/code&gt;. Closing the sheet comes back as a failure the UI quietly ignores, because cancelling isn't an error worth a toast.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two taps, two requests
&lt;/h2&gt;

&lt;p&gt;On a slow connection, tapping "Create account" twice sent two sign-up requests. The first created the account. The second failed with "email already in use", so a brand-new user saw an error about the account they had just made.&lt;/p&gt;

&lt;p&gt;The fix is a lock that's set &lt;strong&gt;before&lt;/strong&gt; anything asynchronous starts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="n"&gt;onRegisterClick&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;isLoading&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;@&lt;span class="nc"&gt;RegisterScreen&lt;/span&gt;  &lt;span class="c1"&gt;// double-tap guard&lt;/span&gt;
    &lt;span class="n"&gt;isLoading&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;                      &lt;span class="c1"&gt;// set synchronously, before launch&lt;/span&gt;
    &lt;span class="n"&gt;scope&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;launch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="c1"&gt;// navigate or show the error&lt;/span&gt;
        &lt;span class="n"&gt;isLoading&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The order is the whole point. Setting &lt;code&gt;isLoading&lt;/code&gt; inside the coroutine leaves a gap where a second tap still gets through. Set on the main thread, in the click handler itself, the second tap sees the lock immediately. The same flag disables the fields and swaps the button for a progress indicator, so the screen also shows that something is happening.&lt;/p&gt;

&lt;h2&gt;
  
  
  Opening on the right screen, without a flicker
&lt;/h2&gt;

&lt;p&gt;Every launch has to answer one question: where does this person belong? The answer can be the login screen, the first unfinished onboarding step, or the main app.&lt;/p&gt;

&lt;p&gt;The old code answered it twice, in &lt;code&gt;MainActivity&lt;/code&gt; and again in the navigation file. The app always started on the login screen and then jumped elsewhere from a &lt;code&gt;LaunchedEffect&lt;/code&gt;. You could see the login screen flash before the jump, and the back stack sometimes kept screens that shouldn't be there.&lt;/p&gt;

&lt;p&gt;Now the &lt;code&gt;MainViewModel&lt;/code&gt; works out the destination once, and the navigation graph &lt;strong&gt;starts&lt;/strong&gt; there instead of jumping:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="c1"&gt;// MainViewModel&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;startDestinationFlow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;savedStateHandle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getStateFlow&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;?&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"startDestination"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// MainActivity&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;startDestination&lt;/span&gt; &lt;span class="n"&gt;by&lt;/span&gt; &lt;span class="n"&gt;mainViewModel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;startDestinationFlow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;collectAsState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;startDestination&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;let&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;AppNavigationHost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;navController&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;startDestination&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keeping it in a &lt;code&gt;SavedStateHandle&lt;/code&gt; means the decision survives process death. If Android kills the app in the background, it comes back where it was instead of running the whole check again. On sign-out the saved destination goes back to the login screen, so a restored process can't land a signed-out user inside the app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Loading history in parallel
&lt;/h2&gt;

&lt;p&gt;Exercise history and the progress charts need the last 90 days of logged sets. Firestore stores them per day, so loading meant one request for the list of days and then one request per day, one after another. On a weak mobile connection that was 90 round trips in a row.&lt;/p&gt;

&lt;p&gt;The requests don't depend on each other, so they can run at the same time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;sets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;dayDoc&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class="k"&gt;async&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Dispatchers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;IO&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;dayDoc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reference&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"recordedSets"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;awaitAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The chart calculations then run on &lt;code&gt;Dispatchers.Default&lt;/code&gt;, so neither the network nor the math touches the main thread.&lt;/p&gt;

&lt;h2&gt;
  
  
  A small cleanup with a big effect
&lt;/h2&gt;

&lt;p&gt;The login and register screens each had their own copy of the text field colors, slightly different from each other. Changing the accent color meant finding both. They now share one definition.&lt;/p&gt;

&lt;p&gt;That was a two-minute change, but it turned into a rule for the next part of this series: no screen gets its own private copy of a component.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd tell myself before touching sign-in
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Make sign-in a &lt;code&gt;suspend&lt;/code&gt; function that returns a &lt;code&gt;Result&lt;/code&gt;. The UI and navigation get much simpler when they don't have to know about activity callbacks.&lt;/li&gt;
&lt;li&gt;Lock a button in the click handler, not inside the coroutine it starts.&lt;/li&gt;
&lt;li&gt;Decide the start destination once, in one place, and start there. Don't start somewhere else and jump.&lt;/li&gt;
&lt;li&gt;Test on a slow connection. Every bug in this part only showed up there.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sign-in wasn't finished with me, though. Much later, users who had signed in once were sent back to the login screen every time they opened the app, and none of the code in this article was the cause. That story comes later in the series.&lt;/p&gt;

&lt;p&gt;Part 2 covers what came next: rebuilding every screen around one glass design system with two palettes.&lt;/p&gt;

&lt;p&gt;How does your app decide which screen to open on launch?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Google Play:&lt;/strong&gt; &lt;a href="https://play.google.com/store/apps/details?id=com.FreeRave.shredzilla" rel="noopener noreferrer"&gt;DotShredzilla&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="https://github.com/kareem2099/Shredzilla" rel="noopener noreferrer"&gt;github.com/kareem2099/Shredzilla&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project:&lt;/strong&gt; &lt;a href="https://dotsuite.dev" rel="noopener noreferrer"&gt;DotSuite&lt;/a&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>kotlin</category>
      <category>firebase</category>
      <category>jetpackcompose</category>
    </item>
  </channel>
</rss>
