forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to src/domain/board.rsClear filter

2026-09-12

2026-09-11

2026-08-05

fix: 🎨 stop a bulk board invite from dropping the other invite's groupAhmet Kaan Gümüş · 0346717
fix: 🎨 stop a bulk board invite from dropping the other invite's group

`POST /boards/{id}/invite` reads the roster, unions its resolved group
into it, and stores the whole array back. Two invites from the creator
landing together both read roster R: one writes R∪A, the other R∪B, and
the second commit silently drops the first one's people — with both
callers told 200 and a list of participants who are not on the board,
against the route's own "strictly additive, nothing is ever removed by
it" contract. Neither write is wrong on its own, so the database cannot
refuse it; it is a lost update, not an over-cap.

Closed with an in-process lock over the whole read-modify-write, which
genuinely serializes here (one process, stop-the-world deploys) and,
unlike a compare-and-set, does not answer 409 to two calls that do not
conflict in intent. The cap is then checked against the roster actually
read under the lock, so the stored value is the checked value. The
roster branch of `PATCH /boards/{id}` takes the same lock — it reads the
current list before replacing it, so it is the other read-modify-write
of that field, and a lock only half the writers take serializes nothing.

The regression test races two class invites and reads the roster back
off the server: without the lock it drops one group, 2 of 4 members.

2026-08-02

fix: 🔩 clear the deferred backlog and ship class phase 2Ahmet Kaan Gümüş · afff737
fix: 🔩 clear the deferred backlog and ship class phase 2

Ten defects and two features, worked as one series because the doc
surfaces and the const table are shared.

Defects closed:

- Cross-exam answer-key leak. The bank copies `correct` into every
  instantiation, so reviewing exam A handed out the key to a question
  the caller was still writing in exam B. Review now blanks those
  questions rather than closing: the join matches on `from_bank` AND
  `banked_as` (a question can carry both — instantiated, then re-saved
  to the bank — so a coalesce misses a copy), redacting `correct`, the
  correctness flag and that question's `auto_score` share. Keyed on the
  template, never the exam, so the rest of the review reads normally.
- `set_role` was not atomic with its sweeps. The role write and every
  grant it invalidates now commit as one transaction; the board rooms
  are told after COMMIT from the cascade's own result slot. Built
  best-of-N; the losing charter left the one sweep outside whose failure
  strands an event seat no route can free.
- Board rosters held below-student ids, which 400d the creator's next
  roster PATCH. Repaired at boot, and a PATCH may now send back the
  roster it was served: an id already present that stopped qualifying is
  dropped, a new one still refused.
- `note_file` blobs leaked. The delete transaction returns the rows it
  removed and the handler unlinks exactly those, not a pre-read snapshot.
- Rate limiting failed open on a saturated map. Never-seen clients now
  share one metered overflow budget instead of arriving unmetered.
- Whiteboards: `GET /boards` takes `?open=`, `/strokes` no longer leaks
  a clear marker the socket filters out, and a locked board refuses its
  creator's clear (409) — the lock now means one thing on every path.
- Blueprint skips named the wrong record: `Attached::Gone` was two facts
  under one name, split into `Gone` (class) and `PivotGone` (course).

Features:

- Event audience `kind=class` — live from `class_member`, membership
  checked in one select because the (class, user) pair is the row id.
- Grade blueprints: a grade's course template, retro-pumped best-effort
  with a skip list. Attachments carry a provenance tag, so removal
  spares what a human placed. A course deleted out from under a
  blueprint is pruned from the template by the pump that finds it.

Forcing functions, because a hand-kept copy drifts:

- `protected_routes_require_session` is derived from the emitted
  OpenAPI: 248 -> 254 operations swept, was 80 typed by hand.
- Every JSON-bodied operation declares 422 (74 sites), pinned both ways
  — and multipart routes, which answer 400, are pinned to NOT declare it.
- The SurrealQL registration-freeze guard is pinned against the Rust it
  copies; both mutations of it fail the test.
- `migration_mark` gates one-time backfills. The roster repair rescanned
  every board against every user on every boot (773ms at 300/2000 with
  nothing to write); it is now skipped once done.

Verified by a three-lens verifier panel — which caught the `banked_as`
half of the answer-key leak by executing a probe, after the first fix
had been reported complete — and by a podman boot against the existing
volume: both new fields defined, the marker written, boot 2 skipping the
scan, and the live API answering on the new routes.
fix: 🔩 close the leaks a five-domain hunt turned upAhmet Kaan Gümüş · a3fe8cf
fix: 🔩 close the leaks a five-domain hunt turned up

Five hunters swept exams, homework/attendance, identity, money/scheduling
and messaging/courses; a three-lens verifier panel then refuted three of
the first fixes, and those corrections are folded in here.

Leaks and races closed:

- exam self-review gated on *any* mark, so a seq-1 grade opened the
  answer key forever — a student mid-retake read `correct` and
  `is_correct` off the sheet they were still writing. All four review
  reads now 409 while the caller's latest sitting is in progress.
