Skip to content
Source
Sign inSign up
samwillis/hackernews-realtime
Open History to see the last commit

validation.md

359 lines22.0 KB

1# Demo validation — 2026-10-12
2​
3The working demo is deployed at
4[hackernews-realtime.vercel.app](https://hackernews-realtime.vercel.app/), backed
5by a dedicated Neon staging project. Implementation is complete. Launch
6acceptance in [PLAN.md](../PLAN.md) is still open where listed below.
7​
8## Completed checks
9​
10- A checkout with empty SDK packages, source checkout and dependencies fetched
11 pinned Neon commit `3c08c9b45a919515a7b79977fa6267f828ce52d5`, verified package
12 hashes, installed the frozen app lockfile, type checked, ran tests and built
13 the production app. A second bootstrap produced identical normalized hashes.
14- Unit coverage checks rank swaps/inserts, bounded feed/page inputs, safe URL
15 schemes, title entities, missing/deleted items and jobs.
16- Database integration coverage uses an isolated staging schema. It checks
17 concurrent acquisition, unchanged-row suppression, unauthorized and stale
18 fencing, incomplete-snapshot rollback, atomic ranks, prepared handoff,
19 takeover after expiry and the absolute invocation deadline.
20- Real HN stories render on the server, then update through Neon Realtime.
21 Two tabs received score/count changes and feed changes. The explicit sort
22 preserves source rank after snapshots. Query-capability renewal was observed
23 beyond the initial expiry.
24- Pause freezes IDs/ranks/scores/counts while ages continue advancing. Resume
25 applies current data. Comment counts now open local discussions; replies,
26 submissions, votes and profiles have canonical HN destinations. Deployed More navigation showed 30 unique rows
27 with ranks 31–60. Keyboard Space toggles pause/resume and highlighting; Tab
28 reaches the HN vote link with a visible focus outline.
29- Desktop appearance was compared with current HN. The deployed mobile page
30 was checked at 390 × 844: its page and document widths are 390px, header and
31 titles wrap, and there is no horizontal overflow.
32- The production artifact contains traced Postgres runtime dependencies and
33 bundled Neon server code. Browser assets were scanned against the actual
34 database credentials and sealing secret without finding either. Credentials,
35 resource responses, toolchains and build artifacts are ignored by Git.
36- Package audit reported zero known vulnerabilities after replacing the full
37 Firebase distribution with its app/database packages.
38​
39## Live discussions and header update
40​
41The October 12 follow-up is deployed as
42`hackernews-realtime-rmj3p34a0-samwillis-projects.vercel.app`, with the stable
43production alias above. Branding is Hacker Realtime, with a 22×22px RT mark
44and square RT favicon. Header navigation is top/new/submit. Pause, highlight,
45Realtime connection and upstream health controls are inside the orange header.
46​
47- A new frozen install in the previously verified clean checkout passed the
48 TypeScript check, ten unit tests, and the pinned Vercel production build.
49 npm audit reported zero vulnerabilities. All 26 public build assets passed
50 a scan against the actual database credentials and sealing secret.
51- New unit coverage checks independent number pulses, retention/expiry during
52 overlapping updates, arrivals/moves/removals, safe HN comment formatting,
53 bounded/cyclic trees, nested order and strict story IDs.
54- The isolated database test passed with comments added: unchanged snapshots
55 write zero rows; edits/removals and deletion placeholders publish correctly;
56 an invalid tree rolls back feed and comment changes; unauthorized publication
57 fails under the same fencing checks.
58- The real-source local handoff test passed with a watched discussion. The
59 successor warmed the tree, retained comments and reported healthy after
60 promotion. Handoff-to-promotion measured 106ms in that run.
61- The staging migration and updated native ingester were applied. A real story
62 loaded 162 nested comment rows over Neon Realtime, then grew to 165 while the
63 local page remained open. Both story and comment query capabilities renewed
64 without browser errors. Production SSR and live connections were verified
65 through the stable alias; comment/reply links point to the original HN item.
66- `/dev/updates` provides development-only buttons for deterministic animation
67 checks. It requires HN_FIXTURE=1 and returns 404 in production. Browser checks
68 found only a score span or comment-count span pulsing after their respective
69 updates, with no structural row highlight. New rows had intermediate height
70 and opacity during expansion; reordered rows had intermediate translateY and
71 background values. The same checks passed for edited/inserted/reordered
72 comments. Collapsing a parent hid its descendants and expanding restored them.
73- In the deployed thread, keyboard pause kept all 169 comment IDs/commit markers
74 unchanged while upstream comments continued arriving. Resume applied 173 rows
75 with zero field pulses or structural highlights. Native scheduled transfers at
76 20:24, 20:26 and 20:28 UTC promoted in approximately 157, 33 and 11ms while the
77 discussion was watched; no source/session/watch failure events were recorded.
78- The production mobile discussion was checked at 390×844: document and page
79 widths both measured 390px, RT measured 22×22px, the header controls wrapped,
80 and nested replies remained readable. Keyboard Space toggled pause.
81​
82The earlier three-discussion gate has been removed. Open pages use independent
83viewer leases, released on departure and expired after 30 seconds without renewal.
84The 500-comment display bound and full-discussion HN link remain. The current
85page-load and concurrent-viewer checks are recorded below; broader traffic/load
86measurement remains outstanding.
87The earlier launch checks below continue to apply, including deployed reduced
88motion and injected failures.
89​
90## Event timeline
91​
92The fixed event footer replaces the old HN links/search footer on feeds and
93story discussions. The update is deployed as
94`hackernews-realtime-7lhlt98e3-samwillis-projects.vercel.app` with the stable alias
95above. [Timeline screenshot](timeline.png) shows event details and both colours.
96​
97- TypeScript, 13 unit checks and two isolated staging database tests passed.
98 Journal coverage includes every changed field, no-op suppression, feed moves
99 and exits, comment insert/edit/remove, transaction rollback and retention.
100 A 1,500-event unit burst retained every event across different types and IDs.
101- Migration 0003 was applied on the dedicated staging branch. Row triggers record
102 domain events in the same fenced transaction; the unchanged native ingester
103 produces them automatically. A separate sealed Realtime query receives events
104 independently of the current page and thread. There is no event-type filter
105 or result-count cap; ingestion prunes journal records older than 15 minutes.
106- Deterministic browser checks showed all 30 events orange while rows crossed
107 the viewport during a reversal, then 15 orange after the 320ms animation
108 settled. Scrolling changed the orange/grey distribution while the footer
109 stayed at the same screen position. An exiting comment retained orange during
110 its grace period. Collapsing a parent made its edited reply's event grey.
111- Pause kept timeline counts and every marker position unchanged while an
112 offscreen event arrived. Resume included it. Click/focus opened complete burst
113 details and Escape closed them. Inspection holds the timeline steady; an
114 outside tap and close button also dismiss the panel.
115- Production received score/count/rank events for stories outside the current
116 page, plus watched-discussion events. A live discussion rendered 195 comments
117 with both source and Realtime healthy. The mobile page was checked at 390×844:
118 document/footer widths were 390px and the detail panel stayed within the
119 viewport (12px–378px). The normal desktop viewport was restored afterwards.
120- The pinned Vercel production build passed. All 26 public assets passed a scan
121 against the actual database credentials and sealing secret before upload.
122​
123“All events” covers changes mirrored by the demo's first 150 top/new stories and
124bounded watched discussions. The timeline displays the most recent two minutes;
125events in the same second share a counted marker whose details list every event.
126Text/body details use short, plain-text excerpts. Broader launch checks below,
127including deployed reduced motion, are still open.
128​
129## Ingestion evidence
130​
131The deployed configuration uses 120,000ms active tenure, 90,000ms standby
132preparation, a 240,000ms absolute request budget, 5s heartbeat and 20s lease
133expiry. Observed native scheduled requests completed after roughly 120–181s.
134This proves the shorter configuration works; the scheduler's full 15-minute
135caller timeout has not been established.
136​
137In the 19:32–19:47 UTC observation window there were 51 changed transactions,
138400 changed item records and 2,563 changed feed entries. Transaction receipt
139diagnostics had p95 292ms, p99 748ms and maximum 748ms. Each transaction uses
140the oldest available receipt among its changed items/feeds. The commit marker
141is recorded just before COMMIT; these are approximate diagnostics, not a fully
142correlated per-event acceptance distribution.
143​
144Six scheduled handoff-to-promotion observations in that window measured
14523, 104, 151, 113, 235 and 182ms. One session at 19:40 UTC had no prepared
146standby, retired, and ingestion resumed on a fresh delivery at 19:42 UTC.
147The implementation now waits for a late successor while continuing to publish
148within its remaining absolute budget. An isolated real-source regression probe
149passed: the worker stayed active past its planned tenure, then handed off in
150106ms. The delayed successor reported healthy ingestion after 5,952ms, including
151its source connection and readiness preparation.
152​
153Local Node workers using real HN and isolated staging schemas were forcibly
154terminated with SIGKILL. Prepared-standby recovery took 18,037ms. Cold recovery,
155including a deliberate 60s scheduler-phase delay, took 64,578ms. These passed
156the 120s target, but are not remote Neon isolate termination measurements.
157​
158After the ingestion update, native scheduled handoffs at 19:52, 19:54 and 19:56
159UTC reached promotion within approximately 0, 182 and 110ms. No failure events
160were recorded from 19:51 through the final 19:57:53 check. The final deployed
161page stayed live beyond capability renewal and through the 19:56 handoff.
162​
163Two deployed tabs collected 133 item-application samples: 121 on top and 12 on
164new, representing 131 distinct `(item_id, committed_at)` updates. Every distinct
165update correlated to a recorded ingestion transaction (14 transactions).
166Browser p95/p99 and maximum were 65ms; correlated transaction receipt diagnostics
167had maximum 321ms. Collection began at 19:48:46 UTC, and the top tab's pause and
168resume window was excluded. The final web artifact was observed from 19:54:47.
169These timings use clocks and commit markers rather than an exact COMMIT
170acknowledgment or browser paint marker. Rank-only changes do not update the
171item commit marker, and new-row insertions are not included in these samples.
172​
173Ignored raw evidence lives in `.local/clean-build-result.json`,
174`.local/recovery-results.json`, `.local/handoff-results.json` and
175`.local/ingest-measurements.json`, `.local/browser-measurements.json` and
176`.local/final-validation.json`. Reproduce the probes with the commands in the README;
177the probes remove their isolated test schemas.
178​
179## Persistent connection and navigation
180​
181The navigation follow-up is deployed as
182`hackernews-realtime-5id3bvty8-samwillis-projects.vercel.app`, with the same stable
183production alias. A single root-layout client now owns page subscriptions and
184the persistent event timeline. Internal navigation prepares destination queries
185before committing the route, reusing those handles and their authoritative rows.
186​
187- TypeScript, 19 unit tests and the pinned Vercel production build passed.
188 New tests cover baseline readiness, handle reuse, warm back navigation,
189 bounded idle cleanup, timeouts and terminal errors, capability renewal,
190 invalid-renewal failure reporting, query identity and rapid navigation.
191- The deployed top → new → top → discussion → browser-back flow kept the
192 connection live. Pause and highlighting survived page changes; the single
193 footer retained its timeline. The real discussion displayed 198 comments.
194 Browser logs contained no warnings or errors during these checks.
195- Local pagination showed rank 31 on page two and stayed live on browser back.
196 Rapid top/new clicks respected the latest choice. At 390×844, feed switching
197 stayed live, one footer remained, and document width stayed 390px.
198- Direct HTTP responses from production contained 30 feed rows and rendered
199 discussion comments before JavaScript. Both pages remain dynamic Next App
200 Router server-rendered routes; browser subscriptions start during hydration
201 or destination preparation.
202- All 26 public production assets passed the credential/sealing-secret scan.
203 The proof image is [navigation.png](navigation.png).
204​
205## Update cadence and ingestion smoothing — 2026-10-13
206​
207Two concurrent source captures (135 seconds and 95 seconds) observed HN's
208`topstories` and `updates` Firebase streams changing every 31.8–33.7 seconds.
209The three monitored item streams changed alongside those bursts. REST reads
210every two seconds, with caching disabled, saw the same changes after the stream;
211neither REST nor the changed-items endpoint exposed a faster source in these
212captures. The official API describes its export as “near real time”.
213​
214Before smoothing, 57 ingestion commits over 15 minutes had receipt-to-write
215diagnostics of median 174ms, p95 282ms and maximum 298ms. A probe using the
216browser's capability-renewal lifecycle received 210 journal events with
217database-to-SDK timings of median 185ms, p95 209ms and maximum 405ms. Renewal
218succeeded at 49.7 seconds and delivery continued afterward with no errors.
219These use receipt/row timestamps and separate clocks rather than exact COMMIT
220acknowledgments and paint markers. The roughly 32-second cadence is upstream.
221​
222`INGEST_SMOOTHING_MS` now defaults to 28000. Independent story updates and
223comment edits receive evenly spaced publication deadlines within that window.
224Each feed reorder and comment-tree structure change remains atomic. Initial
225feed/discussion baselines publish immediately. A private Postgres queue retains
226deadlines through handoffs and restarts; overlapping updates retain the newest
227value at the existing deadline. Setting the value to 0 drains the queue and
228publishes immediately when the new worker becomes active. Journal timestamps
229still correspond to actual database writes.
230​
231- TypeScript and 24 unit checks passed. New coverage verifies deadline spacing,
232 dependency ordering, immediate mode and invalid configuration.
233- The four existing isolated database checks passed, plus a new isolated queue
234 check covering no-op suppression, replacement/reversion, valid feed ranks,
235 complete arrival records, fenced ownership transfer, initial thread loading,
236 independent comment edits, structural writes preserving newer content,
237 removal without resurrection, immediate-mode draining and rollback.
238- The real-HN handoff check passed with four simultaneously watched discussions;
239 handoff-to-promotion measured 110ms. These are local workers against an
240 isolated staging schema, with a deliberate delayed successor and test shutdown.
241- Migration 0005 and the updated native worker are deployed on the dedicated
242 staging branch with a 28000ms window. A 115-second live capture received 200
243 journal events in 30 deliveries, including 26 story-update deliveries with a
244 median gap of 3.5 seconds (maximum 11.3 seconds). Feed reorders still shared
245 atomic markers, including one 152-event insertion/rank shift. Database-to-SDK
246 p95 was 224ms; two capability renewals succeeded without errors. Observed
247 receipt-to-write diagnostics ranged from 3.4 to 25.6 seconds, including the
248 deliberate smoothing delay.
249- A native worker handoff occurred during the capture, with promotion after
250 205ms and no recorded source/session/watch failures. The existing browser tab
251 remained live with HN connected and individual markers distributed across
252 the footer. [Smoothed timeline screenshot](smoothing.png).
253​
254Raw timing captures are retained in ignored `.local/cadence-results-2026-10-13.json`
255and `.local/cadence-renewed-results-2026-10-13.json`; the deployed smoothing
256capture is `.local/cadence-smoothed-results-2026-10-13.json`.
257​
258## Launch checks still required
259​
260- Extend correlated latency measurements to inserts, removals and rank-only
261 changes, using exact commit/browser-application markers. The 131-item update
262 sample meets the count target but does not establish every event type in the
263 plan's complete p95/p99 acceptance gate.
264- Force termination in the deployed Neon runtime and verify cold/warm recovery
265 there. Local-process results support the lease design but leave the remote
266 shutdown lifecycle unverified.
267- Inject upstream and Realtime connection interruptions; verify stale reporting,
268 reconnect/reset and authoritative recovery under failure.
269- Extend the short final soak to cover scheduler delays over a longer period.
270 A missed handoff during the earlier observation remains recorded above.
271- Exercise reduced motion in the deployed UI. The media-query behavior is
272 implemented, but the manual check is incomplete.
273​
274The staging demo can be explored now. These checks must pass before calling it
275launch ready under the plan's acceptance targets.
276​
277## Loading discussions when opened — 2026-10-12
278​
279Removed the global three-thread gate. The server page and navigation preparation
280seed uncached comments before subscribing, and mounted pages own separate viewer
281leases. Watches release on navigation/pagehide, renew on becoming visible, and
282expire after 30 seconds if renewals stop. Partial worker snapshots insert missing
283rows without erasing cached descendants or reverting their values; complete
284snapshots reconcile the tree. Cold discussions no longer delay feed handoff.
285​
286- All 21 unit checks, four isolated database integration checks, typecheck, and
287 the pinned production build passed. Database checks cover five simultaneous
288 threads, duplicate viewers, release/renewal reordering, expiry, shared cold
289 loading, failed/replaced load ownership, and worker-versus-seed races.
290- A real-source isolated handoff with four watched discussions passed. Handoff
291 to promotion measured 156ms; all four threads reached healthy status.
292- Two uncached production SSR requests returned eight and twenty comments in
293 1,193ms and 1,065ms respectively, before JavaScript. Neither contained a slot
294 message. These are two samples, not latency percentiles.
295- Four distinct production browser discussions all became healthy, with 50,
296 56, 269 and 259 cached comments. First comments appeared before the remaining
297 rows; no thread-watch/source/session failure was recorded during the check.
298- A second viewer kept the same discussion live after the first navigated away;
299 the database then showed one active viewer and one released viewer. Temporary
300 test stories had no active watches after their tabs closed.
301- The connection stayed live through top/thread/top/thread navigation. Highlight
302 settings and the event timeline persisted. A 390px mobile viewport had 390px
303 document and scroll widths, a square 22px RT logo, and a live connection.
304- The deployed static assets were scanned against the configured database URLs,
305 password and server Realtime secret: zero matches.
306​
307Production deployment: https://hackernews-realtime-logjinp2p-samwillis-projects.vercel.app
308Stable URL: https://hackernews-realtime.vercel.app/
309Desktop proof: `docs/comment-loading.png`; mobile proof: `docs/comment-loading-mobile.png`.
310The 500-comment per-thread bound remains; broader concurrent traffic testing
311is still outstanding.
312​
313## Mobile timeline window — 2026-10-12
314​
315The footer now uses a 60-second window at the existing mobile breakpoint
316(750px and below), and retains 120 seconds above it. Event filtering, counts,
317marker positions, tick labels and accessible range text share the same window.
318The media query reacts to resizing without replacing the live subscription.
319​
320Typecheck, all 21 unit checks, the production build, and the static secret scan
321passed. The existing event boundary check now also covers a 60-second window.
322On the deployed site, a paused desktop timeline showed 615 events over two
323minutes. At 390px it showed 139 events over 60 seconds, with ticks at −60s,
324−45s, −30s, −15s and now, and no horizontal overflow. Restoring 993px recovered
325the original 615 events and two-minute labels. Live updates were resumed and
326the viewport override was reset after verification.
327​
328Production: https://hackernews-realtime-1ogz260ho-samwillis-projects.vercel.app
329Mobile screenshot: `docs/mobile-timeline-60s.png`.
330​
331## Neon Realtime header attribution — 2026-10-13
332​
333The shared feed/discussion header and error fallback now show the official Neon
334mark with “Built with Neon Realtime”, linking to https://neon.com. The badge sits
335before the live controls on desktop and beside the title on mobile.
336​
337Typecheck, all 24 unit checks, the production build, and the public-asset secret
338scan passed (26 files, zero matches). Local checks at 390px and 320px showed the
339whole badge with no horizontal overflow. The deployed desktop header was
340verified at 993px with a live feed connection and no horizontal overflow.
341​
342Production: https://hackernews-realtime-qji0n3ucj-samwillis-projects.vercel.app
343Stable URL: https://hackernews-realtime.vercel.app/
344Screenshot: [Neon header attribution](neon-credit.png).
345​
346## Simplified header — 2026-10-13
347​
348Replaced the Neon badge with a plain text link and reduced connection status to
3497pt. Removed pause and highlight controls; updates and change highlights remain
350enabled. Mobile navigation and status share the second header row.
351​
352Typecheck, all 24 unit checks and the production build passed. The 26 built
353public assets passed the credential scan. The deployed 993px desktop and 320px
354mobile views had no horizontal overflow or pause/highlight inputs. The connected
355mobile header measured 38px tall; connecting text can wrap to another line.
356Local checks also covered 390px.
357​
358Production: https://hackernews-realtime-ji9jjalhp-samwillis-projects.vercel.app
359Screenshot: [Simplified header](simpler-header.png).