forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to src/web/classes.rsClear filter

2026-09-24

✨ feat(courses): grade-ladder course templates with per-class overridesAhmet Kaan Gümüş · 450bc8c
✨ feat(courses): grade-ladder course templates with per-class overrides

course_offering per (course x grade_level 0..=12), per-class overrides on
class_course (nullable scalars + *_inherited flags), subjects/weights/
weekly-plan axis tables, instance_resolve with batched twin, resolved
title/description on instance-scoped reads, six new route groups,
integration scenario test, README regenerated. Evolution migrations
squashed into the base schema (20260912000002_courses + 20260916000001_k12_remodel).

Local-Gate: 246daa3fb3ee7b0ff507a95d6ab346bab1333a37 (1556 passed, 455s)

2026-09-17

📝 docs: rewrite the Turkish comments and doc comments in EnglishAhmet Kaan Gümüş · 7fec874
📝 docs: rewrite the Turkish comments and doc comments in English

The Rust repo's own language is English; Turkish had leaked in from the
sibling AI services. Translate every comment and doc comment to English
using the code's own vocabulary (şube -> class section, dönem -> term,
sınıf öğretmeni -> homeroom teacher, ortak sınav -> shared exam, karne ->
report card, …). Quoted Turkish letters/words that are themselves the
data under test (the text-fold examples in `text_fold`/`settings`, the
non-ASCII filename sample) are kept.

The README endpoint table is generated from those doc comments, so it is
regenerated. AGENTS.md records the convention going forward: Turkish
survives only where it is the data under test or user-visible content.
✨ feat: add the /rag nest over the course-note RAG bridgeAhmet Kaan Gümüş · a61e0a6
✨ feat: add the /rag nest over the course-note RAG bridge

A separate rag_thread/rag_message pair of tables and a Module::Chatbot gated
/rag nest, mirroring the chatbot's asynchronous send: POST answers 202 with a
pending assistant row, an in-process task settles it, and both the poll read
and the SSE stream project a stale pending row as failed.

Every question is scoped server-side to the asker's own (sinif, ders) pairs —
class-section instances, a linked parent's children, school-wide club/study memberships
— never from the body. Each citation's corpus doc_id is resolved per candidate
to a course-note file the asker may view, and the two storage caps refuse an
over-bound reply whole rather than clipping it. rag.index replies now stamp
each file's rag_doc_id, the missing link between a citation and its file.

The chatbot's SSE helpers move to web/mod.rs so both nests stream through one
implementation, and the instance/course visibility gates move from web to
service so the scope deriver and the routes share one rule.

Gates: cargo check --all-targets, clippy -D warnings, limits_completeness,
spec_bounds, doc_sync (README regenerated), protected_routes_require_session
(MIN_PROTECTED 269 -> 318, the real swept count), ai_bridge (75 tests).

2026-09-16

✨ feat: the class×course instance is the academic anchor (K-12 remodel)Ahmet Kaan Gümüş · ae84034
✨ feat: the class×course instance is the academic anchor (K-12 remodel)

`course` was a school-wide singleton: enrollment, exams, sessions,
roll-call and homework all keyed on it, so two class sections teaching the same
course shared one roster, one exam set and one timetable. This moves the
academic anchor to `class_course` — the per-class instance — and rebuilds
the academic model around Turkish K-12.

Schema (migrations/school/20260916000001_k12_remodel.sql): `class_course`
becomes an instance (ders_saati, counts_toward_karne, enrollment_count,
class_course_teacher); enrollment re-keys to (class_course, app_user);
exam carries class_course + term (+ exam_audience for shared exams);
course_session / session_attendance / homework re-key; `class_member` is a
soft-leave history table (uuid PK, joined_at/left_at, partial unique index
on the live stint); `academic_year` sits above `term`; `class_group` links
a year, not a term; new `course_membership` (clubs/study), `karne_snapshot`;
settings gain branches/excuse_kinds/absence limits/timezone; profile gains
branch. Drops/recreates the identity-changing tables (pre-customer; the
migration resets every counter on a kept table that pointed at a dropped
one).

