GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
← Work samples
hard· 60 min· JavaScript, Node 18+ (stdlib only)

Repair a customer's streaming assistant

Try the problem / Work sample 01

The reply arrives. Most of it disappears.

The server sends a reply in pieces. Step through them and watch what a reader loses when each piece replaces the previous text.

Incoming streamInteractive illustration · Synthetic text
  1. 01 · receivedYour order
  2. 02 · receivedhas shipped.
  3. 03 · pendingIt arrives
  4. 04 · pendingon Friday.

The broken client

has shipped.

Only the latest piece remains.

What the reader needs

Your order has shipped.

Keep the text received so far.

Chunk 2 of 4. The expected client retains all 2 pieces.

In the full exercise, repair the client and test split characters, overlapping replies and dropped connections against a local HTTP server. Premium includes the exercise files and a separate written reference walkthrough.

A customer's support assistant streams replies from a model, and their team filed three complaints this week as a single ticket called "the chat is broken". Accented characters arrive as black diamonds. Long replies lose most of their text and only the end shows up. And sending a second message while the first is still writing tangles the two replies together.

They are three separate defects with three separate mechanisms, which is the first thing to establish out loud. A rewrite typically fixes two of them and quietly reintroduces the third, so the grader checks each symptom on its own.

There is a fourth defect nobody reported, because it is invisible until the day it matters: what the reader sees when the server returns 500, or when the connection dies halfway through a reply. On most implementations the answer is a blank bubble and a stack trace in a console nobody has open.

The pack ships a hostile stream server that splits characters across byte boundaries, stalls, returns errors and drops connections mid-stream, plus a grader that stands in for React so what is scored is your state model rather than your JSX. It runs on Node's standard library with nothing to install.

The tests are the smaller half. The half that decides the round is being able to answer two questions about your own fix: which message does a chunk belong to, and which run is allowed to write. A functional state update answers neither, and cancelling a request does not stop work that was already scheduled.

What you can run

The Premium exercise download contains the broken client, browser UI, local HTTP server and both deterministic and real HTTP checks. The separate reference download includes working code and a step-by-step written walkthrough of decoding, message ownership, cancellation and failure handling. The HTTP checks can also save per-request timing observations.

This local JavaScript project uses synthetic streamed text. It does not call an LLM or deploy to a cloud account, and it has no narrated coding video. The walkthrough explains the additional requirements for hosted inference and deployment behind a proxy. This brief is the public preview; both downloads require Premium access.

What is being graded

◆ PREMIUM PACK

The brief above is the whole problem, and you are welcome to build the fixtures yourself. The pack saves you that hour: schema, seed data, the broken version, a starter file, a grader, and a reference solution that explains what was being scored rather than just showing the answer.

See premium access →

Every answer, concept and course, every paper breakdown, all published video lessons, hands-on FDE Lab missions, Premium PDF guides and companion files, the full practice-test bank and work-sample downloads. Referral Premium excludes guide PDFs and their companion files.

6 months · One payment · No auto-renewal

Study alongside free video lessons.

Background reading: streaming chat ui drops tokens three bugs