jakob.s
← Selected Work
Case Study · Compiler · Source public

Storefront Builder

Artists sell commissions from pages they host on Markdown paste sites. They do not know Markdown, so they pay someone who does. This turns that into a compiler problem: a block document in, host-correct Markdown out, with a warning for every compromise made on the way.

TypeScriptZero runtime deps Golden-file testsVitest axe-coreOffline PWA Capacitor / AndroidVerified on device
What it is, for the people who use it. Use it here, and read the source at github.com/JakobS1900/markdown-storefront-builder. The engine is a few hundred lines of pure functions with no dependencies. Every architecture review and every bug it caught is committed alongside the code, including the ones that make me look slow.
A recorded session: opening the template picker, choosing Art commissions, opening the Prices section, typing a new price, the preview beside it catching up, then the Copy tab showing the compiled Markdown for rentry.co and changing to text.is.
Twelve seconds of the real thing. Start from a template, open a section, change a price, watch the preview catch up, and copy the Markdown out for the host you picked. Nothing here is a mockup: the frames are captured from the built app in headless Chrome by a script in the repository, which fails the run if any step it was told to perform found nothing to press.

The job

Go and look at how illustrators sell work. A large share of them run their commission page on rentry.co or something like it: a free Markdown paste site, no account, no platform cut. It is a genuinely good choice, and it has one problem. The page is written in Markdown.

So people who draw for a living end up learning table syntax, or paying someone forty dollars to lay out a price list. The gap is not talent or taste. It is a text format.

blocks -> document -> target capabilities -> markdown + diagnostics

The obvious build is a WYSIWYG editor that emits Markdown. That is the version I did not build, because it hides the actual difficulty. Every host renders a slightly different dialect, so the same page is correct on one and broken on another, and the artist finds out after they publish.

What shaped it

The guards, and what they caught

I ran an architecture review before writing each feature and a holistic review across the whole diff after. Both are committed. Every one of the bugs below would have shipped, and not one of them was the kind a test I had already thought to write would catch. The later ones came from putting the app on a physical phone and then from someone else using it, both of which have their own sections further down, because holding the thing found what reading it did not.

Architecture review · feature 001

The writer could destroy a page on the way to disk

JSON.stringify turns NaN and Infinity into null, and null is never valid in this format. Neither can arrive by parsing, since neither is legal JSON, but both arrive easily from an editor field computed as parseInt(""). A page would have been written in a state that could not be read back: work destroyed by the save path itself. The writer now validates before it writes.

Holistic review · feature 001

Validation handed back the caller's own object

The editor validates a draft it is still holding, so the application's saved page and the page being typed into were one object. The saved copy changes underneath the app, silently, with no write and no event. Every function was individually correct, and no per-chunk test could see it, because within one chunk there was never a second holder of the object. It surfaces months later as a storage bug in a file nobody connects to this one.

Holistic review · feature 002

Two languages that disagree about what whitespace is

A newline inside a heading ends the heading and turns everything after it into body text, so the escaper collapsed whitespace with JavaScript's \s. That does not include U+0085. Python's splitlines does, and rentry is a Python service. A heading could pass our check and still be cut in half by the renderer. The escaper now collapses the union of both sets.

Pasting output into the real host

The line break the specification promised does not exist

Every capability value cited rentry's documentation, which is evidence and is not the same as having tried it. So I pasted the compiled output into their editor and read the preview. The hard line break, written as a trailing backslash because that is what CommonMark says, produced no break at all: rentry runs Python-Markdown, which does not implement it. Worse, the backslash was swallowed, so two sentences rendered as "each.Refunds". No test caught it, because every test asserted the backslash was emitted. The tests encoded the same assumption as the code. Only the renderer disagreed.

First run of the app

The first thing a new user does broke saving

Adding an "About you" section creates a profile with no name yet, and the schema marked that field non-empty, so the page became unsaveable before the artist typed anything. The fix was not placeholder text, which puts words in their mouth. The constraint was in the wrong place. An empty name is a valid document; it is a page that renders oddly, and this project's rule is that the compiler warns rather than the format refuses. Emptiness is a publishing concern, not a storage one.

Preparing the phone upload test · accessibility

The gate was passing on code it had never rendered

The image upload control is only built when an API key is present at build time, and the test run never set one. So the accessibility gate, the one thing standing between me and an unusable control, had been reporting green on a component it had never once put on the page. The moment a key existed it failed immediately: the file input had no accessible name, so a screen reader met an unlabelled second control for the same action. A gate that cannot fail is worse than no gate, because it is also collecting trust.

On a phone · checked against the live API

An error message that told the artist to wait forever

A refused upload showed "wait a few minutes", which is right for rate limiting. I checked what a bad key actually returns instead of assuming: Imgur answers POST /3/image with 429 Too Many Requests, byte for byte identical to a real limit, while /3/credits answers 403 "Invalid client_id". So a build with a dead key would have told every artist to be patient, on every upload, forever. The two cases cannot be told apart from inside the app, so the message now covers both rather than promising one.

On a phone · the Android build

The app served itself an older copy of itself

The offline service worker earns its place on the web. Inside the Android package every asset is already on local disk, so it cached nothing useful and instead shadowed the app's own files with the previous build. An install containing one bundle served the one before it, and the update only appeared on a second launch. Declining to register it would have fixed nothing for anyone who already had the app, since the registration and its cache survive an update, so the native build now tears both down. Verified by watching the handover across three launches on the device.

Reported by the owner, minutes into using it

Typing one character closed the keyboard

Type a letter into any field and the field went away. Type the next and it went away again, so the only way to enter a heading was one character at a time, reopening the field between each. Two faults compounding: the interface rebuilds its whole DOM on every state change, and a keystroke is a state change, so the element holding the caret was destroyed on every letter. Field ids came from a counter that only ever climbed, so nothing could find the field again afterwards. Fixing focus was not enough. One rebuild cost 37ms on that phone and every character caused two, because reporting "Saved" is also a state change, so roughly 75ms of blocked main thread per key. The WebView discarded anything typed at speed: AriDrawsCommissions arrived as Ari. Now 1.9ms, once.

Driving the app with real taps · Android

The keyboard took the screen away twice

Opening the keyboard collapsed the usable page from 672 to 114 CSS pixels: a sliver of the form, the tab bar jumping up beneath it, and a dead band the height of a second keyboard below that. Measuring the native view tree showed the window resize was correct and the WebView was not, by exactly the height of the keyboard:

parent FrameLayout [0,110][1080,1361] 1251px correct WebView [0,110][1080,452] 342px 909px short

Capacitor picks its inset strategy by reading the page's own viewport meta tag. Finding viewport-fit=cover on a recent WebView it takes a branch written for Android 15, where the window is edge to edge and is never resized, and pads the WebView's parent by the keyboard height. Unlike the branch directly below it, that one carries no OS version guard. On Android 10 the window had already shrunk, so the keyboard came off twice. Deleting one attribute routed it to the guarded branch and gave the screen back.