Layers: domain/db/service/web rewritten to the instance seam, with
`ensure_instance_teacher` gating instance writes (D10), the report card computed per
instance and weighted by ders_saati, an absence report, `/instances`
and `/academic-years` nests, and `/classes/{id}/instances`. Capacity and
the seat-claim 409 are gone; detach sweeps the whole instance subtree and
unlinks its blob keys.

Gates: cargo check --all-targets, SQLX_OFFLINE check (cache regenerated),
doc_sync, spec_bounds, limits_completeness, clippy -D warnings all green;
cargo nextest run 1370/1370.

2026-09-14

🗃️ feat: pre-prod schema: person join key, drop school password copyAhmet Kaan Gümüş · 804bd3c
🗃️ feat: pre-prod schema: person join key, drop school password copy

app_user no longer stores password_hash (login already verifies
control person). School rows carry person uuid + created_at.
class_blueprint is uuid-keyed; exam child rows composite-FK to
(exam, question); pool/solution images are child tables;
graded_at/marked_at/enrollment timestamps added.

Left alone: occupancy/refcount counters (cap locks, not lies),
ledger source, menu derived id, school.slug PK, fee_plan JSONB.

2026-09-12

2026-09-11

Merge branch 'layer-split/class'Ahmet Kaan Gümüş · dc8a635
Merge branch 'layer-split/class'

# Conflicts:
#	src/db/cap.rs
#	src/domain/class_group.rs
#	src/domain/event.rs
#	src/web/classes.rs
#	src/web/users.rs
#	tests/regress_role_sweep.rs
Merge branch 'layer-split/catalog'Ahmet Kaan Gümüş · 8c2ca53
Merge branch 'layer-split/catalog'

# Conflicts:
#	src/web/classes.rs
🧹 chore: split subject and term into domain/db/service layersAhmet Kaan Gümüş · 6533a0a
🧹 chore: split subject and term into domain/db/service layers

domain/subject.rs keeps SubjectId/SubjectName/SubjectDescription/Subject + getters
and the pure validation tests; domain/term.rs keeps TermId/TermName/gone_error/
archived_error/ref_move/Term + getters.

db/subject.rs: create (cap::touch_and_create), read, list_by_ids, list_for_course,
update (FieldUpdate), delete (guarded transaction). db/term.rs: create, read,
list_all, update (ordered range guard), delete (refcount-guarded), archive,
unarchive, stamp. Persistence race tests ride along byte-identical.

service/subject.rs: pass-throughs + the moved id resolvers in_course/must_exist
(was web::subjects helpers). service/term.rs: pass-throughs + require_open
(was Term::require_open), resolve (was web::terms::resolve_term), require_writable
(the archived-refusal gate update/delete handlers inlined), delete's linked-409
mapping (was web::terms).

Web: subjects.rs/terms.rs handlers call service only; the archived gate stays
ordered before the range pre-flight by calling service::term::require_writable
between read and write. Callers re-pointed crate-wide: web/courses.rs,
web/classes.rs, web/homework.rs, web/exams/{mod,questions}.rs, web/bank_questions.rs,
db/{course,exam,exam_attempt,exam_question}.rs (tests + doc links),
service/{course,exam_attempt}.rs, domain/{class_group,bank_question,homework,
homework_file,homework_result,homework_submission}.rs (tests + doc links),
tests/regress_course_{child_orphans,delete}.rs.

Purity verdicts: domain/{timestamp,monotonic_id,text_fold,role}.rs have zero
production query execution (text_fold's only .query( is inside a #[cfg(test)]
folding test) — they stay domain-only, no db/service modules.

cargo check --all-targets 0 warnings; cargo test --lib 577 passed 0 failed;
integration: 13 subject/term/question/homework route tests green.
Merge branch 'layer-split/user'Ahmet Kaan Gümüş · f30faee
Merge branch 'layer-split/user'

# Conflicts:
#	src/domain/appointment_slot.rs
#	src/domain/exam_question.rs
#	src/domain/user.rs
#	src/service/course.rs
#	src/web/courses.rs
#	src/web/sessions.rs

2026-09-05

