swan tron dot com

Difftron: Only Grade the Diff

Every repo I’ve worked in has a coverage number. Ours says 84%. It’s said 84% for about a year.

Someone opens a PR, adds a hundred lines with no tests, and the number drifts from 84.1% to 83.6%. Nobody blocks a PR over half a percent.. you’d look insane. So the untested code walks right in, the number stays put, and six months later “84%” is sitting on a growing pile of stuff nobody ever tested.

Grade the Diff

Stop grading the whole repo. Grade the lines this PR changed. It’s called patch coverage, and Codecov and friends have done it for years. I wanted a version that was dead simple, didn’t care what language you write in, and never sent anything off the runner.

difftron is a small Go CLI wrapped as a GitHub Action. Point it at an LCOV, Cobertura, or Go coverage file, and it diffs against the base branch and grades only the changed lines:

- uses: swantron/difftron@v1
  with:
    coverage: coverage/lcov.info
    threshold: '80'

You get a sticky PR comment with the uncovered line numbers, and a failed check if you’re under the threshold. Or it just comments, if you set fail-on-error: false while you ease into it.

Dogfooding

I dropped it onto six of my own repos in an afternoon.. Go tools, a couple of vitest apps, two that needed c8 to turn node --test into an lcov file. Same four lines of yaml every time.

On tronswan I planted a tested function next to an untested one and opened a throwaway PR. difftron graded the 15 changed lines.. 1 covered, 14 not. The project-wide number barely moved.

difftron sticky comment on a tronswan PR: 6.7% changed-line coverage, uncovered line numbers listed, test file skipped

v1 had a great bug: it failed a docs-only PR. Edit a README, there’s no coverage data for markdown, difftron reads that as 0%, PR fails. Instant uninstall. Now files with no coverage signal get skipped instead of failed, and the comment tells you which ones.

Marketplace: Difftron Delta Coverage Gate

Source: github.com/swantron/difftron

Watchtron: Did the Deploy Actually Work?

I sort of wound up with a formidable little fleet of sites.. tronswan, chomptron, swantron, mt, wrenchtron, jswan.dev. The DevX dawg in me naturally wanted to know if they were up.

So I wrote the dead simplest thing that could tell me. uptime-monitor is 234 lines in one file.. a GitHub Actions cron that pings every site every 5 minutes and writes uptime to a public gist. No VM, no terraform, $0. It only tips over when GitHub tips over. I’d build it the same way again.

But it can’t tell me whether a deploy worked. Every deploy hands me a green checkmark, and the checkmark just means the pipeline exited 0. A HEAD / coming back 200 can be a CDN handing you a cached page while the app behind it is face-down. A pinger falls for that too.

OTel, Backwards

Usually you instrument with OpenTelemetry so you can stare at dashboards after something breaks. I flipped it around. Right after a deploy, fire some synthetic traffic at the live URL, tag every request with a trace id, and check that the telemetry for that exact run shows up. If it does, the request made it all the way to the real app.. not a cache, not a stale instance. If it doesn’t, or it’s slow, the deploy fails.

watchtron is a prober, a tiny control plane on a free-tier GCE e2-micro, and a reusable workflow any repo can call after its deploy job:

verify:
  needs: deploy
  uses: swantron/watchtron/.github/workflows/verify.yml@main
  with:
    service: tronswan
    version: ${{ github.sha }}
  secrets:
    otlp_endpoint: ${{ secrets.WATCHTRON_OTLP_ENDPOINT }}
    token: ${{ secrets.WATCHTRON_TOKEN }}

The fleet is all over the place.. DigitalOcean, Cloud Run, GitHub Pages, Firebase, a self-hosted PDS.. and one workflow covers all of it. The two Express apps I actually own also report back their own span and git SHA, so watchtron can tie the response to the probe and confirm the build that answered is the one that just shipped. Green means this build is serving, not just something.

Two Tools, One Strip

I started bolting history and dashboards onto watchtron and caught myself rebuilding the uptime monitor, worse. So I quit. The pinger is the heartbeat, watchtron is the deploy gate. Instead of competing, they share a chart: one strip per site, green up, red down, little triangles where deploys landed.

watchtron dashboard: per-service uptime strips with verified-deploy markers

It’s up at watch.swantron.com, with a cleaner cut on tronswan.com/status.

The dashboard paid for itself right away: its staleness flag noticed watchtron’s own cron had gone quiet. GitHub disables scheduled workflows after ~60 days without a commit. The uptime monitor has a dirty keepalive for exactly this. watchtron’s cron.. did not.

