{"version":"https://jsonfeed.org/version/1.1","title":"Writings by Promise Okafor","home_page_url":"https://promise-okafor.vercel.app/blog/","feed_url":"https://promise-okafor.vercel.app/blog/feed.json","description":"Frontend decisions I have made, and what happened after.","icon":"https://promise-okafor.vercel.app/icon-512.png","favicon":"https://promise-okafor.vercel.app/favicon-48.png","language":"en","authors":[{"name":"Promise Okafor","url":"https://promise-okafor.vercel.app/"}],"items":[{"id":"https://promise-okafor.vercel.app/blog/how-i-review-pull-requests/","url":"https://promise-okafor.vercel.app/blog/how-i-review-pull-requests/","title":"How I review pull requests","summary":"Real findings from my reviews on a money admin console, an ID verification flow and a live audio feature, and the habits behind them.","content_html":"<p>When I review a pull request, I start from what the checks can&#039;t see. If CI is green, the lint rules, types, layering and test coverage already hold. My job is the part a machine won&#039;t catch: what breaks for a real person, how it breaks, and the smallest fix.</p>\n<p>So every finding I write has the same shape. What breaks. A real way it breaks, step by step. The fix. Then I sort findings into three groups: must fix before merge, should fix, and nice to have. The author always knows what&#039;s blocking and what isn&#039;t.</p>\n<p>Here are three reviews, with screenshots of what I actually posted. Code, file paths, colleagues&#039; names and the outside provider&#039;s name are blurred.</p>\n<h2 id=\"an-admin-console-that-moves-money\">An admin console that moves money</h2>\n<p>A large pull request added an internal admin console: accounts, refunds, a transaction ledger, support tickets and live alerts. The console was well built. It was cleanly layered, permissions were checked at the route, and five of six tables paged on the server. I said that first, because it was true and because it tells the author what to keep.</p>\n<p>Three things blocked the merge.</p>\n<figure class=\"stage\"><div class=\"frame bd-sky\"><div class=\"win\"><img src=\"/images/reviews/admin-blocking.jpg\" alt=\"\" loading=\"lazy\" decoding=\"async\" /></div></div><figcaption>My review requesting changes on the admin console: the three blocking findings. File paths and names are blurred.</figcaption></figure>\n<p><strong>Refunds were approved on one click.</strong> Every other serious action in the PR (suspending an account, adjusting credit, removing a team member) sat behind a dialog that restates the consequence. Refund approval fired straight from a list of pending requests. The idempotency key protects against a network retry, not against clicking the wrong row. I asked for the same dialog, showing the amount and who asked, and for &quot;Deny&quot; to collect a real reason instead of a canned note, because that page is the audit trail.</p>\n<p><strong>The ledger showed the first 25 rows and nothing else.</strong> The API accepted <code>page</code> and <code>limit</code>, but the response had no page information, and the frontend sent neither parameter. An operator could never reach row 26. This needed a fix on both sides: the backend had to return the same page block every other list returns, and the frontend had to wire up the pagination the other five tables already used.</p>\n<p><strong>A change to a shared data hook brought back a race in every app.</strong> To stop React&#039;s development mode from fetching twice, the cleanup now cancelled an old request one tick later instead of right away. In that small window, a slow response for the previous screen could still land and overwrite the new screen&#039;s data. Every list and detail page in the web, admin and desktop apps went through this hook, billing included. The hook&#039;s own comment said this could not happen.</p>\n<p>The fix I suggested was small: mark the old request as replaced immediately, drop its result when it arrives, and keep the timer only for the actual cancel. I also asked for a test with fake timers that lands the old response inside that window, so it fails if anyone changes the timing again.</p>\n<p>Below the blockers I listed five &quot;should fix&quot; items. Live alerts reconnected every second after a clean close, so a proxy that ends streams early would turn every open admin tab into one request per second. The permission checks had no tests, even though they were the only thing between &quot;read-only support&quot; and &quot;can approve a refund&quot;. A checkout button guarded double clicks with React state, which can&#039;t block two clicks in the same tick. A ref can, and the codebase already had one for this.</p>\n<p>I also flagged scope. The same PR shipped a full top-up payment flow, a support ticket system and a marketplace backend, all under an &quot;admin console&quot; title. The billing work was careful, which is exactly why it deserved its own review and its own title. I asked for it to be split out.</p>\n<figure class=\"stage\"><div class=\"frame bd-sky\"><div class=\"win\"><img src=\"/images/reviews/admin-shouldfix.jpg\" alt=\"\" loading=\"lazy\" decoding=\"async\" /></div></div><figcaption>The same review: the should-fix items and the scope note.</figcaption></figure>\n<h2 id=\"an-id-verification-flow-in-a-trading-back-office\">An ID verification flow in a trading back office</h2>\n<p>This was a review screen where staff check a customer&#039;s ID documents before raising their account limits. I reviewed it over three rounds. The pattern I kept finding was the worst kind of bug on a compliance screen: things that fail quietly instead of visibly.</p>\n<figure class=\"stage\"><div class=\"frame bd-sky\"><div class=\"win\"><img src=\"/images/reviews/kyc.jpg\" alt=\"\" loading=\"lazy\" decoding=\"async\" /></div></div><figcaption>Round three of the ID verification review: my summary and three of the inline findings. Code, file paths and the provider&#039;s name are blurred.</figcaption></figure>\n<p><strong>The approve button turned on too early.</strong> It checked whether either of two ID documents was approved. But most customers already had one approved from the previous tier, so the button was active before the new document was ever looked at. The fix was to check the document actually under review.</p>\n<p><strong>The provider&#039;s status could overrule the reviewer.</strong> If a reviewer rejected a document but the outside verification provider still said &quot;pending&quot;, a refresh showed it as pending again, the reject reason vanished, and the approve menu came back. If the provider said &quot;approved&quot;, a rejected document showed as approved and let the upgrade through. A person&#039;s decision should win over the provider&#039;s, or both should be shown. I also suggested the backend make this call, so the screen only displays the final answer.</p>\n<p><strong>An approval could go to the wrong customer.</strong> After closing the panel with Escape, opening it for a different customer briefly showed the first customer&#039;s details with an active approve button, while the click would approve the new customer. Clearing the old review before loading the new one closes it.</p>\n<p><strong>One failed request killed the panel for good.</strong> The loading stream let an error escape, so after one failure, opening any other customer did nothing until a full page reload. Three requests were also tied together so that if any one failed, the whole review disappeared, and a customer with no provider records got told they had no submission at all.</p>\n<p>Smaller findings in the same rounds:</p>\n<ul><li>A &quot;verified&quot; status wasn&#039;t in the list of known statuses, so it fell through to &quot;Not started&quot;. A reviewer looking at a fully verified ID saw the opposite of the truth.</li><li>A filter bar was hidden when the customer count was <code>0</code>, because <code>0</code> is falsy.</li><li>A failed ID check could still enable approval, because &quot;failed&quot; fell through to an older admin approval.</li><li>Uploaded files opened in a new tab without <code>noopener</code>, so the opened page could redirect the back office tab to a fake login.</li><li>Any country outside the three known ones showed income in Naira. Wrong, but believable to a reviewer.</li><li>Once a decision was made, the panel couldn&#039;t be opened again, so the audit trail the PR described was only visible before the decision.</li></ul>\n<h2 id=\"a-live-audio-change-i-approved\">A live audio change I approved</h2>\n<p>Not every good review blocks. This one changed a live interview feature so the microphone holds while the AI interviewer is speaking, to stop the app hearing itself.</p>\n<p>Before approving, I checked the one thing that worried me: did holding the mic quietly take away the candidate&#039;s ability to interrupt? It didn&#039;t. Interrupting was already turned off on purpose elsewhere, for the same noise reason, so the two decisions agreed.</p>\n<p>I approved it with two notes. The timer that releases the mic used the audio clock, which doesn&#039;t move while the browser has audio suspended. Audio queued in that state plays later than the timer expects, so the mic could open before the interviewer was actually heard. And a half-spoken answer was dropped, not sent, when the hold kicked in. The server would close the turn anyway, so I only asked that the comment say which behaviour was intended.</p>\n<figure class=\"stage\"><div class=\"frame bd-sky\"><div class=\"win\"><img src=\"/images/reviews/audio.jpg\" alt=\"\" loading=\"lazy\" decoding=\"async\" /></div></div><figcaption>My approval on the live audio change, with the two non-blocking notes.</figcaption></figure>\n<h2 id=\"what-i-bring-to-a-review\">What I bring to a review</h2>\n<ul><li>I check the change out in its own worktree and review it against the branch it merges into, so I review what will actually ship.</li><li>I give a real way each bug happens, not &quot;this might be an issue&quot;.</li><li>I keep blockers few and clear, and I say what&#039;s good so it stays.</li><li>I suggest the smallest fix and the test that will catch it next time.</li><li>I flag when a PR is doing too much, because a careful review needs a clear scope.</li></ul>","image":"https://promise-okafor.vercel.app/og/blog/how-i-review-pull-requests.png","date_published":"2026-11-17T08:00:00.000Z","date_modified":"2026-11-17T08:00:00.000Z","tags":["Code review","Architecture","Leadership"]},{"id":"https://promise-okafor.vercel.app/blog/build-the-test-that-fails-first/","url":"https://promise-okafor.vercel.app/blog/build-the-test-that-fails-first/","title":"Build the test that fails first","summary":"Three bugs I could not fix by reading code, and what I built on my desk to make each one fail before I touched the fix.","content_html":"<p>When a bug report comes in, I try to make the bug fail on my own desk before I write any fix. Then the fix has a job: turn that failure into a pass. Whatever I built stays behind, so it fails again if the fix is ever removed.</p>\n<p>A bug I can only read about is a bug I will guess at. Here are three where I did not have a good guess.</p>\n<h2 id=\"testing-live-answers-on-weak-connections\">Testing live answers on weak connections</h2>\n<p>At JobWhisper we got complaints that live answers came very late on weak connections, or never. I had no number for &quot;weak connection&quot;. I had only the complaints.</p>\n<p>So I built a small rig first. It plays two spoken questions with background noise between them, the way a real interview sounds, and sends them through a throttle that caps the upload speed. A stopwatch measures from the end of each question to the answer text on screen.</p>\n<p>The first run was bad. At 300 kbps the second question took about 20 seconds to show up. At 150 kbps it never did, and I stopped waiting after 35 seconds.</p>\n<p>The rig showed me something I would not have found by guessing. It was three connected problems, and each made the next one worse. We were uploading all the silence. Nothing slowed the sender down, so every question waited behind the backlog of the one before it. And the server hung up on clients that were too buried to answer its &quot;are you there&quot; check. Fixing only the first would have looked like progress while the server kept dropping calls.</p>\n<p>After the fixes, the second question at 300 kbps arrived in under 2 seconds, and at 150 kbps in 5.2 seconds instead of never. Those are times on the throttled rig, not production figures. The same rig is how I knew the first fix was not enough, and it is how I found what was still slow afterwards.</p>\n<h2 id=\"reproducing-a-windows-capture-failure-in-a-smaller-app\">Reproducing a Windows capture failure in a smaller app</h2>\n<p>The next one was a Windows bug in our desktop app. On Windows the app captures the sound of the call through the screen-sharing part of the browser engine. For several releases that capture failed with a permission error, and we had not seen it, because on a Mac the app takes a different path and never touches that code.</p>\n<p>Reading the permission code did not show me the problem. So I took almost everything out. I wrote a small standalone Electron app that mirrors the app&#039;s preload code, ran it with the app&#039;s permission handlers, and asked it for the capture.</p>\n<p>With the app&#039;s handlers in place, it failed with the same permission error. Then I let through the one kind of request that was being refused, and the capture came back with an audio track, a video track and frames flowing.</p>\n<p>That showed the cause in one small place. The browser engine sends the capture request with no media types listed. Our rule only allowed requests that asked for the microphone, so it answered no, before the real capture handler was ever asked. The fix lets that request through only while a capture is being set up. Everything else is still refused, so a page asking to share the screen at some other moment is still turned down.</p>\n<p>I should be plain about the limit here. I did not have a Windows machine in front of me, and the change description says so. The small app was my evidence, and the first real confirmation was always going to be the next install. I would rather say that than claim a result I did not watch.</p>\n<p>The reason I trust the small app is that it cut the question down. When the failing thing is that small, there is nowhere left for a wrong theory to hide.</p>\n<h2 id=\"nine-resumes-that-all-parsed-wrong-and-none-of-them-errored\">Nine resumes that all parsed wrong, and none of them errored</h2>\n<p>The last one is the one I like most, because nothing was broken in the usual sense. Resume upload on the server was not throwing errors. It was returning resumes that looked fine and were wrong.</p>\n<p>I took nine real uploaded resumes, exported from Google Docs, Word and Canva, one and two columns, designer and engineer layouts, and ran them through the exact upload path. All nine came out wrong, and none gave an error. That kind of failure is easy to miss, because nothing alerts anyone.</p>\n<p>The same few mistakes kept showing up:</p>\n<ul><li>A bullet character the parser did not know made one job with eight bullets turn into eight jobs, each titled with a sentence.</li><li>A line that the page had wrapped turned one email address into one ending in <code>.co</code>. It looked valid and went nowhere.</li><li>A name set in capitals looked exactly like a section heading, so the parser found no name, email or phone in files that had all three.</li><li>In two-column files the sidebar was read first, and one candidate&#039;s name came out as &quot;Contact&quot;.</li></ul>\n<p>The before numbers became the scoreboard. Bullets recovered: 1 of 9. Name, email and phone: 7 of 9 files were missing at least one. Files with no broken structure: 0 of 9.</p>\n<p>For each pattern I then wrote a test on an invented resume, shaped like the real one, and ran it against the old code first to watch it fail. I did that on purpose. A test that has never failed has not shown that it can. No real candidate&#039;s file went into the repository, because those are other people&#039;s resumes.</p>\n<p>After the change, bullets recovered went to 9 of 9, with two files that have none to recover. Name, email and phone were complete in 9 of 9, and none had broken structure. That is on the nine files, which is a small sample, and I said so in the change itself.</p>\n<p>It also left some things honestly unfixed. Two files still lose a few letters, because a broken font means the missing characters never reach us. The most crowded two-column file loses some employer names, because the layout does not survive as flat text. I left those as they were and noted them, because guessing would have put wrong facts about a person into their resume.</p>\n<p>This was the server&#039;s parser. A teammate later extended the parser heavily and made the browser and the server parse the same way. The nine-file pass and these fixes were mine.</p>\n<h2 id=\"what-the-three-have-in-common\">What the three have in common</h2>\n<p>None of them started with a theory. The throttle gave me a number where I had only complaints. The tiny app gave me a place where a wrong guess had nowhere to hide. The nine files gave me a scoreboard for something that never raised an error.</p>\n<p>In each case the thing I built was cheaper than one wrong fix. And each one stayed behind: a tiny harness I can rerun, a rig I can point at the next change, tests that go red if the fix is taken out.</p>\n<p>If I cannot make a bug fail on my desk, I treat that as the first thing to fix.</p>","image":"https://promise-okafor.vercel.app/og/blog/build-the-test-that-fails-first.png","date_published":"2026-11-11T08:00:00.000Z","date_modified":"2026-11-11T08:00:00.000Z","tags":["Debugging","Testing","Reproduction"]},{"id":"https://promise-okafor.vercel.app/blog/design-system-every-app/","url":"https://promise-okafor.vercel.app/blog/design-system-every-app/","title":"A design system every app can share","summary":"We moved a design onto our web apps and a React Native app, and the hardest decision was a number that looked like a bug, a root font size of 90%.","content_html":"<p>We needed our web apps and our React Native app to look like one product, but components could not be shared between them. So we shared the design&#039;s numbers instead, and each side builds its own components from them. The hard decision was one of those numbers, a root font size of 90%, and it was the one I was most tempted to get wrong.</p>\n<h2 id=\"why-the-components-are-not-shared\">Why the components are not shared</h2>\n<p>The browser components are React, built on Base UI for the accessible behavior. React Native does not run DOM elements, so none of that can move over. The native side is its own small set of pieces built from plain React Native views and text. There is no UI kit under it.</p>\n<p>What both sides can read is the values. Colors, type sizes, corner radii. The browser reads them from a CSS file. React Native reads the same values from a plain TypeScript file. A test checks that the two files agree, and that the important color pairs still pass the contrast rules.</p>\n<p>We also made it hard to go around them. A scan fails the build if a raw color shows up anywhere outside those two files. So when a designer changes a color, it changes in those two files, and the test keeps them matching.</p>\n<p>Sharing the values was the easy part. Getting their sizes right was harder.</p>\n<h2 id=\"the-design-was-drawn-at-90\">The design was drawn at 90%</h2>\n<p>The design we were given was authored with <code>html { font-size: 90% }</code>. So one rem in the design is 14.4 pixels, not 16. Every size in the design file, a heading at 1.5rem or a radius of 0.75rem, only looks right if the page uses that root.</p>\n<pre><code class=\"language-css\">html {\n  font-size: 90%;\n}</code></pre>\n<p>The usual move is to convert. Keep the root at 16 and multiply the design&#039;s values by 0.9. Our first pass did exactly that, and only for type and corner radius, because those were the two scales we were looking at.</p>\n<p>Type and corner radius looked right. The problem was everything we did not convert. Tailwind&#039;s spacing scale, its container widths, its default radii, and every rem written by hand during the port still held the design&#039;s own values. Under a 16px root, each of them rendered 11.1% larger than the design.</p>\n<p>Nobody would have filed that as a bug. The spacing and containers were just 11.1% bigger than drawn, and the page felt slightly loose in a way no one could point to.</p>\n<h2 id=\"match-the-root-do-not-convert-the-values\">Match the root, do not convert the values</h2>\n<p>We stopped converting. We set the root to 90% and kept every rem exactly as the design wrote it.</p>\n<p>A conversion has to be remembered at every value, forever. Tailwind&#039;s built-in utilities are not in our token file at all, so there is nowhere to apply a conversion even if you wanted to. Matching the root fixes all of them at once, including the ones no token override can reach. The numbers in our code are now the same numbers the designer wrote, so anyone comparing the two sees no difference.</p>\n<p>I used a percentage and not a pixel value on purpose. If a reader raises their browser&#039;s default text size, they still get 90% of their size. The page keeps scaling with them.</p>\n<p>The native side needed a small change of thinking. React Native has no rem. Its sizes are plain device pixels, so the shared file holds pixels, and 1.5rem at this root is 21.6 of them. The parity test between the two files divides the native value by 14.4 and compares it to the rem in the CSS. The comment in the test says why it is not 16: dividing by 16 would pass quietly on a UI that is 11.1% too big. A check that passes for the wrong reason is worse than no check.</p>\n<h2 id=\"what-it-cost\">What it cost</h2>\n<p>The root is a trade, and it cost us in three places we found along the way.</p>\n<blockquote><p><strong>What it cost</strong> Body text lands at 12.6px, because the design&#039;s base size is 0.875rem and a rem is 14.4px. That is small. I did not quietly raise it. I wrote it into the tokens doc as a design decision that needs the designer&#039;s sign-off, and left it alone.</p></blockquote>\n<p>Touch targets shrank the same way. A control sized at 2.75rem, which the design draws as 44px, renders at 39.6px. That clears the 24px minimum in WCAG 2.2 AA, but it is under the 44px the design asked for. The doc says so too.</p>\n<p>Some small controls went under the line altogether. On the desktop app, a compact segmented control came out at 21.6px and a small switch&#039;s tappable area at 22px, both below the 24px floor. I fixed those by giving them explicit pixel sizes and checked the result by clicking the extended area, not by reading the CSS.</p>\n<p>And on phones in a browser, iOS Safari zooms the page when you focus any text field under 16px. With a 90% root, even our base text size computes to 14.4. So every text input now pins a literal 16px on small screens and keeps the design&#039;s own scale above that.</p>\n<p>None of these were a reason to go back. Each one was a visible, local problem we could name, and we fixed all but the body text, which waits on the designer. The 11.1% drift was invisible and everywhere.</p>\n<h2 id=\"how-we-keep-it-honest\">How we keep it honest</h2>\n<p>A decision like this rots unless the repository defends it. Three things help hold it in place.</p>\n<p>The parity test fails if the native pixel values and the CSS rems stop describing the same rendered size. The raw-color scan fails the build if someone writes a hex code outside the token files. And the tokens doc says in plain words what the root is, why, and what it costs, so the next person to touch it does not &quot;fix&quot; the 90% back to 100%.</p>\n<p>One gap is still open. The dark palette lives in two CSS blocks that have to stay identical, one for an explicit choice and one for the system setting. The doc says they must match. The test only checks that each value appears somewhere in the file, so a drift between the two blocks would not be caught.</p>\n<h2 id=\"what-i-took-from-it\">What I took from it</h2>\n<p>We kept the 90% root. It cost us smaller body text, a few controls that needed explicit sizes and a 16px rule for inputs on phones, and all of it is written down where the next person will find it. When a design and your platform disagree about a base unit, I would change the base again, not every value that depends on it.</p>","image":"https://promise-okafor.vercel.app/og/blog/design-system-every-app.png","date_published":"2026-11-11T08:00:00.000Z","date_modified":"2026-11-11T08:00:00.000Z","tags":["Design systems","CSS","React Native","Accessibility"]},{"id":"https://promise-okafor.vercel.app/blog/four-seconds-to-one/","url":"https://promise-okafor.vercel.app/blog/four-seconds-to-one/","title":"4 seconds to 1 second","summary":"A wait feels shorter when the useful part shows first, and my first speed-up taught me to measure where the wait really is before touching anything.","content_html":"<p>Most of the time, a slow screen is not one slow thing. It is a line of small waits, and each one stands behind the one before it. I learned that on a live feature where the screen stayed empty for about 3.8 seconds, and it came down to about 1 second. Almost none of that came from making a step faster.</p>\n<p>My first fix did nothing, and that taught me more than the ones that worked.</p>\n<h2 id=\"the-wait\">The wait</h2>\n<p>The feature was an interview assistant. It listens to the interviewer and shows the candidate an answer while the conversation is still going. After the interviewer stopped talking, the screen stayed empty for about 3.8 seconds. Then the whole answer dropped in at once.</p>\n<p>In a live conversation, four seconds of nothing is a long time. By the time the answer shows up, the moment has moved on. Any screen that waits on a slow back end and then shows everything in one go has the same shape.</p>\n<h2 id=\"find-the-wait-before-fixing-it\">Find the wait before fixing it</h2>\n<p>I did not want to guess. I sent real spoken questions to the server in small pieces, the way a live call sends them, and timed each step from the server side, with one clock for each comparison.</p>\n<figure class=\"wide\">\n<div class=\"flow\">\n<div><b>Question ends</b>The clock starts here</div>\n<div><b>Transcript</b>The question as final text</div>\n<div><b>First words</b>The first text of the answer</div>\n<div><b>Complete</b>The whole answer on screen</div>\n</div>\n<figcaption>The four marks I timed. Each change below moves one of them.</figcaption>\n</figure>\n<p>That run showed two dead spots, and they had different causes. One was before the call even started: the live connection took between 1.6 and 2.4 seconds to open, because the server finished a slow handshake with another service before it let the app in. The other was inside the answer. It arrived as one finished block, so the app typed out text it already had.</p>\n<p>Neither was what I would have guessed. I would have started with the model.</p>\n<h2 id=\"start-earlier-not-faster\">Start earlier, not faster</h2>\n<p>The first two fixes were about order, not speed.</p>\n<p>For the connection, I let the app in first and finished the slow handshake behind it. The server tells the app when the other side is ready, and until then the app says &quot;connecting&quot;. It is like opening the shop door while the till is still starting up. The customer walks in straight away, and we tell them when we can take an order. Socket open went from 1.6 to 2.4 seconds to about 0.65 seconds, in local testing.</p>\n<blockquote><p><strong>What it cost</strong> Audio that arrives before the other side is ready is dropped, not queued. And I had to handle that side failing after the door is already open. The server says so, closes cleanly, and lets a retry start fresh.</p></blockquote>\n<p>For the answer, the server now sends it as it is written instead of waiting for the end. Each message carries the whole text so far, and the newest one replaces the last. I chose replace over add-on because a message can arrive late or go missing, and replacing avoids a gap or a doubled word when that happens. First text on screen came down from 3.8 to 2.1 seconds, in local testing.</p>\n<p>Then I changed the order of the fields the model returns. It returns its reply as structured data, and it writes the fields in the order we list them. We listed the question first, so it spent its first words repeating the question back, which nobody was waiting for. I put the answer first. Measured one character at a time, the first visible text now showed up after 12 characters of reply, down from 43.</p>\n<h2 id=\"the-fix-that-did-nothing\">The fix that did nothing</h2>\n<p>The biggest remaining wait was the one before the answer even began. The answer could not start until the question was fully transcribed, and the question was usually clear from its first few words. So the obvious move was to start answering the moment the interviewer went quiet, using the last partial transcript we had.</p>\n<p>I built that, and it looked right. Then I measured it against the real transcription service, and it changed nothing.</p>\n<p>The service only sends its partial transcripts after its own silence detector has already decided the turn is over. At the moment of silence there was no partial to start from. The text arrived about a quarter of a second after the silence, and about 0.7 seconds before the finished sentence. My change was waiting for something that came too late to help.</p>\n<p>I wrote that in the commit message in plain words: the change shipped but did nothing. Only a measurement against the real provider showed it.</p>\n<p>So I moved the start. The answer now begins on the first partial of five or more words that looks like a question, once per turn. That one worked. The first piece of the answer now comes about one second after the interviewer stops. Measured locally with a spoken question, the first piece of the answer showed up about 0.73 to 0.93 seconds after the final transcript, which is about one second after the interviewer stops. Before this stack of changes the same point was 1.9 to 2.3 seconds after the silence.</p>\n<figure class=\"wide\">\n<div class=\"bars\">\n<span class=\"lab\">First answer text, from the end of the question</span><div class=\"bar2\"><i style=\"width:76%\"></i>3.8 s, one finished block</div><div class=\"bar2 after\"><i style=\"width:42%\"></i>2.1 s, after streaming</div><div class=\"bar2 after\"><i style=\"width:20%\"></i>about 1 s, after starting early</div>\n</div>\n<figcaption>Measured on my machine with spoken test questions. These are local runs, not production numbers.</figcaption>\n</figure>\n<blockquote><p><strong>What it cost</strong> Starting early means the model may answer the gist of a partial whose final text differs a little. That is the price of starting before you know the whole question. To keep it safe, no part of an answer is shown before the question it belongs to, and the answer is labelled with the final transcript, not the guess.</p></blockquote>\n<p>Starting early broke something too. Measured live, the model sometimes declined a short opening, and the turn was marked as answered, so no answer ever came. I fixed that so a decline asks again once the full question arrives.</p>\n<h2 id=\"show-the-useful-part-first\">Show the useful part first</h2>\n<p>Each change above had the same aim. The person does not need the whole answer at once. They need the first words, early, so they can start reading while the rest arrives. Opening the door first, streaming, putting the answer field first and starting on a partial are all ways of getting the first useful piece in front of someone sooner. None of them made the model faster.</p>\n<p>I did turn one dial on a step itself, near the end, and only because a measurement pointed at it. In a later end-to-end run with a real spoken question, the final transcript took 0.47 seconds, the first answered words 1.5 seconds and the full answer 2.2 seconds. The wait for silence was about a third of the time to the first words. So I shortened that window to 400 milliseconds. A shorter one, 300, chopped sentences at breaths, so 400 is the shortest I tried that still closes on a real pause. It stays a setting, so each environment can change it.</p>\n<p>You will notice that run says 1.5 seconds and the earlier ones say about 1. They are different runs on different days with slightly different clocks, so they do not match exactly. I kept one clock for each comparison, and I would sooner show you both than pick the nicer number.</p>\n<h2 id=\"what-was-still-wrong\">What was still wrong</h2>\n<p>All of these are local runs on a good connection. I had no baseline for real users, so I cannot tell you the production figure. A slow connection was a different problem, and I took it on next in a separate piece of work. Starting early also still guesses, and I had no count of how often it guessed wrong.</p>\n<p>So the next thing I built was a timer for every question, on the server and in the app, merged into one row of numbers with no text in it. It is there so the next change can be judged against data, not a feeling.</p>\n<h2 id=\"what-i-took-from-it\">What I took from it</h2>\n<p>Measure where the wait is before you change anything, because my first speed-up looked right and did nothing. Then ask what can start earlier, and what the person can see first, before asking how to make a step faster.</p>","image":"https://promise-okafor.vercel.app/og/blog/four-seconds-to-one.png","date_published":"2026-11-11T08:00:00.000Z","date_modified":"2026-11-11T08:00:00.000Z","tags":["Performance","Latency","Perceived speed","Frontend"]},{"id":"https://promise-okafor.vercel.app/blog/merged-is-not-deployed/","url":"https://promise-okafor.vercel.app/blog/merged-is-not-deployed/","title":"Merged is not deployed","summary":"After a big merge our production deploys stopped while the pipeline stayed green, and what I changed so a green check is never the end of a release.","content_html":"<p>Our pipeline was green, and production was still serving the build from before a large merge. A green pipeline tells you the code built. It does not tell you that your users have it.</p>\n<h2 id=\"what-happened\">What happened</h2>\n<p>We had just merged a large change that brought a mobile app into our frontend monorepo. Afterwards, someone tested a fix on our dev site and saw the old behaviour. The fix was merged. CI was green.</p>\n<p>So the code was fine. The site was still serving a build from before the merge.</p>\n<h2 id=\"first-find-out-what-is-really-being-served\">First, find out what is really being served</h2>\n<p>I stopped looking at GitHub, because GitHub only knows what was merged. It has no record of what a hosting platform did afterwards. So I asked the site itself.</p>\n<pre><code class=\"language-sh\">curl -sI &quot;https://app.example.com/?cb=$(date +%s)&quot; | grep -i last-modified</code></pre>\n<p>The query string changes the URL, so I am not handed a cached copy. The <code>last-modified</code> date was from before the merge. I did the same for production, and its date was old too. Nothing had gone out since the merge, on either one.</p>\n<p>For a second opinion I looked for a piece of new copy inside the served JavaScript file. It was not there. Two checks, same answer.</p>\n<h2 id=\"then-make-it-fail-somewhere-i-can-watch\">Then make it fail somewhere I can watch</h2>\n<p>The deploy build runs on a machine I cannot see, so I reproduced it on mine. I took a clean export of the branch, with no local files and no old caches, installed from the lockfile the way the deploy does, and ran the same build command the Dockerfile runs. I also made sure the CI setting was off, because the hosting platform&#039;s build does not have it.</p>\n<p>It failed straight away with one line: the workspace is out of sync.</p>\n<p>Now the picture was clear. Nx, our build tool, keeps TypeScript project references in step with the dependencies between our packages. When the mobile app arrived, those references were out of date, so a sync was always waiting. When Nx runs inside CI it carries on regardless. When it runs anywhere else, it refuses to build until the sync is applied. Our deploy builds are not CI, so every one of them stopped at that line, and the platform kept serving the last build that had worked.</p>\n<figure class=\"wide\">\n<div class=\"flow\">\n<div><b>Merge</b>Code lands on the branch</div>\n<div><b>CI</b>Builds with the CI setting on. Green</div>\n<div><b>Deploy build</b>Same command without it. Stops at \"out of sync\"</div>\n<div><b>Served site</b>Still the old build</div>\n</div>\n<figcaption>Two builds of the same code, and only one of them checks that the workspace is in sync. The one users depend on is the one that stopped.</figcaption>\n</figure>\n<h2 id=\"the-hard-part\">The hard part</h2>\n<p>Running the sync and committing the result would fix the deploys. It would also break something else.</p>\n<p>The mobile app reads its workspace packages from source, not from built output. One of those packages is source only, so it has no built declarations at all. The sync wanted to add a project reference to it. With the reference in place, the type checker looked for build output that did not exist, and the mobile type check failed.</p>\n<p>The tool&#039;s suggestion would have fixed deploys and broken the mobile type check. I did not want to trade one for the other on a day when production was already behind.</p>\n<h2 id=\"decisions-and-tradeoffs\">Decisions and tradeoffs</h2>\n<h3 id=\"skip-the-check-in-the-deploy-build\">Skip the check in the deploy build</h3>\n<p>A deploy builds one app. It does not need project references to be tidy, because it only needs the app to compile and bundle. So I added the flag that skips the sync check to the deploy build of each app, and left a comment next to it that says why, so nobody removes it later without knowing.</p>\n<p>I sent the fix to the dev branch, and the same fix straight to the branch production builds from, because production was just as stuck. Before I called it fixed, I ran the clean-export build again. It failed without the flag and passed with it, for every app.</p>\n<h3 id=\"then-fix-the-real-drift-and-make-ci-see-it\">Then fix the real drift, and make CI see it</h3>\n<p>Skipping a check can hide a real problem, so the same day I dealt with the drift itself. The references that were harmless went into the repo. For the source-only package I used the sync tool&#039;s own setting to leave that one dependency out, so the mobile type check stays happy.</p>\n<p>Then I added the sync check to CI. Before, drift only showed up in a deploy, where nobody was looking. Now it fails a pull request, where everybody is.</p>\n<p>I kept the flag in the deploy builds as well. CI now owns that check, so the deploy does not need to repeat it.</p>\n<h3 id=\"make-the-served-build-the-check\">Make the served build the check</h3>\n<p>The team had no way to tell that a successful merge had not reached anybody, and for a while we believed the work was live. The rule we took on: after a merge that matters, someone looks at the served build before saying it is out.</p>\n<p>It is a small check:</p>\n<ol><li>Ask the live site for its <code>last-modified</code> date, with a cache-buster, and compare it to the time of the merge.</li><li>For a change you can see, find one new string from it in the served JavaScript.</li></ol>\n<p>It is quick, and it looks at the thing users actually get.</p>\n<h2 id=\"result\">Result</h2>\n<p>Deploys could build again for every app, on dev and on production. After that, a sync problem fails in CI instead of in a deploy. And &quot;merged is not deployed, check the served build&quot; became something the team does, not something I remember.</p>\n<p>I do not have a figure for how long users were behind, so I will not give one. What I can say is that nothing in our tools told us. A person had to notice.</p>\n<h2 id=\"what-was-still-wrong\">What was still wrong</h2>\n<p>The check I added is still a person looking. If someone forgets, the same silence can come back from a different cause. A tidier answer would be for the site to say which build it is. A version file served next to the app, or a version in the page itself, would let a script compare it to the commit that was merged and shout when they differ. I have not built that, and it is the next thing I would add.</p>\n<h2 id=\"what-i-took-from-it\">What I took from it</h2>\n<p>After an important merge we now check the served build, and CI catches project reference drift before it reaches a deploy.</p>","image":"https://promise-okafor.vercel.app/og/blog/merged-is-not-deployed.png","date_published":"2026-11-11T08:00:00.000Z","date_modified":"2026-11-11T08:00:00.000Z","tags":["Deployment","CI","Nx","Releases"]},{"id":"https://promise-okafor.vercel.app/blog/one-access-rule/","url":"https://promise-okafor.vercel.app/blog/one-access-rule/","title":"One access rule for the API and the socket","summary":"If an app has both HTTP routes and a live connection, one pure function should answer every permission question, and a short ticket should never be trusted as the answer.","content_html":"<p><a href=\"https://github.com/theolodocoder/morrow\" target=\"_blank\" rel=\"noreferrer\">Morrow</a> is a writing platform where people edit the same chapter at once. It has HTTP routes and a live socket, and I wanted both to answer permission questions with the same rule, so I put that rule in one function. If each had its own check, the two would disagree sooner or later. Morrow is my own project, it is pre-release, and it has no users. So this is about how it is built and tested, not how it behaves in the wild.</p>\n<h2 id=\"why-two-checks-drift\">Why two checks drift</h2>\n<p>The API is where permission checks get written first. A route loads the work, looks at the person&#039;s role and says yes or no. Then the live socket arrives, and it needs the same answer. The quick way is to copy the logic across, with a small change for the way sockets work.</p>\n<p>Once the logic is copied, the two copies can drift. Someone changes how editors are treated in the API, and the socket still has the old idea. Or the API gets a new restriction, like suspended accounts, and the socket never hears about it.</p>\n<p>The worst case is a reader. If the socket forgets that a person is only a viewer, they can type into the chapter, and every other writer sees it. No API route was ever called, so nothing in the API logs would show it.</p>\n<h2 id=\"one-pure-function-called-from-both-doors\">One pure function, called from both doors</h2>\n<p>In Morrow there is one function, <code>can(actor, capability, ctx)</code>, in a package both services import. It is pure. It takes who is asking, what they want and the facts about the work, and returns true or false. It reads nothing and writes nothing.</p>\n<pre><code class=\"language-ts\">export function can(actor: Actor, capability: Capability, ctx: AccessContext): boolean {\n  const { work } = ctx\n  if (work.deleted) return false\n  // The owner relationship is authoritative even if a membership row is missing or stale.\n  const role = actor.userId !== null &amp;&amp; actor.userId === work.ownerId ? &#039;owner&#039; : ctx.role\n  ...\n  if (capability === &#039;document.edit&#039;)\n    return role !== null &amp;&amp; DIRECT_WRITERS[effectiveMode(ctx)].has(role)</code></pre>\n<p>The API calls it in the routes that act on a work. The collab service, which runs the live connection, calls it when a socket connects. The UI never decides anything. It only draws what <code>can()</code> said.</p>\n<p>Pure matters because the function only reads what it is passed. The caller loads the facts, from the same database query helpers, and passes them in. So there is nothing about HTTP or sockets inside the rule to fork.</p>\n<p>The API adds one small thing on top. If the person cannot even read the work, the answer is 404, so it never confirms the work exists. If they can read it but lack the capability, the answer is 403.</p>\n<h2 id=\"what-a-ticket-proves-and-what-it-does-not\">What a ticket proves, and what it does not</h2>\n<p>A browser cannot send custom headers when it opens a socket, so the socket needs a credential some other way. In Morrow the API checks <code>can()</code> first, then signs a ticket: a user, one chapter, a mode of edit or read, and an expiry 60 seconds away. The socket verifies the signature, but that is only the first step.</p>\n<pre><code class=\"language-ts\">export const TICKET_TTL_SECONDS = 60\nexport type TicketMode = &#039;edit&#039; | &#039;read&#039;</code></pre>\n<p>A ticket proves one thing: the API said yes about this person and this chapter when it signed the ticket. It does not prove the person is allowed now. They might have been removed a second after it was signed. It also does not prove the mode is right. The mode is what the person asked for, and an edit ticket can sit in the hands of someone who has since become a viewer.</p>\n<p>So when collab gets a connection, it checks the signature and then asks the database again who this person is now. The read-only flag comes from that answer, not from the ticket:</p>\n<pre><code class=\"language-ts\">const readOnly = !(mayEdit &amp;&amp; mode === &#039;edit&#039;)\nconnectionConfig.readOnly = readOnly // enforced by the server: updates from read-only connections are dropped</code></pre>\n<p>The server drops the updates itself. It does not rely on the browser behaving.</p>\n<h2 id=\"connections-that-outlive-the-decision\">Connections that outlive the decision</h2>\n<p>A socket stays open for hours. A decision made at connect time gets old.</p>\n<p>Morrow handles this two ways. When a member is removed, the API sends a signed call to collab, and collab closes that person&#039;s connections and tells them why. And as a backstop, collab re-checks a live connection on its next message, at most every 30 seconds. If the revoke call is lost, the re-check still catches it on that connection&#039;s next message.</p>\n<p>When a live editor is turned into a viewer, I do not flip the read-only flag on the open connection. In an early spike that left the person&#039;s screen out of step with the document, with no error. So the connection is closed and the client reconnects, which means a fresh ticket at the new role.</p>\n<h2 id=\"the-tests-that-keep-it-honest\">The tests that keep it honest</h2>\n<p>I wrote tests that try to get around the rule: stale tickets, read-only connections and revoked access. Three of them matter most.</p>\n<p>The first mints an edit ticket for a viewer, connects, types, and checks that nothing reaches the database:</p>\n<pre><code class=\"language-ts\">it(&#039;an edit ticket for a viewer still yields read-only (the database decides, not the ticket)&#039;, ...</code></pre>\n<p>The second connects a viewer and an owner to one chapter. Both type. Then it checks that the viewer&#039;s words were neither saved nor sent to the owner.</p>\n<p>The third removes a member, calls the revoke, and checks that the connection is closed and the client is told <code>access_changed</code> in under a second. A fourth drops the revoke call on purpose and checks that the re-check closes the connection anyway.</p>\n<p>These run against a real Postgres, with a fresh database per test file, not mocks. I wanted to see how the real database answers, because a mocked one agrees with whatever I wrote.</p>\n<p>I also broke the code on purpose. In the spike I removed the database re-check, then the read-only enforcement, then the revoke call, and each time the right test failed. A test that cannot fail tells you nothing.</p>\n<p>One more trap. The auth library I use skips its origin check when it detects a test run. So my cross-site request tests would have passed and proved nothing. I turned the check on explicitly.</p>\n<h2 id=\"what-it-cost\">What it cost</h2>\n<p>Morrow has two services, the API and collab, so there are two things to deploy and run. I kept them apart because in one process every API deploy would drop every writer&#039;s connection.</p>\n<p>Each chapter open needs an extra round trip to get a ticket. I did not measure how long that takes. The 30 second re-check interval is a setting I picked, not a measured result.</p>\n<h2 id=\"what-i-took-from-it\">What I took from it</h2>\n<p>Put the rule in one pure function and call it from every door. Treat a ticket as a note that someone said yes a minute ago, and ask again when it matters. Then write the tests that try to break it, and remove the check once to see them fail.</p>","image":"https://promise-okafor.vercel.app/og/blog/one-access-rule.png","date_published":"2026-11-11T08:00:00.000Z","date_modified":"2026-11-11T08:00:00.000Z","tags":["access control","websockets","testing"]},{"id":"https://promise-okafor.vercel.app/blog/building-paje/","url":"https://promise-okafor.vercel.app/blog/building-paje/","title":"Building Paje to understand what frameworks hide","summary":"Why I built a small reactive UI runtime in vanilla JavaScript, how its state and rendering work, and what I learned from the parts frameworks usually hide.","content_html":"<p>After years of shipping products with mature frameworks, I wanted to see what happens between a state change and the DOM updating. So I built Paje, a small reactive UI runtime written in vanilla JavaScript. It is not an attempt to replace React, Angular, or Vue. It is an exercise in making the hidden parts explicit: how state moves, how actions become updates, how a view becomes DOM, and how every listener and node is cleaned up again.</p>\n<blockquote><p>I wanted to find out how little code it takes before a UI starts to feel reactive.</p></blockquote>\n<p>This article walks through the current architecture, the decisions behind it, and the places where keeping the system small forced me to think more clearly.</p>\n<h2 id=\"start-with-the-contract\">Start with the contract</h2>\n<p>Paje begins with one public primitive: <code>createPaje</code>. It accepts initial state, a view function, and a map of reducers. The shape is intentionally unsurprising.</p>\n<pre><code class=\"language-javascript\">const app = createPaje(\n  { count: 0 },\n  (state, emit) =&gt; h(&quot;div&quot;, { class: &quot;counter&quot; }, [\n    h(&quot;strong&quot;, {}, [`Count: ${state.count}`]),\n    h(&quot;button&quot;, { on: { click: () =&gt; emit(&quot;increment&quot;) } }, [&quot;Add one&quot;]),\n  ]),\n  {\n    increment: (state) =&gt; ({ ...state, count: state.count + 1 }),\n  },\n);\n\napp.mount(document.querySelector(&quot;#app&quot;));</code></pre>\n<p>There are only three ideas to hold at once:</p>\n<ul><li><strong>State</strong> is the current truth of the interface.</li><li><strong>The view</strong> is a pure description of what that state should look like.</li><li><strong>Reducers</strong> describe the legal transitions between states.</li></ul>\n<p>That API is small because the runtime carries the coordination burden. Calling <code>emit(&quot;increment&quot;)</code> dispatches an action, the matching reducer returns new state, and an after-dispatch hook renders the next view.</p>\n<p>The public contract was the first architecture decision. Before building internals, I wanted to know what the runtime promised its caller, and just as importantly, what it did not promise.</p>\n<h2 id=\"the-architecture-is-a-loop\">The architecture is a loop</h2>\n<p>At its core, Paje is a loop rather than a collection of features.</p>\n<ol><li>A user event emits a named action.</li><li>The dispatcher sends the payload to subscribed reducers.</li><li>A reducer produces the next state.</li><li>An after-command handler asks the view for a new virtual tree.</li><li>The renderer commits that tree to the DOM.</li></ol>\n<p>This separation matters. The dispatcher knows nothing about DOM nodes. Reducers know nothing about event listeners. The renderer knows nothing about why state changed. Each piece has one reason to change, which makes the runtime easier to inspect.</p>\n<p>The dispatcher is a small publish/subscribe system backed by a <code>Map</code>. Subscriptions return unsubscribe functions, so ownership and cleanup are part of the design rather than an afterthought.</p>\n<pre><code class=\"language-javascript\">subscribe(commandName, handler) {\n  if (!this.#subs.has(commandName)) this.#subs.set(commandName, []);\n\n  const handlers = this.#subs.get(commandName);\n  handlers.push(handler);\n\n  return () =&gt; {\n    const index = handlers.indexOf(handler);\n    handlers.splice(index, 1);\n  };\n}</code></pre>\n<p>The interesting detail is the global after-command hook. Reducers update state first; rendering happens after dispatch completes. That gives Paje a clear phase boundary: transition, then render.</p>\n<h2 id=\"virtual-nodes-without-special-syntax\">Virtual nodes without special syntax</h2>\n<p>Paje uses a hyperscript function called <code>h()</code> instead of a template compiler or JSX transform. A call creates a plain object describing an element:</p>\n<pre><code class=\"language-javascript\">function h(tag, props = {}, children = []) {\n  return {\n    tag,\n    props,\n    children: mapTextNodes(withoutNulls(children)),\n    type: DOM_TYPES.ELEMENT,\n  };\n}</code></pre>\n<p>Text and fragments have their own node types. Strings in a children array are normalized into text nodes, and null children are removed before the renderer sees them.</p>\n<p>That normalization step looks minor, but it creates an important boundary. Code above it can be flexible; code below it can rely on a stable shape. Mature frontend systems use this pattern everywhere: accept a broad input at the edge, normalize it once, and keep the core strict.</p>\n<p>Choosing plain objects also makes the abstraction observable. You can log a Paje view and see exactly what the runtime will traverse. There is no compiler output to decode and no private element format to guess at.</p>\n<h2 id=\"rendering-and-ownership\">Rendering and ownership</h2>\n<p>The renderer switches on three node types (text, element, and fragment) and delegates each to a small mounting function. Element mounting creates a real DOM node, applies attributes and listeners, recursively mounts children, then appends the result to its parent.</p>\n<p>Every virtual node keeps a reference to the real node it created. Event handlers are stored as well. Those references make unmounting deterministic:</p>\n<ul><li>child nodes are destroyed recursively;</li><li>registered listeners are removed with the same handler references;</li><li>DOM nodes are removed from their parent;</li><li>application subscriptions are released when the app unmounts.</li></ul>\n<p>This is one of the strongest lessons from the project: <strong>lifecycle is an ownership problem</strong>. Creating a node is only half of a renderer. A reliable system must also know who owns the resources created along the way and how that ownership ends.</p>\n<p>It is easy to demo a click handler. It is harder, and more representative of production engineering, to ensure the handler does not survive the interface that created it.</p>\n<h2 id=\"the-deliberate-limitation\">The deliberate limitation</h2>\n<p>Paje currently replaces the rendered tree after an action. If a previous virtual tree exists, the runtime destroys it, asks the view for the next tree, and mounts that tree from scratch.</p>\n<pre><code class=\"language-javascript\">function renderApp() {\n  if (vdom) destroyDom(vdom);\n  vdom = view(state, emit);\n  mountDom(vdom, parentEl);\n}</code></pre>\n<p>Calling the structure a virtual DOM does not magically make it efficient. The current tree is a DOM description and lifecycle record; it is not yet used for reconciliation.</p>\n<p>That constraint is intentional at this stage. Full replacement gives the project a simple baseline with a very small surface area. Before introducing keys, patch operations, and child reconciliation, I want the lifecycle rules to be unambiguous.</p>\n<p>The next renderer can then be measured against something concrete:</p>\n<ul><li>Does it preserve input focus and selection?</li><li>Can it patch attributes without leaking listeners?</li><li>How does it behave when keyed children reorder?</li><li>What is the cost of diffing compared with replacement for small trees?</li><li>Can an interrupted update leave the DOM and virtual tree out of sync?</li></ul>\n<p>The senior engineering lesson is not “always start simple.” It is <strong>name the capability you have not built</strong>. Precise limitations make an architecture easier to evolve than ambitious labels do.</p>\n<h2 id=\"tiny-apis-still-need-policy\">Tiny APIs still need policy</h2>\n<p>Attribute handling revealed how quickly a renderer becomes a policy engine. Classes can arrive as a string or an array. Styles are applied property by property. <code>data-*</code> values use <code>setAttribute</code>, while other values are assigned as DOM properties. A null value means removal.</p>\n<p>Every one of those choices has edge cases. Boolean attributes behave differently from strings. Some DOM properties reflect attributes and some do not. Style values may need units. Controlled form values introduce cursor and selection concerns.</p>\n<p>This is why “just render an object” becomes framework work. The loop is small; the platform contract is not.</p>\n<p>Paje keeps the current policy isolated in <code>attributes.js</code>. That means future support for boolean attributes, ARIA validation, or style normalization has a clear home instead of spreading across mounting logic.</p>\n<h2 id=\"what-i-would-evolve-next\">What I would evolve next</h2>\n<p>The project has a useful core, but I see the current implementation as a foundation. The next stages are less about adding a long feature list and more about strengthening guarantees.</p>\n<h3 id=\"reconciliation-with-measurable-rules\">Reconciliation with measurable rules</h3>\n<p>I would add a patching layer that compares old and new nodes by type, tag, props, and stable keys. The important work is not only reducing DOM operations; it is defining predictable identity. Inputs, animations, and local browser state all depend on the renderer knowing when an element is “the same” element.</p>\n<h3 id=\"scheduled-and-batched-updates\">Scheduled and batched updates</h3>\n<p>Today, every dispatch reaches the render phase synchronously. Batching multiple actions into one commit would prevent redundant work and introduce a natural place for prioritization later. The key is to preserve the mental model: actions remain deterministic even if commits are scheduled.</p>\n<h3 id=\"better-developer-diagnostics\">Better developer diagnostics</h3>\n<p>A tiny runtime is an excellent place for precise error messages. Invalid node types, missing mount targets, duplicate keys, unknown actions, and reducer exceptions should fail with context that points directly to the caller’s mistake.</p>\n<h3 id=\"a-more-rigorous-test-matrix\">A more rigorous test matrix</h3>\n<p>Paje has no real tests yet. The repository holds only a placeholder test, so none of this behavior is checked automatically. Renderer confidence would come from behavioral tests: mount, update, reorder, detach, and remount. I would also add leak-focused tests that count listeners and verify cleanup across repeated lifecycle cycles.</p>\n<h2 id=\"what-building-paje-changed-for-me\">What building Paje changed for me</h2>\n<p>Building a runtime sharpened the way I use production frameworks. Reconciliation is no longer a vague optimization; it is an identity system. Effects are not just callbacks; they are owned resources with cleanup contracts. State libraries are not magic; they are transition rules, subscription graphs, and scheduling decisions.</p>\n<p>It also reinforced a broader architectural habit: separate mechanism from policy.</p>\n<ul><li>The dispatcher is a mechanism for delivering actions.</li><li>Reducers are the policy for changing state.</li><li>Mounting is a mechanism for creating DOM.</li><li>Attribute handling is the policy for translating props to the platform.</li></ul>\n<p>Keeping these responsibilities separate gives me clear places to work as I add reconciliation, scheduling and better error messages.</p>\n<p>Paje is deliberately small, but the questions it exposes are the same ones that matter in large frontend platforms: identity, ownership, predictability, scheduling, and the cost of abstraction.</p>\n<p>I am building it because understanding the loop makes me better at working with the frameworks teams depend on every day.</p>\n<hr />\n<p><em>Paje is an evolving open-source learning project. I will use future notes to document reconciliation, scheduling, testing, and the trade-offs that appear as the runtime grows.</em></p>","image":"https://promise-okafor.vercel.app/og/blog/building-paje.png","date_published":"2026-07-17T08:00:00.000Z","date_modified":"2026-07-17T08:00:00.000Z","tags":["JavaScript","Runtime Architecture","Virtual DOM","Frontend"]}]}