✨ feat: one database per school behind a control registry; login names the schoolAhmet Kaan Gümüş · b7dfc0c
✨ feat: one database per school behind a control registry; login names the school

Namespace `hezarfen` now holds one DATABASE per school (name = slug) plus a
`control` database with the school registry, builder accounts and builder
sessions. `Tenants` keeps one separately-connected handle per school; the
shadow `web::tenant_state::State` resolves the school from the
`<slug>.<token>` cookie so every handler's `st.db` is school-scoped by
construction. `POST /auth/login` / `register` carry `school`; a suspended
school answers 403 everywhere. `BUILDER_USERNAME`/`BUILDER_PASSWORD` seed the
vendor account; the boot admin seed is gone. No customers, no compat shims.
🗄️ feat: archive academic terms; an archived year is read-onlyAhmet Kaan Gümüş · c4232e6
🗄️ feat: archive academic terms; an archived year is read-only

`Term.archived_at` (nullable, no backfill) plus `POST /terms/{id}/archive`
and `POST /terms/{id}/unarchive` (manager+, idempotent: a repeat archive
keeps the original stamp). While a term is archived its own PATCH/DELETE,
linking a new course or class to it, and every write to a course or
class on it — enrollment, teacher assignment, class membership and
attach/detach/blueprint apply, sessions and roll call, subjects, exams
with their questions, images, attempts and answers, the exam-room
WebSocket door and `finish` frame, grading, homework and submissions,
course notes and files — answer `409` with `code: "term_archived"`.
Reads stay open. The guard is a pre-flight read of the term row: an
archive landing in the same instant as a write lets that one write
through (documented as the third accepted race).

Out of scope on purpose: personal notes, messages, pomodoro, meals,
payments, boards, appointments, chatbot, question pool/bank, events,
blueprint templates, the staff work log, and the role-demotion and
subject-delete integrity sweeps.

Coverage: 155 write routes classified (59 guarded, 93 out of scope);
e2e over real TCP covers archive → refused writes → open reads → the WS
handshake 409 → unarchive; the class refusal-code pin gains
`term_archived`; README prose, tag text and endpoint table regenerated.

Closes #22.

2026-08-05

🏫 fix: class detach, blueprint sweeps and the lease that blocked themAhmet Kaan Gümüş · 051aa9b
🏫 fix: class detach, blueprint sweeps and the lease that blocked them

The detach heir was picked with two pure reads and then written, so a
concurrent detach of that heir left an enrollment tagged with a class
holding neither link — which then passed its own zero-zero delete guard,
the exact state class_pump's comment says must never exist. The heir is
now claimed on its own class row. Real-server: 4/4 rounds stranded
before, 0/4 after.

set_courses swept by diff against the pre-write handle, so a detach
erroring mid-loop left links for dropped courses attached — and the
documented repair, re-PATCHing the same list, computed an empty diff and
short-circuited. The sweep is now derived from stored state, so the
re-PATCH genuinely repairs. Sweeping before the CAS was rejected: a 409
would then have already detached rows, breaking "409 means nothing was
written".

BLUEPRINT_LOCK's write lease spanned an unbounded per-link loop, so one
delete stalled every class creation at that grade. It now covers the CAS
and the sweep read only, with each detach re-asserting its source.

prune wrote the store but not the handle, so create and update answered
with a course the template no longer held; and a template could be
written naming a course deleted since the pre-flight read.
docs: 📝 make six doc surfaces say what the code now doesAhmet Kaan Gümüş · 2e0b57a
docs: 📝 make six doc surfaces say what the code now does

The batch that gated `lessons_held_total` on the lesson having started,
made un-grading refund both counters, taught `Course::delete` to prune
blueprints, held both meal date bounds to the calendar and turned a
half-configured TLS pair into a boot error moved only README. The utoipa
annotations and the tag descriptions still carried the old rules, and one
README bullet list stated two opposite decrement rules 24 lines apart.
fix: 🏫 stop a deleted course from sticking in a blueprintAhmet Kaan Gümüş · b0f72a5
fix: 🏫 stop a deleted course from sticking in a blueprint