Source: github.com/swantron/watchtron

Shrinking third-party containers without touching a Dockerfile

Our ProdSec team at work recently leaned hard into Wiz and Slack-ops. Vulnerabilities started piling up across our various namespaces, a lot of them flagged critical on paper.. typical enterprise scenario where dashboards are red and every alert demands a response.

The catch: most of those images aren’t ours. We’re DevX, which sits inside CloudOps alongside Platform Engineering, SRE, and Cloud Cost.. a big part of what our org does is run the infrastructure that makes the clusters work. Wiz, Datadog agents, observability tooling, a bunch of GitOps stuff. Closed source, proprietary, not ours to rebuild. But they live in our namespaces, so we own the vuln count. Anything legacy or shared comes along for the ride too.

Coworker bud and I started talking about what you’d actually do about this. You can’t patch a binary you don’t ship. You can’t swap the base image. The vendor updates when they update. The realistic options are: accept the noise, get exceptions granted, or get creative.

Moment of clarity: what if we just… axe the parts that aren’t running?

Trace What’s Actually Used

A typical third-party agent image is built for maximum compatibility. Shells, package managers, debug utilities, man pages, and a pile of shared libraries for features nobody in your environment uses. Hundreds of megabytes, and every one of those binaries is something for the scanner to yell about.

Rebuild the image from scratch with only the files the container actually touches at runtime, and the agent still pongs.. but the shell is gone. So is the package manager. So is most of what the scanner was complaining about.

So I Built Something

minifier-cli is a Go tool that does exactly this.

1. Trace. Run your container through the tool and it watches which files the process opens and maps into memory, polling /proc inside the container every second.

minifier-cli trace start --image datadog/agent:latest --name dd-prod
# Let it run in a production-like environment
# Ctrl+C to stop tracing

2. Repackage. It walks every binary in the trace for the shared libraries it needs, adds the handful of files everything quietly relies on (passwd, hosts, resolv.conf), copies it all out, and builds a FROM scratch image with the original ENV, CMD, and ENTRYPOINT.

minifier-cli repackage --name dd-prod --output datadog-minimal:prod

nginx:alpine goes from 91.7MB to 14.1MB. A startup-only trace of datadog/agent:latest takes it from 1.17GB to 59MB. The vuln scanner suddenly has a lot less to say.

minifier-cli terminal output: trace, repackage, and docker images before and after

How It Ended Up

We eventually landed on a different solution for the actual hardening problem.. we are basically buying pre-hardened images that someone else has already performed surgery on. With vendor backing and security buy-off, we are somewhat less culpable.

Still, it’s a handy way to find out what a black-box container actually needs at runtime.. for hardening, audits, or poking at a legacy app before you migrate it. Open-sourcing it on the theory that someone else has the same problem.

Fair warning: the image only has what got touched during the trace. Error paths, plugins, and config-flag-only drivers won’t be there unless you exercised them. Run your integration tests while tracing, trigger your error states, test it in staging, and keep the original around. Don’t ship it on the strength of a five-minute trace and a curl localhost.

Binaries on the releases page. The tracer needs Linux; the repackager runs fine on a Mac.

Source: github.com/swantron/minifier-cli

The Covid Bike: 3,500 Rides Later

I wasn’t a spin dude before Covid, and I still don’t really claim to be now. In 2020, the world sort of shut down, I went remote and lost my gym at Workiva. Katie bought us a Peloton early in the pandemic, and we’ve spent the last six years trying to break the thing.

We finally succeeded. I guess we’re spin dudes.

The resistance started jumping around and acting erratic a few weeks ago. Peloton support tried to tell me I needed a technician to install a new monitor cable. No on the tech, and sensor cable in the mail. I got antsy and contacted support the following day, and was able to talk them into selling me the sensor board.. again declining the tech after repeatedly acknowledging I would void my five year lapsed warranty.

Peloton resistance sensor board and cable assembly

Some Stats

I was curious what the “odometer” actually looked like after six years. Since this is an early bike, I had to manually pull the numbers from our profiles:

  • jswan: 1,825 rides + 209 Bootcamps
  • kt: 1,505 rides
  • Total: 3,539 sessions

I do enough 45-minute rides to offset the short 10-minute add-ons, so this hardware has easily seen 2,000+ hours of work. Honestly, one sensor board failure after that much volume is less of a defect and more of a badge of honor.

The Swapperoo

Two items..

Peloton order history showing monitor cable April 9 and sensor assembly April 10

