Skip to content

Build1 publisher3 min readPublished

Three agent rounds chased a caption offset that a 1080x1920 constant already answered

In one developer's account of a WYSIWYG caption tool, the editor-to-render scaling ratio was built from a browser element measurement and a probe of a downscaled preview proxy, while the real target frame sat in internal/reel/timing.go.

The Engineer · Build desk

Illustration accompanying Three agent rounds chased a caption offset that a 1080x1920 constant already answered

What happened

  • A developer building caption drag-and-drop in keryx's studio, a WYSIWYG editor sitting over a video renderer, went three rounds with an AI assistant and still got captions in the wrong place.
  • Each round fixed one defect and raised another: jumping text boxes, then a preview font size with no fidelity to the render, then alignment right vertically and wrong horizontally.
  • The code computing render size never read the real target size, which was seven lines into internal/reel/timing.go as Width 1080 and Height 1920.

Compiled by The EngineerSomething wrong?How this is made

Why it matters

  • cost Verifying each attempt cost a full encode: the author rendered a real reel, watched it back and wrote down what was still off, so a wrong geometry assumption is paid for in video minutes.
  • decision Reviewing generated geometry code starts with asking where each side of the ratio gets its number, before anyone checks the multiply.
  • constraint An assistant handed requirements and left to find the frame size on its own will choose one, and measuring something downstream is the choice available to it.

Vertical correct and horizontal wrong came out of the same code doing the same arithmetic on a different axis [5]. "Maths errors don't pick a favourite axis," the author wrote [5]. So the two axes were being fed different numbers, and by his account each dimension collected its own rounding on the way in [12].

Both ends of the ratio were measured [6]. The preview number came from asking the browser how big the element had ended up, and what the browser hands back carries an undocumented rounding decision on top of sub-pixel layout and device pixel ratio [6][8]. The render number came from probing the encoded video file [6]. That file was a scaled-down proxy built for the preview, so the probe returned the proxy's dimensions plus whatever the encoder decided about even numbers [7].

The number the encoder was actually given sat in the repo, seven lines into internal/reel/timing.go, as Width = 1080, Height = 1920, FPS = 30 [9]. The block is commented for parity with gen-reel.py, so the same geometry lives in a Go constant and a Python script [10]. The code working out how big the render would be never consulted the values the team defined and passed to the encoder [11].

Read the constant and the ratio has one measured input left instead of two [20]. The one that remains is the editor element, and it has to be measured, because that is the surface the user drags on. 1080 by 1920 is 9:16 [19]. When the editor panel holds that aspect, I would expect a single scale factor to cover both axes. That removes the failure mode where one axis lands and the other misses.

This is one developer's post about one feature, so treat the three failed rounds as an account rather than a measurement [2]. For the lesson to carry into another codebase, an authoritative constant has to exist somewhere a reviewer can point at. A pipeline that takes frame size from a CLI flag or a job record has no line to read, and the contract then has to reach the model from whichever record owns it.

The author had built the same thing by hand years earlier at an agency, in JavaScript after refusing Flash, using absolute positioning and a scaling ratio, and it took a couple of days [15]. He had known the technique for close to twenty years [16]. Familiarity is why this one went out without a spec. "Laziness, mostly, and I'll own that one," he wrote [17], and says the handover was a list of requirements, full stop [18]. The rule he draws from it: "when a value is defined by your own code, don't go re-deriving it by measuring something downstream... read it" [13]. He reports the fix has held since [14].

What to watch

  • Whether the geometry moves into one shared definition, so the Go constants and gen-reel.py cannot drift apart.
  • A second account of the same failure from a different codebase would move this from one developer's story toward a pattern.
  • How the same contract is passed when frame size comes from a CLI flag or a job record instead of a compile-time constant.
Loading claim ledger
Loading source directory links
Loading share composer
Loading topic controls
Loading related stories