All practice tasks

Coding (Platform)

Stable cross-layer ordering

react + fastify · Easy · response projection

A browser and API disagree at the stable cross-layer ordering boundary. A results table can be sorted by score or name. Equal values currently jump between renders and the live-region summary describes the requested direction rather than the order actually applied.

Task

Repair the shared browser-to-service contract. Return a stable ordered ID list and one concise announcement for the applied sort.

Contract

Input is {rows, sort:{field,direction}}. Rows contain id, name, score and originalIndex. Return {ids, announcement}. Invalid fields fall back to name; invalid directions fall back to asc.

Acceptance criteria

  • Sort score numerically and name with localeCompare.
  • Use originalIndex then id as deterministic tie breakers.
  • Do not mutate rows.
  • Announce the normalized field and direction with the result count.
  • 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

Stable cross-layer ordering 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 easy 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.