devops
Technical notes on web development, DevOps, and AI integration.
114 articles
- 07:25backend
A GET-Only Door for External Data
A read-only API gateway for external data: env-JSON allowlist, Redis cache, static error bodies, and 20 offline tests behind one GET-only door.
TL;DR: Rather than expose upstream API credentials in the browser, the author built a small FastAPI read-only gateway for KotaPortal's feeds. It allows GET only via per-source allowlists, caches JSON in Redis with clamped TTLs, and hides upstream errors. All 20 tests run offline; the one gap is a missing Allow header on 405 responses.
#fastapi#redis#httpx - 18:06backend
Official Docs Drift, the Generator Fails Loud
When a documentation generator ingests reports it does not own, tolerant parsing ships truncated pages. Explicit markers plus a throw keep drift visible.
TL;DR: When a report team's HTML restructure broke the generator's extraction markers, the author chose fail-fast over tolerant parsing, because catching and skipping just turns failure into silence. Now missing markers or media halt the build with clear errors. Official documents also get top sidebar placement, backed by eyetracking data on above-the-fold attention.
#nodejs#documentation#generator - 17:54frontend
Menu Toggle Did Nothing: The One-Attribute defer Fix
Tap the hamburger, nothing happens, console clean: the click bindings ran before the DOM existed. The fix is one attribute on the script tag.
TL;DR: On first deploy, the mobile drawer's hamburger button was dead, with no console errors to hint why. The culprit: app.js ran from head before body elements existed, so null guards silently skipped the bindings. Adding defer to the script tag in the generator template fixed every page after one rebuild.
#javascript#css#documentation - 15:42devops
Three Red Commits That Must Not Be Rewritten
A new checker gate flagged three old index commits for a missing Task trailer. Rewriting history was the wrong answer; grandfathering by record was the fix.
TL;DR: Three regen commits to COMMITS.md failed the new Task: trailer gate because they predate the rule. Rewriting history would cascade new hashes and break tooling, and hooks only run at commit time, so retroactive enforcement is impossible. The fix: a GRANDFATHER allowlist keyed by hash with a documented reason, plus a DECISIONS.md rule for all future index commits.
#git#hooks#commit-convention - 00:44frontend
Why Popular Video Cards Have No Thumbnails
Popular marquee cards checked explicit thumbnails, leaving video items on gradients. Fix: explicit thumbnail → i.ytimg hqdefault → gradient. hqdefault always exists for public videos.
TL;DR: Video items showed a gradient placeholder. A fallback chain was added to display thumbnails. It uses YouTube's image CDN for video thumbnails.
#frontend#performance#nextjs - 00:36frontend
Why the "Popular" Marquee Across Three Pillars Looks Empty — and How to Fill It
Marquee populer 3 pilar (olahraga/kebudayaan/kepemudaan) kosong di pilar muda. Fix: parallel fetch popular + random, mergePopularWithRandom dedupe by id, popular priority, slice 9.
TL;DR: KotaPortal's marquee looked half-empty. Server-side parallel fetch and merge dedupe fixed this. Young pillars now display 9 items.
#frontend#performance#nextjs - 00:28backend
Why "Popular Articles" Stay Stale — and How to Fix It with a 7-Day Rolling Score
Query sort=popular used total view_count so old articles always won. Fix: 7-day rolling score from entity_view_daily + deterministic tiebreak + random filler limit 9.
TL;DR: The "Popular Articles" section showed outdated items. A 7-day rolling score was implemented to fix this. Old articles no longer always rank highest.
#database#performance#mysql - 20:49backend
One Upload Limit, Four Layers
An 8 MiB upload cap is not one setting. FastAPI never rejects big files; the real gates are the browser, nginx, and Next.js.
TL;DR: An 8.5 MiB upload stalled silently, and debugging showed the FastAPI backend wasn't the culprit. Instead, size limits hide across the whole stack: browser Blob.size, nginx's client_max_body_size, and Next.js's bodySizeLimit, which counts multipart overhead rather than just the file. Consistent enforcement means aligning one limit constant across all four layers.
#file-upload#nginx#fastapi - 19:55devops
Remapping Evidence Hashes After a Git History Scrub
Commit hashes change in bulk when git history is rewritten. Remap Bukti evidence references via commit-map, including zero-hash handling.
TL;DR: A PII history rewrite silently killed seven commit hashes stored as evidence on an issue board. Rewriting any commit changes its hash plus every descendant's, and only the commit-map file from git filter-repo reliably maps old hashes to new ones. Fix it by remapping and verifying each hash, then store future evidence as tags or exported mappings.
#git#git-filter-repo#commit-map