The most expensive bug a small business’s website can have isn’t a broken layout. It’s a customer who fills in the quote form, sees “thanks, we’ll be in touch”, and is never heard from again because an email service had a bad afternoon.
So the website builder starts with the contact form.
What I built
Milestone I0, the spine, in four slices:
- A pure domain for lead intake: field limits, consent, a honeypot field (a hidden box that only bots fill in), submission keys and content fingerprints so a resent form isn’t stored twice, the states a lead and its notification go through, the retry schedule, rate-limit buckets and retention.
- Durable intake.
POST /v1/sites/{site}/leadstakes a form of up to 16 KiB and saves the lead and its notification job in one database statement. It limits each address and each site, gives the database 3 seconds, and if it can’t save, it answers 503 withRetry-After. It never says “thanks” for a lead it didn’t keep. - A notifier, which claims jobs under a lease and counts each attempt when it claims it, so a crash can’t make an attempt disappear.
- A provider stand-in that can answer, fail with 503, hang, or accept and then hang.
- A read-only operator inbox: sign in, see leads newest first with their notification state. A table on wide screens, a card per lead on phones, built with Tailwind and shadcn-svelte from Colophon’s UI kit.
- Drills and load. Failure drills against the release binary (a notification provider down, one
that never recovers, an answer lost after acceptance,
kill -9mid-request, Postgres stopped mid-run), each ending with a check that no lead content reached the logs. And a k6 scenario that reconciles every acknowledged submission against the database.
How it works (the short version)
The lead and the “tell the owner” job are written together, or not at all. That’s the outbox pattern: instead of saving a lead and then calling the email service (and hoping), you save the lead and a note saying “send this”, in the same step. A separate worker reads the notes and sends them. If the service is down, the note waits. If the worker crashes, another one picks the note up when its lease runs out.
Does it actually work?
The first realism check ran 50 submissions a second for a minute, with the provider stand-in refusing every notification for the whole run, then brought it back:
- Nothing lost. 3,001 submissions, 150 of them deliberate resends: 2,851 distinct leads acknowledged, 2,851 stored, 0 stored without being acknowledged.
- Everyone told. After the provider recovered, all 2,851 notifications were delivered; the largest group, 1,083, got through on their fifth attempt.
- Too slow. p99 was 402 ms against a 100 ms target, so the run is committed as a fail. The machine (Apple M2 Pro, 12 cores, 32 GiB) had a load average of 27 to 57 from other builds; idle, one submission takes about 2 ms end to end. That’s a reason to re-run it on a quiet machine, not a reason to call it a pass.
Two more runs followed, on 5df19c5:
- The burst rerun held. 250 submissions a second, 15,001 in all, with the provider refusing throughout: p50 1.2 ms, p99 15.3 ms, nothing dropped, every acknowledgment reconciled, and 14,251 rows delivered after recovery for 14,251 provider acceptances, 0 duplicates.
- The 100,000-submission provider-down run kept every lead but missed. At 500 a second, every acknowledged lead was stored exactly once, and 94,269 notifications were delivered for 94,269 provider acceptances, 0 duplicates. Three submissions got an honest 503, and two of those were stored anyway, which a resend then finds by its fingerprint. But p99 was 109 ms against 100 ms and 771 iterations were dropped, at load averages from 16 to 78. It’s committed as a miss.
The operator inbox has a browser test at 1280 and 360 pixels wide: keyboard-only sign-in, a wrong password announced to screen readers, no sideways scrolling, sign-out ending the session on the server, and no lead content in the server log. The drills and the browser test are wired into the gate and CI. The commits don’t record a test count, so I’m not quoting one.
Where I messed up
My retry schedule couldn’t survive an afternoon. The plan promised notifications would keep retrying for “about a day”: start at one minute, double each time, eight attempts. But doubling from a minute only reaches 64 minutes by the seventh wait, about an hour in total on average. A two-hour outage would have killed most notifications. It now grows four times per attempt, up to a 6-hour cap: 8.8 to 17.7 hours of waiting in total.
My own probe poisoned a load run. The first burst run, 250 submissions a second, looked fine on the intake side (p99 64.8 ms, every one of 14,251 leads stored). But a manual latency probe I’d started earlier was still running, missed by my clean-up command, and connected to the same reused database. Its notifier claimed outbox rows and “delivered” them to an in-memory stand-in: the real provider fixture accepted 577, while 14,251 rows were marked delivered. So the run’s notification numbers describe a different process. It’s kept, marked invalid. The load script now creates a fresh database for every run and only passes if the rows marked delivered equal what the provider actually accepted.
What it doesn’t do yet
- It doesn’t build websites. Briefs, facts, components, the model, previews and launch are milestones I1 to I3.
- I0’s gate isn’t passed. The intake budget has to come from a quiet-machine baseline, which hasn’t been possible yet. That baseline, the 100,000-submission run against it, and the 1,000,000-submission run are owed.
- Its first independent review says fix first. The core promise held under every test the reviewer could run: a success is only ever sent after the lead and its notification job have committed together, and no lead was lost, duplicated or falsely acknowledged. But it isn’t ready for a public form: the review found three issues that have to be fixed first. They’re being fixed, and I’ll describe them here once the fixes are merged.
- It’s blocked on people. Three pilot clients, a model provider and a spending cap, a privacy notice and a data-processing agreement with each client, and deploy access to their sites.
Up next
Fix the review’s findings, run the quiet-machine baseline, then I1.