All practice tasks

Coding (Platform)

Paged flow request ownership

vue + fastify · Medium · request ownership

A browser and API disagree at the paged flow request ownership boundary. A search screen can request several pages for one query while the user changes the query. Late pages from the previous search currently append to the new result set.

Task

Repair the shared browser-to-service contract. Reduce request and response events into visible state where only the current search generation can commit rows.

Contract

Input is {events}. Events are search{id,query}, page{id,cursor,rows,nextCursor}, failure{id,message}. Return {query,rows,nextCursor,error}. A search starts a new generation and clears rows and errors.

Acceptance criteria

  • Only events matching the latest search id may commit.
  • Append pages in event order and deduplicate by row id.
  • A current failure preserves committed rows and sets error.
  • A stale failure changes nothing.
  • Keep browser-visible state consistent with the canonical service result.

Constraints

  • Do not mutate caller-owned input.
  • Keep the supplied framework adapter and public contract unchanged.
  • Add candidate tests for at least one boundary not covered by the public cases.

Editable files

  • src/repair.js — Task-specific state or service boundary
  • tests/candidate.test.js — Candidate-authored regression

What this task practices

Paged flow request ownership is a coding (platform) interview exercise that trains prompt interpretation, explicit assumptions, a concrete response, and a clear explanation of tradeoffs. The catalog marks it as medium difficulty. It focuses on State Modeling, Regression Testing, Technical Reasoning. The signed-in workspace provides the tools for the round and evaluates the attempt against task-specific criteria. Reference solutions, hidden checks, evaluator instructions, and candidate work remain private.

Sign in to startThe workspace and evaluation open after sign in.