Driving the app with real taps

My own fix had missed the state he was actually in

I had already reworked the price list so a new section arrives with an empty item ready to type into, verified it on the device, and reported it done. His saved section held zero items, and a section with zero items rendered no fields at all: a button offering to add "another" item that did not exist, and a folded settings group. That is every section saved before the change, and every section whose last row is deleted. I had verified the fix against the state I created rather than the state he was in. An empty section now draws a placeholder row that joins the document the moment it is typed into, so "no items" stays a state the file can honestly hold.

Typing on the phone · caused by the fix above

The keyboard hands text to an element, and I kept replacing it

Typing "Full colour bust" into that new placeholder row produced "Ful colour bust". Three runs in eight lost a character, always the one straight after the first keystroke.

The app was not losing events. It applied every one it received: the number of beforeinput events always equalled the length of the value, so the character never reached the page at all. The convenient conclusion was that the test harness drops keys. A bare page with one input and no application code, driven by the same injection at the same speed, lost nothing in six runs, which took that excuse away and pointed back at me.

Android binds the keyboard to the focused editable through an InputConnection. A repaint rebuilds the DOM, so the focused input becomes a different element, the connection is torn down and rebuilt, and a character committed during the gap has nowhere to land. Tagging every element and recording which one each keystroke hit made it exact:

empty section, first key adds a row 2 nodes, 1 swap 3 of 8 dropped section that already has a row 1 node, 0 swaps 0 of 8 dropped

My own earlier fix caused it. When I made repaints wait for a pause in typing, I exempted changes to the shape of the page. Typing the first character into a placeholder row genuinely adds a row, which is a shape change, so it repainted at once, mid-word. Repaints now wait whenever a field has focus, whatever changed. Same experiment afterwards: zero drops in eight runs, and no element swapped mid-word in any of them.

On the phone · the button that lied

Both save buttons did nothing, and one said it had worked

A download attribute on an anchor is the whole story in a browser and does nothing at all inside a WebView, which ignores a blob: link unless the native side handles it. Nothing did. Pressing both export buttons produced no file in Downloads, none in shared storage, none in the app's own sandbox, and nothing in the system log. The app announced "Downloaded a backup" anyway.

That button exists to rescue someone's only copy of their page, so it was the worst thing on the page to be wrong about, and the same code backed the recovery button for a page that cannot be opened at all. Neither web escape hatch was available: navigator.share is absent in this WebView, and showSaveFilePicker exists but rejects instantly without showing anything, which is worse than being absent.

So the shell writes the file into its own directory, which needs no permission, and offers it through the file provider the manifest already declared. Android's share sheet decides where it goes, and no dependency was added. The page now reports what happened rather than assuming: a bridge that returns an error, or throws, counts as failure and says so.

Reviewing the code afterwards

The one file that could produce an executable address had no test

The preview renderer turns compiled Markdown into DOM. It is the only place in the application that builds an href or a src out of text, so it is the only place an artist's words could become something a browser acts on. It had no test at all: nothing anywhere imported it. Its own comment said "the XSS corpus test asserts exactly that". There was no such test.