A grade template holds its courses as a list on its own row, so nothing in
`Course::delete`'s cascade could reach it: the id stayed, and the repair
every doc surface named — `PATCH` the template back as it stands — is a 400
for naming a course that does not exist. The pump's own prune only fires
while walking a section, so at a grade with no sections the id was permanent.

The cascade now sweeps `class_blueprint` in the same transaction that
detaches the course from the sections. Table scan, deliberately unindexed:
one row per grade label, and a course delete is rare — and the per-element
index the WHERE would want (`FIELDS courses[*]`) is the one this store
answers with no rows at all.

`prune` stays for the window the sweep cannot cover (a course deleted after
a pump read the list it walks) and for ids written before this existed; its
comment no longer argues the sweep should not exist.

2026-08-04

fix: 🧭 name the ceiling a class refusal actually hitAhmet Kaan Gümüş · 82c0ee2
fix: 🧭 name the ceiling a class refusal actually hit

The refusal codes shipped one commit ago read the same on both axes,
but two of them mean opposite things depending on which side is being
attached: a class at its ceiling is out of course places when a course
arrives and out of seats when a student does. So adding a student to a
full section answered class_at_course_ceiling next to a sentence about
students, and a section carrying too many courses answered
class_roster_too_large. The two tests covering it pinned the wrong
answer, one of them while asserting the prose was right.

The ceiling codes now live on the axis, so each names what it hit, and
the member route gains the two it needed.

Its documentation was wrong in the other direction too: it derived the
manual code set from the pump's, which quietly promised codes only a
pump can answer — a deleted class or course is a 404 there, never a
409. Each route now states its own set, and the spec guard compares
those sets rather than searching the whole document for the strings,
which is why it never caught any of this.
feat: 🏷️ answer a manual class refusal with the pump's own codeAhmet Kaan Gümüş · 574b977
feat: 🏷️ answer a manual class refusal with the pump's own code

Attaching a course or adding a member by hand refused with an English
sentence, while the very same conditions reached through a blueprint
pump had just become machine codes. One cause, two shapes — and the
client that has to word them is bilingual.

The vocabulary now has one home on the pump's own refusal type, the
blueprint's skip list reads it from there, and the two manual routes
carry it as a code beside the sentence they already sent. Prose is
unchanged and no other route gains the field.

Coding these also exposed a claim this series had been making wrongly:
a pump attaches a course it has just proved alive, so it can never
report a stale link. Only a member add walks the section's existing
courses, and only it can answer that one.
feat: 🩺 say which sections are out of step with their blueprintAhmet Kaan Gümüş · 0684656
feat: 🩺 say which sections are out of step with their blueprint

A pump is best-effort, so it can leave a grade half stocked — and the
skip list saying which half lived in one response body and nowhere
else. A manager who closed the tab had no way back to it.

The status read answers it from the store: the template, how many
sections carry the label, and what each section is missing. A course
attached by hand counts as present, because that is exactly what the
pump does with it.

It also writes down the recovery nobody had been told: re-sending the
same list re-runs the pump, and a section can be re-stocked on its own.
A class moved to another grade keeps what the old template gave it —
which this read now shows rather than leaving to be discovered.
feat: 🔍 filter the class index by gradeAhmet Kaan Gümüş · cf0a010
feat: 🔍 filter the class index by grade

A blueprint keys on a grade label and its pump is best-effort, so a
manager can be handed a skip list naming three sections at grade 9 —
and had no way to list the sections at grade 9. The label the office
typed is the only thing tying them together, and nothing read it.

Matched verbatim, like the pump it exists to debug: a filter that
trimmed or folded would disagree with the thing it is meant to explain.
An empty value asks for the sections carrying no grade at all, which is
what an empty grade already means everywhere a class is written.
feat: 🏗️ stock a new section from its grade's blueprintAhmet Kaan Gümüş · 67ced09
feat: 🏗️ stock a new section from its grade's blueprint

Editing a template reached every section already at the grade, but
making a section reached no template — so a blueprint described every
section except the ones created after it, and the office had to
remember a second call each time.

A create now applies its grade's blueprint, after the homeroom
demotion rollback and never before it: the rollback deletes the class,
and that delete refuses while the class holds courses.