- roll call could land after its session was deleted, and the orphan was
  unremovable (its delete route 404s on the vanished session) while the
  attendance report went on counting it. The write now proves its parent
  exists in the same transaction, the way ExamResult::grade does.
- a teacher could counter-propose and then approve their own proposal,
  committing the requester to a time only the teacher ever named; and
  even after that, re-proposing between the requester's read and their
  accept moved the meeting under them. Approve refuses while a proposal
  stands, and accept now pins the window it is answering.
- two concurrent chatbot posts on one thread cross-attributed their
  answers — both replied to the second prompt, the first was never
  answered. The prompt id rides the request instead of being re-derived
  from write order.
- a whiteboard participant demoted to `parent` kept drawing, and kept
  *reading* the live canvas for up to 15s. Every frame is authorized
  before delivery now, and a demotion sweeps the account off rosters.
- a demotion to `parent` stranded event signups no one could free.
  Promotions are left alone (staff free their own seats) and closed
  lists are never rewritten.
- the rate-limit bucket map was unbounded past 10k live keys and then
  scanned O(n) under the global mutex on every request. Eviction is
  bounded and never frees an exhausted bucket — the first attempt did,
  which traded a memory bug for an auth-bypass, so it is pinned by a
  test that floods at the victim's own spend.
- session and event cascades ran as loose queries; a concurrent write
  slipped between them and orphaned rows, and for notes a blob nothing
  could ever reclaim. All three are one transaction now.
- sixteen id generators still used Ulid::new(), whose random low bits
  scramble same-millisecond rows under the "newest first" the docs
  promise; five listings had no tie-break at all, so offset paging could
  skip or duplicate a row.

Also: $session is a protected SurrealDB 3 variable — binding it fails
the whole query as a bare 500, which is what hid the attendance fix.

Accepted, documented, not fixed: one bank template instantiated into two
exams copies `correct` into both, and the review gate is per-exam.

2026-08-01

docs: 📐 tell the truth about a board bodyAhmet Kaan Gümüş · c47fb00
docs: 📐 tell the truth about a board body

Rejecting unknown keys made POST and PATCH /boards answer 422, a status
neither utoipa block declared, so a generated client had no case for the
first status a read-modify-write caller hits. Both now list it.

The README went further and promised the opposite of what ships: it said
the shared `participants` spelling meant a client "may post back a board
it just read", but a board response carries id, creator, locked_by and
epoch — all unknown to the request — so a verbatim round-trip is exactly
the 422. It now says to send the writable fields only.

The race test that comes with this is a smoke test and says so: cutting
the retry to a single attempt leaves it green in five runs of five, while
the same cut reddens its course.rs twin in two of three. Nothing exercises
this delete's retry; it stays because the batch is admissible for it, not
because a test has caught it losing a round.

2026-07-31

fix: 🖍️ name the board roster the same on the way in as on the way outAhmet Kaan Gümüş · 43bbae8
fix: 🖍️ name the board roster the same on the way in as on the way out

POST /boards read the invite list from `participant_ids` while the board
response and PATCH /boards/{id} both call it `participants`. Serde ignored
the unknown key, so a client that posted back a board it had just read got
a 201 for a board it was silently alone on — no error, no roster, a seat
spent. The create field is now `participants` like the other two; the repo
is pre-customer and the real volume holds zero board rows, so it is a clean
break with no alias and nothing stored to migrate.

Both board request bodies also deny unknown fields now, which makes the
next misspelling a 422 instead of a silent drop. That is deliberate local
deviation: no other REST DTO in this crate does it, and only these two have
already proven what ignoring a key costs.

Board::delete goes through transaction_with_retry. It was a bare query +
check() around a five-statement cascade that writes the stroke rows, the
board row and the creator's board_count; a stroke claim touching the same
board row aborts it, and check() retired that retryable round as a 500. No
statement can legitimately answer "already exists" — the DELETEs are
idempotent and the UPDATE is field-scoped — so re-sending is sound, and a
forced-abort probe confirmed the aborted round leaves the board, its
strokes and the seat untouched. No statement moved: RETURN stays slot 4.
feat: 🖍️ collaborative whiteboard domain, REST and limitsAhmet Kaan Gümüş · 5dfce55
feat: 🖍️ collaborative whiteboard domain, REST and limits

Boards are an ad-hoc invite list: the creator names participants, and
every participant draws. Clearing, locking, closing and deleting are the
creator's alone.

Strokes are an append-only log and a clear NEVER deletes — it bumps the
board's epoch, so the live canvas empties while the whole history stays
replayable. The clear marker row doubles as the epoch index, carrying the
epoch it closed and that epoch's final stroke count, which is why there
is no epochs table.

Growth is bounded by two counters claimed together in one conditional
write: epoch_stroke_count resets on a clear and caps the live canvas
(recoverable — clear and keep drawing), while total_stroke_count never
resets and stamps closed_at when the lifetime cap is hit, leaving the
board permanently read-only but fully readable. board_count on user
bounds the open-a-new-board escape hatch.

Outsiders get 404 everywhere so a board's existence never leaks;
a participant lacking creator rights gets 403, since existence has
already been disclosed to them.

The WebSocket room lands separately.