The swap is dead simple. Remove the sweat guard, untuck wires, remove the sensor, replace the sensor, tuck wires, CALIBRATE, replace sweat guard. Phillips screwdriver and a hex set. Navigating to the calibration mode using the wonky Peloton UI arguably took me more time than the swap.

A Few Takeaways

If you have an old Original bike and you’re actually putting miles on it:

  • Don’t bite on the tier 1 support advice: If the resistance is jumpy but the screen works fine, it’s the sensor board. Skip the monitor cable.
  • Recalibrate: New sensors mean the bike might feel “heavy” or “light” compared to your old PRs. Run a calibration kit to level it out.
  • Check Pedals: We are pushing it with 3,500 rides, the bearings are still decent but on borrowed time.

The bike is a beat-to-shit but back in the rotation. It’s a tank..

242

Super Mario Galaxy 2 dropped a billion years ago. Simpler times. The Wii was so much fun.. Sunshine was perfect and somehow Galaxy was better. Galaxy 2 was not better for me.. it was a game I dropped and I do not do that. I think I got around 80 stars and dropped it. I don’t quit books and finish the games I go in on. Weird stuff.. life happens.

My gaming setup is pretty straight forward. I’m a Nintendo guy, exclusively. We play family stuff docked, and I roll through Zelda and Mario stuff when I travel or when I need a break from projects. I have a short list of games I replay.. OoT on the 3DS, 3D All-Stars, BotW, TotK. I’ve had stints with Splatoon and Red Dead, but it is mostly Zelda and Mario. I beat the shit out of my Switch Lite between work travel to the Midwest, work from home acclimation, and then again on work trips to the Bay. It is my walking the dog mental reset after the dog is walked, I suppose

242 stars

Here we are in 2026. Katie bought me a switch before my last onsite, so I’ve done my lap through the regulars. Odyssey as well.. it is better after some time away. Nintendo definitely had me profiled with the Switch version of Galaxy 1 / 2.. I was 30 stars into Galaxy 2 when it dropped, so did a quick pivot and started on the new console (handheld, obvs.) I did the main runthrough, and picked up Galaxy 2 out of muscle memory. It finally clicked.

Maybe the second playthrough of Odyssey had me primed for a grind, or maybe I’m just older and more patient. Galaxy 2 makes it super easy to be directly in the middle of a challenging platform situation, but not feel frustrated. The levels are fun, so it isn’t a pain in the ass. The final stars were honestly brutal.. it was an endurance test.

Long story short, it is a 10/10. Best platformer I’ve played.. it took me 16 years to finish, but worth it.

Wrenchtron

Kendall Ford in Bozeman books out three months. I have a 2021 F-150 under powertrain warranty.

Those two facts are incompatible, so I’ve just started doing everything myself.

I was already servicing most of the fleet at home.. RZR, old wheeler, mower on its last leg, a snowblower. DIY is usually faster and cheaper, and to be honest fun. The warranty situation just made it urgent to actually document everything, and a glovebox full of Costco receipts wasn’t going to cut it.

I’m running Kirkland 5W-30 and buying OEM filters at the parts counter.. best of both worlds for the warranty. But I need those receipts attached to a log entry to make any of it mean anything. Spreadsheets fall apart once you have a few vehicles on different schedules, and I’m not about to use a spreadsheet in the first place. OBD apps don’t know what a snowblower is.

So I built Wrenchtron.

2017 F-150 Platinum.. service status and maintenance history

Every entry gets photos and the receipt, so the Costco receipt lives next to the oil change it paid for. Intervals can be miles, time, seasonal, calendar month, or whichever comes first.. 5k miles or 6 months for the oil. One screen shows what’s overdue and coming up across the whole fleet, and it pulls open NHTSA recalls by VIN. Works offline.

Maintenance Hub.. cross-fleet schedule at a glance

Under the Hood

Next.js 15 static export, Tailwind CSS v4, Firebase for auth, Firestore, and Storage, with @serwist/next handling the PWA layer. No server, no API routes.. everything runs in the browser, security lives entirely in Firestore rules. GitHub Actions runs tests on push and deploys to Firebase Hosting. Pipeline is a few minutes start to finish.

The garage

Live: https://wrenchtron.com

Demo (no login): https://wrenchtron.com/demo

Source: https://github.com/swantron/wrenchtron

The Midi

NYT_Games: check it out.. new daily crossword.. the ‘Midi!’

NYT Games - The Midi

jswanson: welp, there goes another four minutes of my day

Completed Midi puzzle grid

NYT_Games: huzzah!

Solved the Midi in 2:15