The design did hold, for a reason worth stating. The link pattern needs ]( adjacent, and the escaper turns an artist's parentheses into escaped ones, so a refused link arrives as \[click\]\(javascript:... and the backslash between them stops the match. True, and load-bearing while living in a different module with nothing asserting it. Breaking that coupling on purpose produced seven live javascript: addresses.

The scheme is now checked where the value is used, as well as where it is produced. Breaking the coupling again now produces nothing, so the two defences are independent rather than one defence and one assumption.

Opening it on a desktop · caused by an earlier fix

Every form quietly undid the field before it

Type an item name, move to the price, and the name reverted. Typing the same two fields on the deployed app with different pauses between them puts the cause beyond argument:

pause 0ms -> {"name":"seed","price":"120"} the name was lost pause 120ms -> {"name":"seed","price":"120"} lost pause 250ms -> {"name":"Full colour bust","price":"120"} kept

The boundary is exactly the repaint delay, which is where it came from. Repaints wait for a pause in typing, so between keystrokes the controls on screen are older than the document. Every handler was built during the last render and closed over the section as it was then, so a second handler rebuilt the section from a stale copy and reinstated what the first had changed. It was not confined to prices: all five section kinds lost data the same way. Handlers now read the section as it is at the moment they run.

Silent data loss in every form in the application, caused by the fix for the typing bug two cards above, and found because I noticed a screenshot showing an empty field I had just typed into. No test caught it. There are five now.

Asked where the desktop version was

Nobody had ever opened it on a computer, including me

Every test I had run was at phone width or on the phone itself. Asked where the PC version was, I opened the URL that had been live for two weeks. The navigation bar was sitting in the middle of the page, below the editor: it is the last element in the document, which is right while it is pinned to the bottom of a phone and wrong the moment the wide-screen rule makes it static. Text fields ran 1088 pixels wide.

And the wide-screen rules in both the stylesheet and the shell were introduced as "Build beside Preview, since there is room to see both". There was no split view and there never had been. Two files had described an intention as though it shipped, which is exactly why nobody went looking for it, the same failure as the corpus test above. It exists now, and it is the one thing a desktop offers that a phone cannot: watching the page take shape without switching away from what you are typing.

Back on the phone · found in a fix I had called verified

My verification relaunched the app between every case

Back had been made to return to the previous screen instead of closing the app, and I had checked it: from Preview it went to Build, from Copy it went to Build, from Build it left. Every one of those was true. Walking the paths a person actually walks, without restarting in between, was not:

Build -> Preview -> Copy then back -> Preview Build -> Preview -> Copy -> Build -> Copy then back -> Preview

I had pushed a history entry for every move, which gives plain browser semantics: back retraces. That is right for pages and wrong for a tab bar whose first screen is Build, and the stack grew without limit, so toggling tabs ten times took ten presses to leave the app. At most one entry now exists beyond the first screen.

The interesting part is not the bug, it is that my check could not have caught it. Relaunching between cases reset the history every time, so the state the defect lives in was destroyed before each measurement. Each case passed honestly and the sequence was never tested. That is the same failure as a suite that sets a field's value in one assignment: not a wrong answer, a question that could only ever come back clean.

Pasted into the real host · the price bug

An artist writing "$45" published "\$45"

The escaper backslashes every character that could begin a Markdown construct. Its own comment justified the breadth: a wide list is safe, and the artist never reads the source. Both halves were wrong. The Copy screen shows them the source, it being the entire output of the tool. And rentry renders with Python-Markdown, whose escapable set is narrower than CommonMark's "all ASCII punctuation".

One paragraph per character, pasted into rentry's live preview:

honoured ` * _ { } [ ] ( ) # + - . ! | and a literal backslash visible ~ ^ $

So a price of $45, the likeliest input this application will ever receive, reached the artist's published page as \$45. The fix is the answer the same file already gives for <, & and >: a numeric character reference, which takes the character out of the source entirely so no renderer can build a construct from it, while every renderer displays it. Verified in the same session, including that &#126;&#126;text&#126;&#126; stays literal while a real ~~ is still struck through, so the protection survives.

The cause was a sentence, not a character. The capability record said escaping was standard, sourced as "documents no divergence from standard escaping", which is an absence of documentation written down as a presence of behaviour. The header of that very file forbids exactly that: a value may not be written from assumption, and an undocumented one is recorded as unknown. It is the second capability in that record written that way to turn out wrong. The first was the line break, four cards above.

Four hours later · caused by the card above

The fix broke the screen whose entire job is telling the truth

Moving three characters to numeric references stopped rentry publishing \$45 and started the preview showing the artist &#36;45. The preview renders the compiled output, so anything the compiler does for the host's benefit has to be undone there. It knew three named entities and nothing else.

The principle it broke is the one this project is built on. The preview exists to show what the host will actually produce, which is why it renders compiled output rather than an internal picture of the document. A preview showing plumbing is a preview lying, and it had been live for four hours.

Two things the fix had to get right, both now tested rather than asserted in a comment. Decoding a reference cannot produce markup: every result goes into a text node, so a decoded < is a less-than sign and never the start of a tag. And &amp; is decoded last, mirroring the escaper encoding it first, so an artist who literally types &#36; still sees &#36; rather than a dollar sign.

I found it before it reached the phone, by asking what the preview did with the new output instead of assuming a change to the escaper stayed in the escaper. That question is what a holistic review across the whole diff is for, and this change did not get one.

Exercising the warnings · the part that is the product

It told the artist to fill in a section they had just filled in

Pasting an unusable image address produced two notes about the same section. First "one of your images does not have an http address, so it has been left out", which is true and useful. Then "this section has nothing in it yet, fill it in and it will show up", which is false, contradicts the line above it, and sends someone looking for a second problem that does not exist. The preview then offered two ways back to that one section, with identical labels.

A section that produced nothing now says so only when nothing else has already explained why. Emptiness with a cause is reported as the cause.

This came from finally exercising the warnings rather than the editor. They are the product, in the sense that the compiler telling you what it compromised is the thing an artist would otherwise pay someone to know, and almost every check until then had been about typing, layout and storage. The same pass confirmed the two hosts really did diverge on the phone, rentry taking two trailing spaces where the portable baseline took a backslash. That divergence is gone now, and not because it was papered over: verifying a third host later proved the portable baseline had been the wrong one, and it moved to rentry's form. The same pass also confirmed that a javascript: address reaches neither the preview nor the pasted output.

My first check of the fix said it had not worked. It had. A gallery left behind by the previous run meant I was counting notes across two sections and reading it as one section repeating itself. Restoring to a known document and counting by section rather than by the words on the button gave the real answer. Leftover state is its own way of asking a question that cannot come back right.

Checking a promise · the backup

"A backup you can reopen here" could not be reopened

The button had said that since the app shipped. I went looking for the other half and there was none: no file input on any of the three surfaces, and nothing in the source that reads a file except the image picker. The roadmap listed "export and import" for that feature and the box was ticked.

A backup that cannot be restored is not a backup, it is a file. For a project whose constitution calls losing someone's page the one unforgivable failure, that was the wrong promise to leave unkept, so the missing half got built rather than the label softened.

Opening a backup never destroys the page already open: it arrives as a new page with its own id, and nothing is written until the content has parsed, so a file that turns out not to be a page changes nothing at all. The placement took a second look. The Copy screen returns early when there is nothing to copy, so the first version hid the import behind having content, which puts it out of reach of somebody who has just lost everything. That is the only moment it matters.

The wider lesson is about the ticked box. That roadmap had twenty six items, all ticked, none open, which is the shape of list that stops being read. Checking the others found a second stale claim, and two I suspected that turned out fine. A list with nothing open is not a finished project, it is an unread document. It now carries two honestly open items, including that every phone fix was verified on exactly one handset.

Verifying the hardest promise · on the device

It refused the damaged page correctly, and left nowhere to go

The constitution's strongest rule is that a page this version cannot read is not opened, not repaired and not deleted, and that the exact bytes come back on request. It had unit tests and it had never once been seen happen on a phone, which is the only place the recovery has to travel through a native file handoff that was itself broken until this week. So I planted a record holding a value the schema refuses, gave it a newer timestamp so the app would open it at launch, and restarted the app.

Every part of it was right. The refusal was announced as an alert, it said nothing had been changed, it offered to save exactly what was stored, the file arrived through the native handoff byte for byte identical to the damaged record, and the artist's own page was untouched at three sections. Then I asked the only question left: what can they actually do from that screen.

any way in the interface to choose a different saved page: false

Storage had been multi-page since the app shell was built. Every page has its own id, and the code to open one by id had been there and working the entire time. Nothing in the interface had ever let anyone choose one. The app opens whichever page has the newest timestamp, and a refused page keeps the newest timestamp forever, so it is what opens at every launch from then on, with the artist's real page sitting behind it, intact, saved, and unreachable.

Importing a backup had quietly made that routine rather than rare. Opening a file deliberately creates a new page so that the wrong file cannot destroy the right one, which is correct, and which stranded the previous page every single time. Two behaviours that are each right on their own, composing into a dead end. Neither one is a bug in the place you would go looking.

It is also the second time on this page that a capability existed with no way to reach it: a backup button with no importer, and now many saved pages with no way to open one. Both lived in the storage layer and nowhere else, which is the blind spot worth naming. A data model is not a feature until something in the interface reaches it. The Build screen now carries a folded list of every saved page, still standing after a refusal, because that is the case it exists for.

Shipping it made the rest of the hole obvious. It was a list you could switch with, could not add to except by importing a file, and could never remove anything from: the function that starts a page had been sitting in the store with no caller since the app shell. Both gaps were named as out of scope when the list was specified, which was the right call and did not make them any less missing. They landed next, and the rule that made them safe is that the page on screen cannot be removed. Deleting what somebody is looking at asks "what is open now", and every answer is worse than the question: opening the next page swaps their work for another document without being asked, opening nothing looks exactly like the thing this project exists to never do. So the open row has no remove control, and the store refuses the current page whatever calls it. The last remaining page cannot be removed either, which is correct.

The gate I had just written · twenty minutes later

It failed on the markup I had written to test it

Removing a page turns its row into the question, so I extended the accessibility gate to render that state, on the reasoning that a state the gate never draws is the exact failure this page already documents twice. Then it went red on my own markup, which had put role="group" on a list item to label the question.

aria-allowed-role list

Overriding a list item's role breaks the list it is in: the item stops being an item, and the list stops being a list, so a screen reader user loses both the count and their place in it. I moved the role to a wrapper inside the item. The fix was to the markup, not to the test, which is the whole distinction between a gate and a formality.

Earlier on this page the same gate had been reporting green on a control it never rendered, and I wrote that a gate which cannot fail is worse than none because it is also collecting trust. This is what the other version looks like: it could fail, it did, on code twenty minutes old, written by the person who had just extended it.

The unsaveable first run is the one I would want to be asked about. No test caught it, because every test I wrote encoded the same wrong assumption as the schema. It took opening the thing in a browser and clicking the first button.

The accessibility one is the sharpest, though, and it is the reason the three phone bugs are on this page at all. I had a green gate, a test count, and a habit of quoting both. None of that was worth anything for the control it never rendered.

Putting it on a real phone

The app is a Capacitor wrapper around the same code, because the web build was already offline and local, so there was nothing for a native layer to add except a launcher icon and a real file picker. Building an APK proves almost nothing, though, and I had written exactly that in the repository: it builds, nobody has ever tapped a button in it.

So I drove it on a Moto G7 over adb, evaluating against the WebView's own debugger, and checked the whole loop an artist performs: add a section, type a name, kill the app, relaunch it, and read the document back out of storage. Then compile, then copy, then paste it back to prove the text reached the system clipboard.

The first result was a false alarm, and the interesting part is how I knew. Nothing persisted, and the obvious reading was a broken storage layer on Android. Before touching the code I instrumented it: a 50ms timer never fired, while promises still resolved. That is not a storage bug, it is a stopped task queue. The screen had switched off, and Android freezes a hidden WebView, so indexedDB.open was sitting there returning no event at all: not success, not error, not blocked. One command to wake the screen and it opened first try. I had already reported it as a real defect, and had to go back and say so.

That is the honest shape of the work. Two of the three phone bugs above were found only because the first thing I found was not a bug, and I kept measuring instead of starting to fix.

I made this exact mistake again, on this exact cause, after publishing the paragraph above. Verifying the page switcher weeks later, four device runs in a row hung partway through. I wrote a retry. Then I found a plausible race in the debugger connection and fixed that too. Both were guesses and both were wrong. The harness scrolls a control into view and waits two animation frames before tapping it, a sleeping WebView produces no frames, and the phone had dozed off exactly as it had the first time. One command said so: mWakefulness=Dozing. Knowing a failure mode, writing it down, and publishing it did not stop me spending forty minutes rediscovering it. What worked was what worked before: stop fixing, go and measure.

Then the owner used it, and it was unusable

Everything above I found myself, on my own terms, with the app doing what I expected. Then Jakob opened the build on his own phone and typed a heading. One character, and the keyboard closed. His verdict was that it felt obviously machine-designed, overwhelming, clunky, and completely unusable. He was right on every count.

Five hundred and thirty tests were passing at the time. Not one of them could have found it, and that is the part worth explaining, because it was not bad luck. Every test I had written set a field's value in a single assignment and fired one event. A person does not do that. The defect lived entirely in the second keystroke, and my method was shaped so that a second keystroke never happened. The test count was not evidence of anything; it was a number I had grown used to quoting.

A green gate that cannot see the failure is the same problem twice. Earlier on this page, an accessibility gate reported green on a control it had never rendered. This is that shape again, in a different place: a suite that could not express the thing users do. Noticing the pattern the first time did not stop me shipping it the second.

So I stopped testing the app and started using it. I drove the real build on the Moto G7 with real Android input: taps sent through adb at computed screen coordinates, text through the actual keyboard, with the page recording every pointerdown so a tap that missed was reported as a broken harness rather than quietly accepted as a broken app. That found eight more defects in an afternoon, including two the fix above had left behind.

They were not exotic. Deleting a section was instant and irreversible from a control sitting between two harmless ones, 44 pixels apart, on a phone. An unfilled item pasted a row of empty cells into the artist's page. The row that opened a section read "Edit" whether it was open or shut, so the button offering to edit was the one that took the editor away. Empty sections vanished from the preview with no explanation, which reads as the tool losing them. Every one of those is obvious within a minute of using the app, and invisible for as long as you only run its tests.

Going back a second time found one more, and it was mine: the fix for the dead-end section had introduced a fresh way to drop a keystroke. That is the case for doing this repeatedly rather than once. A fix is a change, and a change is a thing that can be wrong.

The tests are still worth having, and there are more of them now, written to type character by character and to ask the document what is focused before each key rather than holding a reference. But I would not now describe a feature as done on the strength of a suite passing, and I would rather say that here than let a test count on this page imply otherwise.

The feature I removed on purpose

Image uploading worked. The picker opened, the file decoded, the request reached the host and came back. I took it out of the published build anyway, and I think that is the most senior decision on this page.

Uploading needs an API key, and a key shipped in a public bundle is shared by every artist who uses the site. It identifies the application rather than a person, so nobody's uploads land in my account, but the registration is mine and so is the responsibility: one artist posting something against the host's rules gets the whole application banned, and uploads then break for every user at once. The daily quota is shared the same way.

The tidy fix, asking each artist to register their own key, is worse than the problem it solves. Registering an API application is harder than learning the Markdown this entire project exists to remove. So the published build has no key, no upload button, and a field that tells an artist where to put an image and how to get its address back. That is what they already do today, and it costs nobody anything.

The upload path is still in the repository, still tested, and switched on by supplying a key in your own build. In the published bundle it is not hidden, it is absent: no endpoint, no key header, no image decoding, verified by fetching the deployed JavaScript and searching it rather than trusting the build log.

Three comments that stopped anyone looking

The same failure happened three times in this project, and it is the one I would most want to be asked about, because it is not a coding mistake. It is a documentation habit that disables the person who comes next.

None of these was a lie anyone told on purpose. Each was an intention written in the present tense and then left there. The cost is specific: a claim that sounds like a guarantee is a reason not to check, so the thing it describes goes unexamined for exactly as long as the comment survives. A missing comment leaves you curious. A confident wrong one leaves you satisfied.

All three are corrected, and the correction is not "delete the claim". Two of them are now true, because the test and the split view were built. The third names the gap it used to hide: the specification pipeline covers the first three features and stops, everything after that shipped without one, and the index says so on its front page rather than making a reader work it out from the file listing.

Naming a gap is cheaper than closing one, so it is worth saying which happened. The eleventh feature is the first since the engine to have its specification written before its code, including the two things it deliberately leaves out, which are named there rather than discovered later by whoever wonders why the list cannot delete a page. That is one feature, not a reformed habit, and I would rather report it that way.

The twelfth is those two omissions, and it opens by amending a requirement the eleventh had got right for a switcher and wrong for what the screen became. The amendment is written in the new document rather than edited into the old one, because a specification that quietly changes to match the code is worth nothing: it stops being a thing the code is checked against and becomes a description of whatever was built. That is the same failure as the three comments above, wearing the costume of diligence.

Then I built a whole shop with it, and published it

Everything above was found by using the app on small pages. The obvious next question was whether it could carry a real one, so I authored a complete storefront: twelve sections, three price tables with a photograph and a specification list per item, a gallery, shipping bands, returns, warranty, and terms. Then I published it to rentry and read the page back to count what the host had actually built from it.

headings 9 asked, 9 built bullets 22 asked, 22 built tables 4 asked, 4 built bold 12 asked, 12 built rows 14 asked, 14 built links 5 asked, 5 built images 13 asked, 13 built

Seventy nine of seventy nine. Every price legible, no stray escape characters and no entity codes visible to a reader. That is the compiler's whole thesis, tested on a real host with a real page for the first time, and it held.

It also found four things, and one of them mattered. The output carried 74 backslashes and not one of them was necessary. The tagline read Small\-batch everyday carry\. Machined in Sheffield\. Every full stop and hyphen in the page was escaped, in the middle of sentences, where neither can begin anything.

This is the same lesson, learned twice, in the same file. When $45 published as \$45, I narrowed the escape set to what rentry's renderer consumes. The question I did not ask was the other one: which of these characters needs escaping at all, and where. A hash only makes a heading at the start of a line. A full stop only continues a list after digits. Round brackets only mean anything inside an address the compiler writes itself. The original comment defended the breadth as safe, and it was safe, and it was also 36 backslashes of noise on the one screen the whole product exists to fill.

The escaper is now position-aware, and the storefront compiles to zero backslashes. The golden files were regenerated as the evidence: 36 escapes removed, and every character that can still do damage kept its count exactly. Then the narrowed output went back up to the same rentry page and was read back again, because that renderer's behaviour is known here by experiment and not by documentation.

The tests caught a hole in my reasoning before it shipped. I had dropped the exclamation mark from the set, arguing that an image needs ![ and that [ is always escaped. True of anything the artist types, and false of the brackets the compiler writes itself for a link it has accepted, so ![alt](url) in a paragraph became a real embedded image. "X is always escaped" was true of one code path and false of another, and the reasoning never asked which path wrote the bracket. It is escaped at that one seam now, and the specification records the correction rather than being quietly edited to match the code.

Two assertions had to change, and neither was relaxed. Both were proxies that had become cruder than the property they stood for: they searched for the substring ]( and found it inside \](, which is not a link because the bracket beside it is escaped. They now assert the property itself, that no unescaped ]( exists anywhere.

And then on a desktop, for the first time

The app had been driven on a phone for weeks and opened on a computer exactly once, by me, in a hurry, which is how the navigation bar was found sitting in the middle of the page. Every claim about the wide layout since then rested on a test environment that lays nothing out at all.

So I drove real Chrome over the same debugger protocol used for the phone, at four window sizes, against the build as it stands rather than the deployed copy. The split view appears at 1024 and above and collapses below it; the tab bar sits at the top of a wide window and pins to the bottom of a narrow one; nothing scrolls sideways at any width; the storefront opens with all twelve sections and renders 13 images and 4 tables into the preview pane beside the editor. Typed character by character, nothing was dropped and focus was never lost. The Copy screen matched the engine to the byte. No console errors of any kind.

The first desktop run reported a mismatch, and it was right to. The output was eight characters longer than the engine produced, which is exactly the eight doubled full stops from a defect fixed two commits earlier: I was testing the deployed site, which was behind. Pointing it at the current build gave a byte-for-byte match. The second run found the same thing again, and both would have read as a bug in the app if I had stopped at the first number.
I wrote the cause of that second one down here, and it was wrong. I said a stale bundler cache. It came back a day later, so I ran the experiment instead of guessing: change one line, build, compare the output hash. From PowerShell the bundle changes. From the Git Bash shell it does not, silently, with the build reporting nothing amiss. This project's own instructions have said for weeks that every npm command has to run from PowerShell, because the msys2 shell picks up a different npm cache. I had read that rule, written half of it, and then broken it repeatedly while diagnosing the symptom it causes. Two false diagnoses, one published on this page, from not following a rule I already knew. The correction is here rather than in place because a page about claims that stopped people looking should not quietly edit its own.

The worst bug in the project came back, quieter

He installed it on a second phone, a Pixel, and reported that single characters were going missing while he typed. Not every time. And whole words coming out wrong when he swiped.

The keyboard no longer closed, which was the defect from three weeks earlier, so this was the same seam failing in a way that is easy to dismiss as a bad keyboard or a slow phone.

The guard was checked when a repaint was scheduled, and never when it ran. A change made while a field has focus is deferred rather than painted, so the field is not taken away mid-keystroke. Two hundred milliseconds later it painted regardless, rebuilt the DOM, destroyed the focused input, and Android tore down the InputConnection bound to it. A character committed in that window had nowhere to land.

That timing is the whole explanation, including the part that sounds like two separate bugs. A fifth of a second is nothing while thinking of the next word, so tapping keys only lost a character sometimes. A swipe gesture commits nothing until it ends, so it is a second or more with no events at all, the timer always fires inside one, and the repaint then writes the document back over a word the document has never been told about. Swiping was not a second bug. It was the same one, made certain.

The reproduction is four lines: focus a field, put a character in it, wait, and ask whether it is still the same element. It was not, and a field holding lmao came back holding lm. That test fails on the old code and passes on the new.

My first fix did not work, and the reason mattered more than the fix. I put the guard at the other end of the same timer and the characters kept going. Every other path into a state change repaints immediately, and one of them fires at exactly the wrong moment: the first save of a new page re-reads the page list, which repaints, which rebuilds the interface under the field. I had added that path four days earlier. So the guard went into the one function every repaint passes through, because a rule enforced at each caller is a rule that lasts until the next caller.

What I could not prove, and said so. The device harness types by injecting finished text through adb, and that skips the composing buffer this bug lives in: it typed ten characters out of ten even on the broken build. So I tested a proxy it could see. Typing into a heading on the old build, the summary line above the field updated while the keyboard was still up: the rebuild, visible on screen. On the fixed build it stays put until you leave the field. Same phone, same steps, both builds. That proves the mechanism and not the dropped character, and the difference is worth keeping straight.

Undo, instead of asking

Three weeks ago a mis-tap deleted one of his sections and I added a confirmation: "Delete Prices? This cannot be undone", with Keep offered first. I have now taken it out.

Nielsen Norman Group's position is that a confirmation is the wrong tool for anything reversible, because people automate their answer to it. It gets clicked through unread, so it taxes every deliberate removal and still does not prevent the accidental one. Material draws the same line. Removing a section is an object in memory and an array splice; it was permanent only because nothing had been built to remember it.

The mis-tap was real and the confirmation was the wrong fix for it. Measuring the row on the phone it was built for, the three controls sat four pixels apart, one of them the destructive one. That is the defect. It is eight pixels between the arrows and twelve before remove now, and that is what actually prevents the accident.

Removing takes effect at once and leaves an offer where the section was, restoring contents and position rather than appending a blank one at the end. It does not expire, because an undo that vanishes after four seconds while somebody is scrolled elsewhere is a safety net that is not there when it is reached for. Removing a page still asks: that is deleted from storage rather than held in memory, and can carry a hundred sections.

The specification for it argues with the earlier one rather than replacing it quietly, which is the rule the eleventh and twelfth features already follow. A document that changes to match the code has stopped being something the code is checked against.

Measuring an interface instead of having opinions about it

Asked whether the thing was actually pleasant to use, I had a research agent pull published guidance with citations, and separately measured what the interface costs at 360 by 720, the phone it was built on. Opinions about usability are cheap. These are countable.

opening a price section 7 fields rendered, 0 visible without scrolling gap between move and remove 4px, 4px first screen 10 controls, all reachable, no scrolling

The first line is the one that would irritate a real person every single time. Pressing Open rendered seven fields and put none of them on screen, so the control looked like it had not worked and the remedy was to guess that you should scroll. It is six of seven now, and it was wrong on both routes in: pressing Open, and adding a section, which selects what it adds. The first measurement only caught one of them.

Three decisions came back vindicated by sources rather than by taste, which is worth as much as the defects. The up and down arrows are the normatively correct pattern, not a compromise: WCAG 2.2's dragging criterion uses this exact case as its worked example, and a drag-handle list would fail it. Labels above fields rather than placeholders is settled. And the copy button already did the thing the research says matters most on Android: it selects the text first, announces success in a live region, and on failure says so rather than showing a false "Copied".

Then he used it as a merchant, and the format was too small

"If they are selling food, one pound of bananas for twenty dollars." An item was a name and a price, which is enough to sell a drawing, because a drawing is one thing and the price is for all of it. Twenty dollars of bananas is not a price until you know it buys a pound.

A unit and a variation were both expressible already, by writing them into the item's name or its description, which makes them prose rather than data: they cannot be a column, they cannot be consistent between items, and they read as an afterthought because they are one.

| Item | Price | Details | | Bananas | $20 per lb | Origin: Ecuador | | Bananas | $90 per 5 lb | Bulk: save $10 | | Pixel 6a | $180 each | Colour: black, Storage: 128GB | | Consulting | ask per hour | |

Quantity-break pricing was offered and deliberately not taken. It is a nested structure, several more fields on every item, and a table that has to degrade on hosts without tables, and a second row reading "Bananas, 5 lb" says the same thing with nothing new to learn. That is in the specification as a decision, not left as a gap for somebody to infer.

The contract landed alone, and the guard fired on it. This schema crosses the engine, the app, the browser's storage and the export file, so the project's oldest rule is that it changes first, by itself, before anything reads it. The parity test failed on the change, which is it working, and the regenerated snapshot is twenty two lines added with nothing removed or altered. Every golden file stayed byte identical, which is the evidence that a page using neither new field compiles to exactly what it compiled to the day before.

Adding a column that appears only when it is used made it obvious that the column already there did not. "What you get" was unconditional, so a greengrocer listing weights and prices got a column of nothing on every row: precisely the cost the image column has always been conditional to avoid. And putting a unit after a price exposed $ 20 per lb, a space in the one place a price should not have one. Neither of those was the feature. Both were found by building it.

He asked for the feature I had talked him out of

Three weeks earlier I had offered quantity break pricing, one for twenty, five for ninety, and he chose something simpler. I wrote down why: a nested structure inside every item, more fields to fill in on a phone, and a table that has to degrade on hosts without tables. I argued that a second row reading "Bananas, 5 lb" said the same thing with nothing new to learn, and I put that in the specification as a decision rather than a gap.

Then he used it, and asked for it again. The substitute I had relied on does not work, and using it is the only way that was ever going to surface. A sibling row does not read as the same item at a different quantity. It reads as a second product, because that is what a row in a price list means. The seller has to repeat every detail on both rows or leave the second one looking half finished.

The specification argues with the old one rather than replacing it. The passage declining the feature is still there, quoted, followed by what changed and why the original reasoning was sound and still lost. A document that silently edits itself to agree with the code has stopped being a thing the code is checked against. This is the third feature here to work that way.

He also described a layout, and rather than implement a description I built three of them as real Markdown, published them to the host, and asked him to choose from output. That surfaced a cost neither of us had said out loud: a table per item destroys the single price column a customer reads down to compare things. He picked the one that survives a host with no table support, which degrades to a heading and a list, over the one closest to his description, which degrades to a list whose first entry looks like a mistake.

The new layout is conditional, and that is the whole design. It applies only to a section where somebody actually priced by quantity. An artist selling three commission tiers would pay both of its costs, the lost price column and twelve items becoming twelve tables, and get nothing back. So they do not pay them: their section compiles to exactly the bytes it did before, which the golden files check rather than assert.

"Works anywhere" worked on none of them

He wanted more hosts: text.is, ghostbin, pastebin, plain Markdown files. Two of those do not exist as targets. ghostbin returns 502 on every attempt to publish, so its behaviour is recoverable only from archived source, and this project's rule is that a capability is observed or it is not recorded. pastebin puts Markdown behind a paid tier, with the option sitting in the form marked disabled.

text.is is real, and the research told me it runs the same engine as rentry. Copying rentry's values across was one edit away and would have passed every test I had.

They are not the same host. Driving text.is's own renderer, one line per character: a backslash fails to escape three characters on rentry and one here. And a trailing backslash, which rentry merely ignores, is destructive on text.is. It consumes the newline and the space that would have joined the two lines, so "each." and "Refunds" publish as "each.Refunds". A family resemblance is not an observation.

That finding then reached backwards into a decision made months earlier. The portable baseline, the one named "works anywhere" and used for any host this build does not know, emitted the CommonMark backslash for a hard line break. rentry swallows it. text.is destroys it. It was a working line break on none of the three hosts I have ever verified, only on the specification. Two trailing spaces are equally valid CommonMark and worked on every renderer I probed, so that is what it emits now.

Three existing tests asserted the old behaviour, one of them named for a property I was about to break: that no line ends in whitespace. That was a deliberate choice, not an accident, and it is a real cost, because an editor stripping trailing whitespace silently removes the break. I kept the property and narrowed it to lines that are not deliberate breaks, and rewrote each test to argue with its earlier reasoning instead of quietly flipping. The cost is named in the commit: this form loses a line break, where the old one loses the space between two words on a live page.

The fix I planned would have been worse than the bug. The Markdown file download handed over whatever host was selected, so saving a file while rentry was picked gave you rentry's dialect. A file is not a host: it goes to GitHub, to Obsidian, to a text editor. The fix was to compile it portable, and that reasoning is still right. But portable was emitting the exact hard break form that text.is destroys, so shipping the planned fix alone would have handed him a file that breaks on the host the same release added.

And then I wrote five tests for that download, and three of them were worthless. Now that every shipped host emits identical bytes, "the file matches the portable output" passes no matter which target the button picked. I kept them and wrote the limitation at the top of the file rather than deleting them or letting them look like proof, because they become load bearing the moment a host diverges again, which has now happened twice.

Being the customer, instead of asking whether it was good

Asked how complete the thing really was, I could have answered from the test count. Instead I built two whole shops with it, as two people who are not me: an illustrator selling commissions, and someone selling 3D prints, which is the same shape of problem as Lego or supplements. Then I opened it at phone width and counted what a stranger pays to use it.

An hour of that found six defects. Every one of them had been shipped, and several had been shipped past me twice.

The artist's email address silently vanished. A contact link was refused for not starting with http, and the LABEL survived, so the page published a bullet reading "Email" that did nothing at all. Worse than leaving it out, because it reads as the seller's mistake rather than the tool's rule. The comment in the code justified refusing mailto: on the grounds that nothing produced one. The first person to use the thing produced one.

The 3D print shop announced "Commissions are OPEN" on its second line, for a business that does not take commissions, because the wording was written when the only customer was an artist. Its price list showed "£18 each" above "from 25 per model", with the currency on one line and not the next, because the rule only priced a string that was purely a number and "from 25" is one of the commonest ways there is to write a price. The seller's own portrait was the one image on the page with empty alt text.

Two were worse than cosmetic, and both were my own inconsistency. Removing a section was undoable, because I had built that deliberately three weeks earlier. Removing a product was instant and permanent. That is exactly backwards: a shop has three sections and thirty products, and a product holds a name, a price, a unit, a bulk table, several details and an image address. Sections could be reordered and products could not, so moving a bestseller to the top of a twenty item list meant deleting it and retyping it, into the deletion that could not be undone.

And the first control on the page was a dropdown asking where the page would be pasted. That question cannot be answered by someone who has just arrived: they have made nothing to paste and have no reason to know what rentry is. It also did nothing visible, because everything it affects is on another tab, so the control that changed the most gave the least feedback. It now sits on the Copy tab, above the output it rewrites and the steps it rewrites.

Writing the test for my own fix found a hole in it. Addresses are normalised before being checked, so a control character cannot hide javascript:. That same strip turned mailto:has space@example.com into something that passed, and the space was then percent encoded into a clickable link to a mangled address. A contact address must now not merely survive normalising, it must not have needed it.

Four changes in a row broke no existing test

That is not the reassurance it sounds like. It is a coverage report.

Row removal had never been tested at that level, which is how it shipped with no undo. The host picker's position was never asserted, so moving it out of the header was invisible to the suite. The file download had no test over the export surface at all, which is how it came to hand over host-specific output. In each case the green suite was telling me the truth about the code it covered and nothing about the code it did not.

The tests I wrote for the download were themselves worthless, and I kept them anyway with the reason written at the top. Since every shipped host now emits identical bytes, "the file matches the portable output" passes whichever host the button picks. It cannot fail today. It becomes load bearing the moment a host diverges again, which has already happened twice, and saying so in the file is worth more than deleting three tests or letting them look like proof.

One of the new tests then failed for a reason worth keeping: it hard coded the default host, and the store is module state that outlives a single test, so it passed or failed depending on which test ran before it. It reads the target now.

The migration the mechanism had waited three versions for

The last gap was that a product could have one photograph. A print or a knife wants a front, a back and a detail, and the gallery is a separate section with no way to say which product a picture belongs to.

That is a schema change, and this schema crosses the engine, the app, the browser's storage and the export file. So it landed alone, and the compiler deliberately went on showing only the first image. That sounds like a wasted commit and is the opposite: it means every golden file had to stay byte identical, so any movement in them would have been a defect rather than a feature. The rendering followed separately.

This was the first migration the project has ever run. The mechanism was built at version 1 with nothing to migrate, on the argument that it could not be added later: by the time a second version exists there are already pages saved by a build that had no migration path, and those pages cannot be reached retroactively. That argument was made months ago and just got cashed, and the four steps written in that comment are the four steps I followed.

Both guards fired: the parity snapshot, and a test asserting that no migration had ever existed. The snapshot diff is three lines, the field name, its type and the version number. A version 1 picture becomes the first entry of the list, an item that had none gains nothing, and an emptied field left as an empty string gains nothing either, because absent and empty must not both be able to mean the same thing when the round trip depends on telling them apart.

Several pictures now earn an item its own block, which is the rule quantity pricing already follows and for the same reason: a table cell cannot hold a row of images and stay readable on a phone. One picture still fits a column, so an artist with a single sample image sees no change at all. The alt text counts the pictures that survived rather than the ones entered, so a refused address cannot leave the page promising three images and showing two.

I diagnosed a bug that was not there

Everything above went onto the real phone as a signed release. I installed it, took a screenshot, and got a blank white screen. I said so, out loud, and called it a real regression.

It was not. The app had been working perfectly the entire time.

A screenshot of a sleeping phone is a white PNG. The screen had timed out during the ten minutes of building. Three captures came back identical at 9,652 bytes, which should have been the tell: that is not a rendered screen, it is a blank one. dumpsys power said mWakefulness=Dozing, and I had checked exactly that at the start of the run and not again before capturing.

What it cost: a rebuild, a reinstall, and an investigation into whether the service worker was serving a stale shell after an update. I had a plausible mechanism for that, wrote it out, and tested it by relaunching. The relaunch was still blank, which killed the theory and should have moved me off the app sooner than it did.

What actually ended it was refusing to keep guessing. I rebuilt with the WebView made inspectable, signed with the same key so the update would install over the top and his saved pages would survive, attached a debugger, and asked the page what it contained. One call:

body text: "Storefront builder / Your pages (2) / Open Heading... " buttons: 24 #app html: 3142 characters

Fully rendered, 24 controls, his two pages listed. The screenshots were wrong, not the app. I then removed the debugging access, rebuilt, and confirmed the release had no debug socket, because leaving somebody's shipped app inspectable to fix my own mistake is not a trade worth making.

This is the same hazard that cost four device runs earlier in the project, and it caught me again in a worse form: last time it hung, which is obvious, and this time it produced a confident wrong answer, which is not. It is written into the project's rules now with the specific tell, that a capture under about twenty kilobytes is a sleeping screen until proven otherwise, and the specific fix, that wakefulness is checked immediately before each capture rather than once per run.

What the phone actually confirmed

With the debugger attached, everything from these rounds was verified on the device rather than only in tests: no host picker in the header, the Copy tab offering all three hosts, and the price form carrying the bulk pricing and picture fields. Typing one item produced the row controls, with no move buttons, correctly, because there was only one item to move.

The compiler then ran on the phone and produced this from what had been typed into it, which is the whole product in four lines:

#### Dragon, 18 | Quantity | Price | | 1 | 18 | | 3 | 48 | ![Dragon](https://i.imgur.com/e.png)

The update also carried a schema change, and his saved pages opened. They were written by the previous version, at schema version 1, and the app listed both and opened one that compiled correctly. That is the migration doing its job on real stored data rather than on a fixture, which is the only test of it that was ever going to matter.

I had typed a test item into one of his pages to check the controls, so I removed it afterwards and confirmed the section was back to the "0 items" it started at. The removal was addressed by the control's own name rather than its position, because getting that wrong on this device has already destroyed his work once. I also set his screen to stay awake while charging in order to finish, and set it back afterwards, because it is his device setting and not mine.

Closing the gap I had written down and left open

The accessibility gate ran axe over the interface and switched colour contrast off, with the reason stated in the file: the test environment is jsdom, which lays nothing out and computes no colours, so a contrast number from it would be a number that means nothing. The project notes called it "its one honest gap" and pointed at a manual checklist.

Stating a limitation is better than hiding one, and it is not the same as fixing it. A manual pass is a pass nobody reruns. So the claim that this interface is readable rested on my having looked at it.

It runs in a real browser now, and it runs twice. Headless Chrome with real layout, axe with only the contrast rule, once with prefers-color-scheme: light and once with dark. Both palettes ship, and testing one of them is testing half the users.

light: 144 elements, 13 sections, 3 fields, 2 hints, 0 contrast failure(s) dark: 144 elements, 13 sections, 3 fields, 2 hints, 0 contrast failure(s)
The counts in that output are the interesting part, not the zero. An empty page has almost no coloured text on it, so a contrast gate pointed at the empty shell would report zero failures forever and mean nothing. It loads the bundled example storefront and opens a section, and then it refuses to report a pass unless at least three sections and three fields were genuinely on screen when it measured.

That guard is there for a specific reason. Earlier the same day I wrote three tests that were green and worthless, kept them, and wrote the reason at the top of the file. Writing a fourth would have been worse than not noticing the first three.

Then I made it fail on purpose, which is the only thing that turns a script into a gate. Weakening one colour token in the light palette:

#f3-hint contrast 1.52 (foreground #cfcdc9, background #fbfaf8) expected 4.5:1 #f2-hint contrast 1.58 (foreground #cfcdc9, background #ffffff) expected 4.5:1 dark: 0 contrast failure(s)

It named both elements, both colours and both ratios, and the dark palette correctly kept passing, because the two palettes are separate token sets and I had only broken one. That last detail is what tells me the two runs are genuinely independent rather than one run reported twice. The colour was then restored byte identically.

Both palettes pass as they stand, so nothing needed fixing. That is worth saying precisely because it was not known before, it was believed. The difference between those two is the whole reason the gate exists, and it is the same difference as between a host capability somebody assumed and one somebody observed.

The gate I could not break, and what that taught me

The service worker decides what somebody who visited last week sees when they come back. Get it wrong and they get a stale shell, or a cached page pointing at a script that no longer exists, which is a blank screen with nothing in the console. On a link sent to strangers, that is the worst class of bug there is.

There were tests for it. They read sw.js as text and asserted it contained the right lines: that the cache is named after the build id, that activate deletes older caches, that the new worker takes over immediately. All true, all present, and none of them ever ran it. The question of what a returning visitor actually gets was being answered by reading the source.

So I made it deploy. One build is served and cached by the worker, a second is deployed over it with a different asset hash and the first one deleted, which is what hashed filenames mean in practice, and then a visitor reloads. It works: they are on the new build by the second reload, and nothing is blank or half updated on the way.

Then I tried to break it on purpose, and failed twice. A gate that has never failed is not a gate, so this mattered more than the passing run, and both failures taught me something about the system that its own comments had implied wrongly.

First: I shipped the new build with the old cache id. That should strand everybody, because the cache is named after the id and activate only deletes caches that do not match. The gate passed, correctly. The worker answers from cache and then refreshes in the background, so entries get overwritten with the new build even inside the same cache. The version stamp is the belt; the background refresh is the braces, and the braces are doing the work. The comment in the file says the id "must change whenever the build output changes, or returning visitors keep the old shell". That turns out to be the second line of defence, not the first.

Second: I broke the worker being deployed. Also passed, also correctly, and this one is obvious in hindsight: the worker in control during a deploy is the one already installed. The incoming one has not run yet. Only sabotaging the installed worker can strand anybody.

Doing that, an ordinary naive cache-first worker with no background refresh, finally produced the real failure:

second reload running A FAIL the returning visitor is on the new build third visit running A FAIL still on the new build after a refresh 404'd

Stuck on the first build through every reload, silently, forever. That is the shape most hand-written service workers have, and it is now the gate's own self test, so anyone editing that file can confirm in one command that the check still bites.

One of my assertions was also simply wrong, and I corrected it rather than deleting it. I had demanded that nothing ask the server for the asset a deploy removes. Exactly one background refresh does, and gets a 404. It cannot do harm, because that refresh only writes to the cache when the response is ok, and the visitor had already been served from cache before it ran. One discarded request is what stale-while-revalidate costs. The gate now asserts the thing that would actually matter, that a failed refresh poisons nothing, checked on a third visit, and keeps the count visible as information rather than as a verdict.

Two gates went in this way on the same day, and both said the same thing about the project: the parts nobody had executed were the parts nobody could vouch for. Contrast was believed rather than known. Updating was read rather than run. Neither turned out to be broken, and I would not have been able to say so beforehand, which is the entire difference.

What is enforced, not merely intended

A project of this size accumulates good intentions. These are the ones wired to the build, so they fail rather than drift:

991
Tests
23 kB
App, gzipped
8
Caught before users
38
Caught by using it

What I would tell you in an interview

For most of the build, the two shipped hosts produced identical output, and I wrote that down rather than manufacturing a difference to make the demo look better. The compatibility machinery was real and proved only by synthetic hosts in the tests.

That changed when I finally pasted real output into rentry, and it changed because the paste found a bug: the two hosts came to differ on the hard line break, because the renderer disagreed with the specification.

I then wrote, in this section, that one divergence was thin proof and that the payoff arrives with a third host. The third host arrived. It did the opposite of what I predicted.

Verifying text.is collapsed the divergence instead of widening it. It revealed that the portable baseline had been wrong all along, on a construct rentry had already flagged and I had fixed in only one place. All three hosts now produce byte identical output again, which is exactly what I said I would not manufacture a difference to avoid.

So the honest position is unchanged and better evidenced: the compatibility machinery is still mostly proved by synthetic hosts in the tests, and it is still not earning its keep. What the real hosts have proved is narrower and more useful than a diagram would be. Every capability on every host now cites the observation it came from, with the transcripts checked in, because the values nobody checked were the ones that were wrong.

Why this one is worth reading. Most portfolio pieces show a working thing. This one shows the working thing plus the reasoning that produced it, including the fifty times the reasoning was wrong, the time I called something a bug and it was not, the feature I deleted after building it, and the afternoon the owner told me the whole thing was unusable and it was. If you want to know how I would behave on your codebase, that is the part that generalises.
← Back to work