The 201 body carries the class, what could not be stocked, and which
grade's template stocked it — null when none covers the grade, which
is also what a stocking that faulted reports, because a 500 here would
strand a section whose id nothing else returns.
feat: 📊 say how many sections a blueprint pump reachedAhmet Kaan Gümüş · 81c5490
feat: 📊 say how many sections a blueprint pump reached

A grade label is free text and matched exactly, so a section typed "9 "
carries a grade no blueprint for "9" will ever find. The pump answered
that with an empty skip list, which reads exactly like every section
having taken the whole template.

It now says how many sections it walked, so nothing reached is a zero a
manager can see rather than a silence. Normalising the label was the
other way out and is not taken: the label is the blueprint's own record
id, schools spell their ladders differently on purpose, and nothing
would repair the labels already stored.
fix: 🧹 report a dead course once per pump, not once per sectionAhmet Kaan Gümüş · 7bfebea
fix: 🧹 report a dead course once per pump, not once per section

A course deleted out from under a blueprint is pruned by the pump that
finds it, but the pump looped its sections over the list it read at the
start, so twelve sections meant twelve identical skips and twelve prune
writes for one dead course — and the rustdoc claimed otherwise.

The run now carries what it has found dead, and a blueprint that is
itself deleted mid-run ends the loop rather than answering for every
section left: the remaining sections would all answer the same. The
skips already collected are still returned, because the sections before
it did attach.
fix: 🔒 stop a deleted blueprint from stranding the rows it taggedAhmet Kaan Gümüş · b1c8e7a
fix: 🔒 stop a deleted blueprint from stranding the rows it tagged

Delete swept the course list the handler had read and then removed the
row, so a pump adding a course in between left class_course rows tagged
with a blueprint that no longer existed — reachable by nothing, since
the sweep is the only thing that reads the tag.

Delete now takes a compare-and-set on that list, removes the row first
and only then sweeps by the tag itself, so a racing addition is swept
too; the pump answers blueprint_deleted rather than landing an orphan,
claiming the blueprint inside its own transaction; and BLUEPRINT_LOCK
closes what neither could, since SurrealDB does not serialise the pump's
cross-record read against this delete. The residue is a process crash
between the delete and the sweep, which no lock survives: inert rows, a
detach each, counters exact.

The pump's created-row slot was hand-counted (7, or 9 on an axis with a
pivot claim). The guard would have shifted it silently on the only path
that uses the guard, so the statement list is built as a list and the
slot is read off its length.
fix: 🏷️ name blueprint skips with codes a client can branch onAhmet Kaan Gümüş · b7a351c
fix: 🏷️ name blueprint skips with codes a client can branch on

The pump reported a refused (class, course) pair with an English
sentence, which a bilingual client can neither branch on nor translate.
Every other enum here is an id plus a client-side label; skips now are
too, over a closed set documented on the response schema.

No information is lost: Skip already carried the class and the course as
their own fields, and neither sentence that named a record ever
interpolated it.

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.
feat: 🧑‍🏫 give a class section a homeroom teacher and open it to studentsAhmet Kaan Gümüş · e590b84
feat: 🧑‍🏫 give a class section a homeroom teacher and open it to students

Two gaps in the class-section layer, closed together because the
second is what makes the first worth storing: a section could name no
homeroom teacher, and a student could never learn which section they were
in — every /classes route was teacher+, so the layer was invisible to the
people inside it.

A section carries an optional `teacher`. The named account must be
teacher+, `null` and `""` both clear it, and an omitted field is left
alone rather than re-stated from the caller's snapshot. The column is
additive: rows written before it carry no key at all, which reads back
as null, so nothing is backfilled and no whole-row write coerces a
counter. A demotion clears the column everywhere — only teacher+ may
hold a section, and the sweep set_role already ran for course staffing
now runs for sections too.

Two reads sit outside the teacher+ bar. GET /classes/me serves any
authenticated caller their own section; GET /classes/user/{user} serves
teacher+ or a linked parent, through the same observer gate marks,
attendance and pomodoro use — which 403s before it 404s, so a parent
never gets an existence oracle.

