forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to src/lib/create-ack-waiter.test.tsClear filter

2026-07-25

fix: 🏷️ settle exam-room saves by client_seq, not by guessworkAhmet Kaan Gümüş · b5d89d9
fix: 🏷️ settle exam-room saves by client_seq, not by guesswork

`question_id` was never an identity. Save a question, time out, save it
again, and two sends are outstanding for the same id — the first reply
settled the second, and the badge read "Saved" for an answer the server
never took. The waiter compensated with a per-question FIFO and a debt
counter for disowned sends, which was exact except when a send was never
answered at all: the debt then swallowed one later legitimate frame.

The backend now echoes a `client_seq` we mint, so each reply settles its
own send and nothing else. The FIFO and the debt bookkeeping go with it.

A reply carrying no `client_seq` — a room-level error, or a backend
without the field — still fails everything in flight. Failing toward
"not saved" is the safe direction; the other one is the bug above.
fix: 🔍 correct 21 defects the last 24h of commits shipped greenAhmet Kaan Gümüş · f9efbbc
fix: 🔍 correct 21 defects the last 24h of commits shipped green

Adversarial audit of 49f9928..ffb1d47: four verifiers found 15 defects the
317-test suite passed over, and a two-lens panel found 6 more in the fixes
themselves. Three of those commits claimed fixes they did not deliver.

- exam room: "saved" was still a lie. Acks were keyed on question_id alone,
  so a timed-out send's late frame settled the retry and the badge claimed
  Saved for a payload the server never took. Replaced with per-send FIFO
  plus an integer debt count per question: superseded/timed-out sends are
  disowned and their frames paid off before any live send settles. failAll
  now takes a required cause — an unattributed error frame keeps the debt
  (the socket stays open), only a real close clears it
- shell feed leaked across accounts: the provider outlived logout, so user B
  saw user A's inbox, badge and appointments until the refetch landed. The
  feed is now built inside a memo keyed on the user id, so a switch disposes
  it rather than relying on a mutate call
- appointments offered actions the backend rejects: book on in-progress
  slots (list filter used where the book guard applies), and a teacher lost
  reschedule permanently because the backend never clears proposed_* — action
  availability now derives from a standing proposal, in a tested pure gate
- every 403 and 404 message was dead: formatApiError returned the per-status
  generic before consulting the table, so entries added for the question bank
  never rendered. Table now wins; 8 appointment 409s and the refresh-from-bank
  400 localized against the backend's exact strings
- request deadline escaped as a raw DOMException because the body read sat
  outside its try, showing Turkish users an English abort message
- unread badge under-counted from a capped inbox page, the two shell badges
  disagreed, and dismiss-all could not clear a count above ten
- students and parents saw their own name on every calendar appointment
- question bank stranded the user on an empty page after deleting the last row
- tests: 317 -> 336, all new ones watched failing before they passed. One
  existing test asserted the ack bug as intended behaviour and was rewritten
- comments in create-ack-waiter claimed safety properties the code lacked;
  rewritten to describe actual behaviour

Known and accepted: shell events/exams fetch unpaged (~3.37MB/poll at 5000
rows) because the backend cannot express a schedule window. Follow-ups for
the backend: starts_after on /events and /exams, and a client seq echoed in
the exam ws saved/error frames to replace the debt heuristic with exact
identity.
fix: 📝 exam room only says "saved" when the server confirms itAhmet Kaan Gümüş · d5f7156
fix: 📝 exam room only says "saved" when the server confirms it

- the saved badge was set on send, not on success: a failed REST POST
  was swallowed and still lit it, and the WebSocket branch patched
  local state before any acknowledgement. A student could be told
  their answer was stored when it never was
- the badge now waits for the server's saved frame (or a 2xx POST) and
  moves through saving → saved | not saved; auto-advance only fires on
  confirmation
- a failed save keeps the student's answer on screen and offers "save
  answer again" — nothing is cleared and no refetch overwrites it
- add src/lib/create-ack-waiter.ts: a pure pending-ack registry with
  wait/ack/fail/failAll, timeout and supersede, unit tested, so the
  logic lives outside the component where it can be tested at all
- a socket drop or reconnect fails every pending save rather than
  letting a new socket inherit them
- an error frame naming a question fails only that one; an unattributed
  error still fails everything