jswanson: s/four/slightly over two/

Self-Hosting a Bluesky PDS

I’ve been sitting on a Bluesky Personal Data Server (PDS) for a few months now. A few of my privacy-nerd friends were asking if anyone had tried to set one up, and I like setting stuff up, so I did. Finally getting around to documenting the thing.

Why Bother

On Twitter or Facebook your data lives on their servers. The AT Protocol lets you run your own server instead.. your posts, follows, and media live there, and you can move without losing your identity. Basically how email works. Gmail or your own mail server, you can still email anyone.

Bluesky started sidling away from their open stance a bit, my friends got nervous, so here we are.

My Setup

I set up a PDS at jswan.dev on a $6 DigitalOcean droplet. The official Bluesky installer handles most of it.. Docker, Caddy for TLS, gets everything running. The main work was DNS (an A record for the root, a wildcard for subdomains) and clicking through the installer prompts.

Once it was up, I created an account: @com.jswan.dev. Handle format is username.yourdomain.com.

There wasn’t a decent start-to-finish guide when I did this, so I wrote one: bluesky-pds-guide. Domain, droplet, DNS on a few different registrars, email, upkeep. Writing it forced me to make the process reproducible. Hopefully it saves somebody some debug time.

All in, it’s around $100 a year: the domain, the droplet, and email I was already paying for.

I Don’t Really Use It

I’ve set up this whole infrastructure, and I’m not really posting on social media. Not my thing.

That’s fine. The point was learning how federated protocols work and having the infrastructure if I want it. If friends want accounts, I can give them invites. The data lives on my server, even if that data is currently just me posting a sweet link to a swantron blog post once every three months.

Update, Nov 25: moved it off DigitalOcean to a free-tier Google Cloud VM. Same handle, same data, cheaper.

WordPress to Hugo Migration

This is the first time in decades I haven’t had a WordPress instance live. Lordamercy…

Deleting WordPress site - final step

WP Trucker Logs

Over two decades, swantron.com hopped through most of the hosting trends. Shared hosting on Siteground. Then VMs and databases.. EC2 and RDS, then GAE and not RDS. Then Dockerized one-click pets, a little on GCP but mostly DigitalOcean.

Every one of those was just a different way of babysitting a server. Now it’s Hugo and GitHub Actions, and there’s no server to babysit.

The Database

I had a shower thought about how gross a WordPress database might end up after being left out in the rain for 20 years (2005-2025). I finally checked. My final database dump: 34MB and 555,947 lines of text.

SQL file size - 555,947 lines

  • 122,307 references to bouncerblog.com.. a domain that died over a decade ago.
  • Serialized PHP arrays stored as strings. Want to change a simple rewrite rule? Nope. Good luck parsing a 2,000-character string in wp_options.
  • Thousands of _transient entries and orphaned plugin settings that WordPress autoloads on every single page request, long after the plugins are deleted.

The database had become a dumpster fire. Markdown files are nice. No more regex-searching a SQL dump just to find a setting.

The Migration

Moving a thousand-plus posts is a special kind of hell. I wanted to strip the ugly legacy /index.php/ prefix off my URLs without breaking 20 years of external links.

I wrote some dirty Python to fill in Hugo’s aliases field and map the shitty legacy paths to the new clean ones:

title: "This Old Post about Hot Sauce"
slug: "this-old-post-about-hot-sauce"
aliases:
  - /index.php/2005/10/10/this-old-post-about-hot-sauce/

Alias example in frontmatter

Hugo generates redirect pages at the old paths during the build. Every bookmark (yeah right), share, and search result still lands.

The New Stack

Hugo, with the Paper theme and my own layout overrides on top. GitHub Pages and Actions for hosting. It’s free, there’s nothing to patch, and the URLs are sane. No comments, because I’m not collecting feedback from blog commentators.

I write Markdown, I git push, and it’s live.

It feels like the OG blogging days again. We had CMS shit back then, but blogging was largely just writing and publishing. SEO made things weird for a bit (paid posts… did that) and we tried to mash PHP junk onto all sorts of places for no particular reason. The CMS never really got better, and blogs sort of died under their own weight.

In a way, I’m jumping back in with the terminal Gs who never bothered down this path in the first place. They’ve been over there in their minimal setups, posting random shit about obsolete tech this entire time, while the rest of us were fighting database corruption.

Cowbot - The migration buckaroo

Here’s to another decade. Cattle, not pets.

vinnila

12 year old provided bath bomb to 14 year old

(12 year old is in the ET program and was the 6th grade spelling bee runner up)