Opening those reads meant the response could no longer carry `creator`.
A section's creator is always manager+, and below teacher+ that identity
was unreachable: GET /users is admin-only and /users/search is teacher+.
So `creator` is null for those callers and the join never even fetches
it, which keeps the response and the person map from drifting apart.

The role bar was a read-then-write with nothing between them. A demotion
landing in that window left the account homeroom teacher forever, since
its sweep had already run and matched nothing — and course assignment
had carried the same hole since it was written. Both now re-read the
live role after the write and undo the assignment with a 409. A create
that loses this way rolls the whole section back rather than leaving a
teacherless one standing, and the rollback releases the term reference
inside its own transaction, so no term is left undeletable. A rollback
the delete guard refuses is a 500, not a 409 whose text promises nothing
was created.

Every guard here is pinned by a test that fails when the guard is
removed, including the three race sites: a DEFINE EVENT on the table
being written fires inside the handler's own write, which is exactly the
window between the role check and the re-read. No production code knows
the seam exists.

Verified against the real volume: the migration applies to a database
whose section rows predate the column, those rows come back byte-identical
with every refcount intact, a second boot changes nothing, and both new
reads answer correctly on stored data.

The English prose calls this a class section throughout, keeping şube as
a parenthetical gloss — the word has a plain equivalent and the docs were
carrying the Turkish as though it did not.

Known and left: can_manage_course still trusts Course.creator without
re-reading the live role, so a demoted creator keeps course-management
reads — its own series. set_role writes the role before its sweeps and
they are not one transaction; every sweep is idempotent and grants
nothing, so a re-sent PATCH repairs the residue.
fix: 🔩 close the bug hunt across meals, classes and capsAhmet Kaan Gümüş · 7198cea
fix: 🔩 close the bug hunt across meals, classes and caps

A three-domain hunt, its fixes, and a verifier panel that refuted two of
them. Kept as one commit because the pieces interlock — cap.rs, the
settings pair and the pump all move together, and no smaller cut compiles.

Money can no longer be lost or stranded. Both seat transitions carry
their ledger line inside their own transaction: the claim writes the
charge, the flip writes the reversal. Before, a crash between the two
left a seat held with no bill, or a bill with no seat, keyed to an
attempt no later request could ever reach. A lost cancel could refund a
live seat. The menu revision was bumped in a query of its own, so a
booking reading in the gap claimed against a capacity or a price the
menu had already left.

Deleting a menu now takes its marks and its dishes with it, in the
transaction that deletes the row. The id is deterministic on (date,
slot), so anything left behind came back on the next publish — the
kitchen reading "served" for a student who never came.

A seat is always releasable: manager+ cancels any booking and is not
bound by the cutoff, so a promoted student's seat no longer wedges its
menu forever, and a debt that outlived its owner's role can be settled.
Canteen money follows /payments and is manager+, not teacher+ — what a
family owes the school is not classroom information.

The class pump claims its pivot in-transaction. An attach racing a
course delete used to commit a link to a row that was gone, and nothing
could then detach it or delete the class. A hand enroll now disowns a
pumped row, so a sweep cannot take back a roster decision an operator
made by hand. The role sweep is one transaction. Rosters are ordered by
when a student was added, which is what they always claimed. Both class
axes have a ceiling, and each refuses on the other's, because a pump
writes one row per member per course in a single transaction.

Settings edits are serialized: retire is idempotent, so an undo log
cannot tell the attempt that flipped a name from one that found it
already flipped, and the loser un-retired what the winner had legally
retired — leaving a kind gone from the list, gradable, and unremovable
for good. Grading now checks the school's list, not only the counter.
Three caps that read a snapshot integer now read the live column.

A clear marker is charged to the board's lifetime counter and boot
repairs the boards that predate it. Blank canvases refuse the clear, and
the room reports that as its own code: the refusal text had drifted into
the substring the WebSocket read as "closed", which told a live room it
was permanently read-only.

Verified against the real volume: both boot backfills, the slot-name
rule and its grandfather clause, and the new money gate.

2026-08-01