Skip to main content

Blog

Thoughts, tutorials, and insights on development, technology, and more.
Media engineeringReact and TypeScriptAI and retrievalDjango backendPython automationDevOps and reliability

Pass a local file safely across an Electron boundary

An Electron renderer that needs to inspect one chosen video does not need unrestricted filesystem access. Let the main process own file selection and return an opaque identifier. A narrow preload method can request one operation with that identifier while the main process validates the request.

Choose an encoder fallback when hardware encoding fails

An encoder name in a capability list does not prove that an encode can run. Driver state, device access and input format can still make a hardware attempt fail. Choose a fallback after observing the actual attempt, and keep the failed output separate from anything presented as a finished export.

Preserve aspect ratio when exporting a vertical clip

A landscape frame stretched to fill a vertical canvas changes the shape of every face and object. Choose whether to preserve the whole frame with padding or fill the canvas by cropping. Those choices have different visual costs, so expose the choice before an export runs.

Keep video segments within a declared duration policy

Scene changes rarely fall at perfectly convenient clip lengths. An export policy needs to say how short a clip may be, how long it may be, and what happens when the remaining tail is too small. Write those decisions before selecting scene boundaries so that a final merge does not silently break the maximum duration.

Inspect a video file with ffprobe before processing it

Probe a media file before choosing an encoding plan. A filename ending in `.mp4` does not establish that the file contains a usable video stream, a known duration or the dimensions an export workflow expects. Treat the probe result as input that still needs validation.

Check public asset paths after deploying under a subpath

An application that works at `/` can break when hosted at `/demo/`. A generated script path such as `/assets/main.js` points to the origin root, while the deployment may serve assets only below `/demo/assets/`. Inspect generated URLs and proxy rewriting together before assuming that a missing asset is a build failure.

Practice a release rollback with an explicit schema boundary

A code rollback can fail when the database has already changed in a way that the older release cannot read. Write the compatibility boundary before deployment: which application revisions can use the new schema, and which data transformations would be difficult to reverse?

Trace a request across API and worker boundaries

A background failure is easier to investigate when its log can be connected to the request that queued it. Generate a correlation identifier at a trusted boundary, carry it with the job, and include it in structured worker logs. Keep the job identifier separate so that several jobs from one request remain distinguishable.

Return a real 404 for a missing application route

An error screen displayed inside an HTTP 200 response tells the browser and other clients that the request succeeded. For a missing public article, return a real 404 status with the useful error page. Check this at the public route, because frontend rendering and reverse-proxy fallbacks can disagree.

Keep deleted URLs out of an XML sitemap

An XML sitemap should follow the content that remains public and indexable. When an article is deleted or returned to draft, a manually maintained sitemap can keep advertising an obsolete URL. Generate entries from the same publication rules used by public routes, then test those rules with a small fixture.

Serve meaningful HTML before React loads

A useful initial HTML response gives a reader the article or project description before the JavaScript bundle arrives. It also makes failures easier to inspect: a slow script download can leave readable content instead of an empty root element. Compare the actual response body with the browser's later DOM when diagnosing a client-rendered page.

Schedule a maintenance command with a systemd timer

A scheduled maintenance command needs a visible exit status and a place to inspect its output. On a Linux host that uses systemd, a service unit can describe the command while a timer unit describes when to start it. Keep the command harmless during the first scheduling exercise.