forge
Explore
Log in

Don't you dare go Hollow

Commits

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

2026-09-25

✨ feat(api): server-side filters on the list doorsAhmet Kaan Gümüş · d8dad92
✨ feat(api): server-side filters on the list doors

A caller no longer has to download a capped collection and narrow it
in the client:

- events, exams: the WindowParams pair is SQL (no whole-table load)
  and gains starts_before/ends_before, so a past/completed view is
  expressible
- sessions: starts_after/starts_before, half-open months
- homework: due_after/due_before (the open/past tabs), class_course
- meals menus: slot (was a post-page JS filter — page counts lied)
- users (admin): roles= comma set; courses: kind, q, taught
- appointments + slots: teacher (or me), starts_after/starts_before,
  status
- pomodoro log: from/to, with the focus total summed in SQL
- messages and boards: q (folded literal substring)
- pool questions: ?status= is a WHERE, not a post-filter
- bank/course-notes id filters: garbage is a 400 naming the field,
  not an empty page

Absent params return today's response byte-shape; page and count
share one WHERE.

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.

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/fee_attendance'Ahmet Kaan Gümüş · 08aa13e
Merge branch 'layer-split/fee_attendance'

# Conflicts:
#	src/db/mod.rs
#	src/domain/attendance.rs
#	src/domain/event.rs
#	src/domain/session_attendance.rs
#	src/service/mod.rs
#	src/web/payments.rs
#	src/web/sessions.rs
Merge branch 'layer-split/comms'Ahmet Kaan Gümüş · 4ab90d9
Merge branch 'layer-split/comms'

# Conflicts:
#	src/db/mod.rs
#	src/domain/event.rs
#	src/domain/registration.rs
#	src/service/mod.rs
#	src/web/pomodoro.rs
🧹 chore: split note/session/settings into domain/db/service layersAhmet Kaan Gümüş · efea304
🧹 chore: split note/session/settings into domain/db/service layers

Pilot wave of the three-layer split. All query execution for the three
domains now lives in src/db/{note,session,settings}.rs as free fns taking
db first; web handlers call service::<x>::* only; domain keeps pure types.

- service/settings.rs gains the PATCH workflow (apply) and SETTINGS_LOCK —
  it spans a multi-call pair (retire names, CAS save, restore), so it is a
  service lock, not a db lock. The service takes its own input records
  (SettingsPatch/*Input) so wire DTOs stay in web and list validation keeps
  its original order, including the try_kept grandfathering that needs the
  stored list.
- Note/Session/Settings fields the db layer mints or CAS-binds become
  pub(crate); Settings::record_id becomes pub(crate).
- Unit tests rode with their fns: note delete cascade → db/note, session
  purge → db/session, settings load/save/CAS → db/settings, the whole
  settings edit workflow suite → service/settings.
- Doc links re-pointed (user, class_blueprint, bank_question, exam,
  note_file, tests/regress_roles); NoteId::generate's stale
  'Note::list_for_user' link now names db::note::list_for.
- Known residual for a later wave: web/notes.rs:411 file.delete() is
  note_file-domain persistence (note_file splits in C3).

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.

2026-08-05

🎟️ fix: stop a demotion sweep leaving grants it cannot reachAhmet Kaan Gümüş · 70591d4
🎟️ fix: stop a demotion sweep leaving grants it cannot reach

User::set_role lowers the role and sweeps every grant it implied in one
transaction, but those sweeps are snapshot-based. A child create landing
after the snapshot survives them, because all three wrote their other
parent — the event, course or class row — and never the user row, which
is the only key the sweep writes.

The event seat was the bad one: a seat held by someone now a parent
could be freed by nobody. unregister 403s on a non-student target, and a
parent fails RequireTeacher, so the only exits were deleting the event
or round-tripping the role. It permanently consumed a capped place.

All three now claim the holder's user row through cap::role_claim, whose
UPDATE returns the live role and so is both the colliding write and the
guard. unregister additionally bars staff rather than non-students, so a
seat already stranded on the volume is freeable by any teacher+.

undo_if_demoted was not reused here: it repairs columns, while the
residue in these three is a row plus a counter — and for the seat, the
repair would have to run before anything could free 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.
fix: 🔩 make ownership a live grant, not a permanent oneAhmet Kaan Gümüş · 8c0ba1e
fix: 🔩 make ownership a live grant, not a permanent one

Creating a course, teaching a session, publishing an event, owning a bank
template — each of these granted rights forever, whatever role the
account held afterwards. `set_role` swept the course *assignment* list on
demotion but never the creator link, and none of the ownership helpers
re-read the caller's role, so an account demoted to `student` or
`parent` kept management of everything it had ever made.

That was reachable over plain HTTP, not theoretical. Several routes take
`CurrentUser` rather than `RequireTeacher`, so a demoted creator still
read draft exams — defeating the 404-not-403 rule that exists to hide a
draft's very existence — still listed and read that course's homework,
and still saw the course in every catalogue. A demoted session teacher
still read their session with no course rights at all.

Every ownership arm now carries a live `teacher` floor, enforced inside
the helper rather than trusted from the caller:

- `can_manage_course` and `owns_course`, plus `visible_courses`, which
  fed the id sets behind `/courses`, `/exams` and `/homework`;
- `is_live_session_teacher`, replacing a bare `session.is_teacher`;
- `can_manage` for events and for appointment slots;
- `can_see` and `ensure_owner` for the question bank — floored whole, not
  only on the owner arm, since gating one arm would have left a demoted
  owner locked out of their own private template while still reading
  every school-wide one, the strictly larger set.

The `creator`, `owner` and `teacher` columns are deliberately not swept.
They answer "who made this", which stays true after a demotion; it is
the grant that is conditional, not the history.

The helpers carried a comment claiming callers had already cleared the
teacher bar via `RequireTeacher`. It was false at five call sites and had
been since the first `CurrentUser` route was added — nobody rechecks a
comment. The appointments copy was false twice over: it justified an
exception for `cancel` reaching the helper, and `cancel` is
requester-only and never calls it. That phrasing is now extinct in this
codebase, which matters more than the individual fixes: a helper that
trusts its callers is one extractor change away from this bug.

Each floor is pinned by a test that fails when the floor is removed, and
the no-orphan side by tests that fail when a floor is made too strict —
manager and admin clear the `teacher` bar by definition, so nothing is
left unadministerable. The bank's admin arm had a test that passed
vacuously, asserting against a school-visible row where the school arm
alone would grant; it now asserts on a private template owned by someone
else.

Verified against the real volume: on unswept rows, a demoted creator
loses the catalogue, the draft, the homework and the session, while
manager, admin and still-teacher accounts keep everything, and no
pre-existing row became unreachable.

Left standing: `set_role` still writes the role before its sweeps and
they are not one transaction. Every sweep is idempotent and, now that
rights are re-read live, grants nothing in the meantime.

2026-07-27

fix: 🪢 guard writes in the database, not the processAhmet Kaan Gümüş · 6c87eca
fix: 🪢 guard writes in the database, not the process

Two replicas are live; every process-local lock silently stopped
meaning anything. Move the invariants into the writes themselves:

- count caps (enroll/register/files/threads) become a counter column
  claimed by UPDATE .. WHERE n < cap (domain/cap.rs), backfilled once,
  decremented in the same transaction as every child delete
- exam freeze, re-draft and grade gates ride inside the write's own
  transaction (IF .. THROW); SESSION/WORK_ENTRY/EVENT locks die, range
  checks fold into the UPDATE's WHERE (FieldUpdate::ordered)
- appointment decisions CAS on status+proposed window+decided_by;
  bank/exam updates CAS on their editable columns
- rate limiter syncs local windows to a shared minute row every 2s,
  fail-open when the database is down
- paged GETs run LIMIT/START in the database (domain/page.rs); sites
  that post-filter in Rust stay web-sliced and say so
- exams.rs (3629 lines) splits into web/exams/{mod,attempts,questions,
  images,review}; image uploads single-source in web/image.rs; the
  bare-seq key rule lives once in domain/key.rs; migration SQL moves
  to migration_sql.rs

Every new guard is mutation-proven (removing it fails a named test).
Migration adds counter columns + rate_limit table; backfill is
one-time, guarded by = NONE, and verified against the live volume.

Traps recorded: SurrealQL 'x ?? 0 > 0' parses as 'x ?? (0 > 0)'; the
embedded mem engine drops one of two concurrent writes yet answers Ok.

2026-07-25

feat: 📐 publish every hard limit instead of making the frontend guessAhmet Kaan Gümüş · 7152aa9
feat: 📐 publish every hard limit instead of making the frontend guess

Every bound the API enforces lived in one of two places the frontend
could not read: a `pub const` in `constant.rs`, or English prose in a
doc comment ("1–20 entries", "`1`–`100`"). So the frontend kept its own
copy of each number, and the copies drifted the moment one moved.

Two surfaces now carry them, because clients consume them two ways.
`GET /limits` is one JSON document grouped by resource, built by naming
the constants directly — a runtime fetch, no codegen step, and it
carries what OpenAPI holds awkwardly (`reserved_usernames`, the raster
`image_content_types`, the closed role/kind/mode/status sets). The spec
gets the other half: 105 `max_length`/`minimum`/`min_items` bounds on the
request DTOs, which is what `openapi-typescript` and friends turn into
validators for free.

`/limits` is unauthenticated — the register form needs the username and
password bounds before a session exists, and none of it is secret, it is
the same rule a 400 already spells out. It is also exempt from the
database guard: it reads no row, and a frontend booting against a
reconnecting backend is exactly when it needs the contract, not a 503
that sends it back to the hard-coded copy.

Its `rate` group is the one part that is not compile-time. The
rate-limit tiers are env-tunable, so the endpoint reports this server's
live values off `AppState` rather than the shipped defaults — a client
should learn its budget here, not by collecting a 429.

`MAX_CHATBOT_THREAD_TITLE_LEN` moves to `constant.rs` on the way past.
It was private in `domain/chatbot_thread.rs`, reaching neither surface,
and its own comment asked to be moved the next time anyone was here.

Three tests keep both surfaces honest, because each is a hand-kept
mirror and a mirror nothing checks is one that goes stale. A constant
must reach `/limits` or an exclusion list that states why it does not; a
bound may not be declared outside `constant.rs` at all; and the emitted
spec is fetched and compared field by field against the constants —
never against literals, which would just be a third copy that passes
while both are wrong. That last one is unavoidable rather than
belt-and-braces: utoipa 5.5 takes a literal only, so
`max_length = MAX_NOTE_TITLE_LEN` does not compile.

Two duplicated `maximum = 500` literals are now pinned to
`MAX_PAGE_LIMIT`, which `constant.rs` previously only asked a human to
keep in step.
feat: 🔭 let /events and /exams ask for the next rows, not the newestAhmet Kaan Gümüş · b50d48b
feat: 🔭 let /events and /exams ask for the next rows, not the newest

`?limit=100` handed back the 100 most recently created rows, so an event
scheduled for tomorrow that was created before them never appeared. The
only correct call was to drop `limit` entirely — ~3.4 MB per poll — and
the frontend has been paying that on every right-nav tab open.

`?starts_after=` / `?ends_after=` (unix ms, both optional) filter on the
schedule instead, and either one flips the order to soonest-first, so
`limit` finally truncates the right end. `ends_after` keeps rows whose
window has not finished, falling back to `starts_at` when `ends_at` is
null; a row with no schedule at all drops out rather than sorting to an
end. Send neither and the list is untouched — same order, same total —
so nothing has to deploy in lockstep.

For exams the window lands after the visibility split and the draft
retain, so `total` still counts only what the caller may see.
fix: 🔐 a partial PATCH can no longer invert a rangeAhmet Kaan Gümüş · 352b0b0
fix: 🔐 a partial PATCH can no longer invert a range

- regression from the previous commit: writing only the field a
  request carried meant an event's schedule and a work stint's clock
  were each checked against a stored other end that a concurrent
  request had already changed, so two individually valid PATCHes
  committed starts_at > ends_at (or check_in > check_out), both 200
- the old snapshot refill hid this by always writing a consistent
  pair; the parent commit passes the same attack, this one did not
- add EVENT_LOCK and WORK_ENTRY_LOCK and hold them across
  read → range check → write, but only when a range field actually
  arrives, mirroring what terms already did correctly
- both locks are leaves: their only holders take no other lock and no
  other lock holder takes them, so the documented EXAM → BANK and
  EXAM → HOMEWORK orders are unaffected
- omitted fields are still never written; the lock guards the check,
  it does not license writing back what was only read
- regression tests race one end against the other and assert the
  stored pair is ordered whatever each request returns
fix: 🧩 a PATCH writes only the fields it was givenAhmet Kaan Gümüş · 85b408e
fix: 🧩 a PATCH writes only the fields it was given

- every PATCH handler loaded the row and refilled the fields the
  request omitted from that stale snapshot, so two concurrent partial
  PATCHes touching different fields lost each other: whoever wrote
  last silently reverted a field it was never asked to change
- field-scoping the write did not fix this — the value bound to the
  SET still came from a stale read
- add domain/field_update.rs: .set(column, Option<T>) skips an absent
  field entirely, so it is neither written nor bound, and an all-absent
  PATCH writes nothing at all
- convert notes, events, terms, homework, work entries and courses,
  each with a 20-round concurrent-PATCH regression that fails against
  the old code on round 0 and passes after
- nullable columns stay clearable: an event's schedule, a course's
  capacity and term, and homework's assigned subset keep the
  double-option so an explicit null still writes NONE, while an
  omitted field is left alone
- homework's old fallback was worse than a no-op: it could re-narrow
  the assigned subset over a concurrent widening, behind the guard
  that exists to stop exactly that
- cross-field validation still reads the stored row where it must
  (event and term ranges need both ends) — read for the check, never
  written back
- HOMEWORK_LOCK was taken after the row read, so it never covered the
  read-modify-write it looked like it guarded

2026-07-19

✨ feat(users): read-only parent role with student tiesAhmet Kaan Gümüş · ec44315
✨ feat(users): read-only parent role with student ties

Parent sits below student in the hierarchy: clears no staff bar and
fails every exact student gate, so it can only observe. Admins tie
students to a parent under /users/{id}/students; the tie alone opens
the student's marks/attendance/pomodoro reports (full, unnarrowed)
plus the parent's own /users/me/students list. A role change off
either end of a tie sweeps it, mirroring the enrollment sweep.

2026-07-18

🐛 fix(events): re-derive registration gate under the lockAhmet Kaan Gümüş · 05cfa93
🐛 fix(events): re-derive registration gate under the lock

The register handler read the event (capacity, audience kind, schedule)
before Registration::register took REGISTER_LOCK, so a concurrent PATCH
landing in that gap admitted against stale data. The gate moved into
Event::registration_capacity and register re-reads the event fresh
under the lock; the handler's early call remains as fast-fail only.
🐛 fix: six correctness holes from full-code auditAhmet Kaan Gümüş · ecbd550
🐛 fix: six correctness holes from full-code audit

- register response resolved people from {target, caller} only; a
  re-register returns the original placer's row, so registered_by
  degraded to a bare ULID username — resolve from the row itself
- note-file cap was count-then-write with no lock (SurrealDB does not
  conflict-check cross-record counts against inserts): concurrent
  uploads pushed a note past 10 files; the cap now lives inside
  NoteFile::insert under FILE_CAP_LOCK, web pre-check dropped
- ends_at-only registration events (pure signup deadlines) never closed
  signups; the gate read starts_at alone — close at starts_at ?? ends_at
- WorkEntry::check_out deleted the open row and created the closed one
  in separate calls — a failure between them silently destroyed the
  whole stint; take and re-file share one transaction now
- Exam::delete removed the exam row outside the child-cascade
  transaction — a failure left an empty exam shell; folded in
- ExamAttempt::start treated any create failure as a lost double-start
  and returned the latest attempt as a resume, passing a finished
  sitting off as 200 on a transient error; resume only when the
  read-back attempt is still in progress

Regression tests (failing-first) cover the first three; the remaining
three are fault-injection-only windows validated by the existing suites.

2026-07-16

✨ feat(events)!: registration audience replaces hand-picked usersAhmet Kaan Gümüş · 31e155a
✨ feat(events)!: registration audience replaces hand-picked users

Events gain a `registration` audience: a signup list built one seat
at a time — teachers place students (students never register, not
even themselves), staff take only their own seat, never another's.
An optional capacity caps the list (seat count re-checked inside the
insert transaction), and the list freezes the moment the event
starts, both directions. Seats resolve live like every audience:
roster, marking gate, and who-missed report inherit unchanged.

- POST /events/{id}/register {user_id?}: idempotent seat upsert
  (enrollment's composite-id trick); 409 when full or started
- DELETE /events/{id}/register/{user}: same self-or-student rule;
  a deleted account's leftover seat is any teacher's to free
- event delete cascades signup rows; audience switches leave them
  inert (they resurface if the kind returns)
- migration split into DDL + backfill queries: statements in one
  batch see the batch-start schema, so a backfill next to a fresh
  DEFINE FIELD silently lost the keys it wrote (audience became {})

BREAKING CHANGE: the hand-picked `users` audience kind is gone —
requests naming it are rejected. Existing users-audience events
convert on boot: each listed user becomes a registration row
credited to the event creator and the audience becomes an uncapped
registration list.
✨ feat(events)!: audience targeting + teacher-only attendanceAhmet Kaan Gümüş · bd9e7d8
✨ feat(events)!: audience targeting + teacher-only attendance

Every event now carries an audience — school (default), one exact
role, a course's live enrollment, or a hand-picked user list (<=100)
— defining its expected-attendee roster. Resolved at read time, never
snapshotted, so role changes and (un)enrollment move people in and
out by themselves. Visibility is unchanged: everyone sees every event.

- GET /events/{id}/roster: who-missed report (teacher+), expected
  list joined with marks, status null = never marked
- marks for people later dropped from the audience stay in the
  attendance listing but leave the roster report
- pre-audience rows backfill to school-wide on boot

BREAKING CHANGE: POST /events/{id}/attendance requires teacher+ —
students can no longer mark attendance, not even their own — and the
target must be in the event's audience (400 otherwise). Event
responses gain an audience object.

2026-07-15

✨ feat(web)!: paginate every list endpointAhmet Kaan Gümüş · f3d2b0a
✨ feat(web)!: paginate every list endpoint

Every array-returning GET now accepts `?limit=&offset=` and returns a
`{ items, total, limit, offset }` envelope instead of a bare array.
Paging is opt-in: omitting `limit` returns the full list (limit echoes
null), so callers that need the whole set — an exam's questions during a
sitting, roster/grade pickers — are never silently truncated. `total`
always carries the unpaged count, so a frontend can render "100 of 256"
and drive a pager without a second request.

Windowing is a slice over the already-ordered domain list (the domain
layer is untouched); endpoints that embed people run that join over the
page alone. `limit` must be 1..=500 and `offset` >= 0 (else 400); an
offset past the end yields an empty page, not an error.

Covers all 17 list GETs, including /courses/me, /work/me, /work/{user},
and /users/search — whose hard 10-row cap is dropped in favour of the
same paging. Not paged: /exams/{id}/attempt/{questions,answers}, the
marks & attendance report objects, /exams/{id}/live, and /settings.

Shared machinery lives in web::page (Page<T>, PageParams, paginate).
Docs updated across the OpenAPI spec (utoipa query params + Page_*
response schemas), the Swagger UI it feeds, and the README (a Paging
section plus a `· paged` tag on every list row).

BREAKING CHANGE: list endpoints return a pagination envelope, not a bare
JSON array — clients must read `.items`. /users/search no longer caps at
10 results.

2026-07-13

✨ feat(school): editable policy settings + academic termsAhmet Kaan Gümüş · ea8bfeb
✨ feat(school): editable policy settings + academic terms

Every school differs; the varying parts become data instead of code:

- settings singleton (GET any user, PATCH manager+): exam kinds,
  attendance statuses, grade-display bands. Absent row = old
  hardcoded defaults, so existing databases behave unchanged.
- core four attendance statuses stay mandatory — the attendance
  rate is defined over them; school extras tally rate-neutral
  under a new `custom` bucket in reports.
- grade bands are display-only over the canonical 0-100 marks:
  reports gain grade/average_grade/overall_grade labels, stored
  marks never change with the display scale.
- terms are rows (semester/trimester/quarter all fit); courses
  link via nullable term_id, term delete unlinks, past dates
  allowed for mid-year calendar backfill.
- settings edits never rewrite stored rows: retired kinds and
  statuses live on in old records; only new writes validate
  against the current lists.

2026-07-12

✨ feat(authz): wall course reads behind enrollment and ownershipAhmet Kaan Gümüş · ed007d9
✨ feat(authz): wall course reads behind enrollment and ownership

Students could read any roster, roll call, and event attendance; any
teacher could read any exam's results, statistics, live monitor,
answer sheets, and answer key (correct included), plus full
marks/attendance reports of any user.

- can_view_course = enrolled | creator | manager+; the /courses and
  /exams catalogs filter per caller (list_created, list_for_courses)
- course sub-reads (roster, results, statistics, live, questions,
  answer sheets) require course-management rights
- roll-call and event rosters become teacher+ views; students keep
  /attendance/me and /marks/me
- /marks/{user} and /attendance/{user} narrow to the courses the
  caller manages; manager+ still sees the full report
✨ feat(schedule): reject past times on exam, session, and event writesAhmet Kaan Gümüş · bd67462
✨ feat(schedule): reject past times on exam, session, and event writes

- check_not_past (web/mod.rs): a request-set starts_at/ends_at must not
  lie before the server clock — a deadline that starts in the past is
  dead on arrival (400); applied on create and PATCH of exams, course
  sessions, and events
- SCHEDULE_PAST_GRACE_MS (60 s) absorbs request latency and client-clock
  skew so "starts now" survives its own round trip; genuine backdating
  stays rejected
- PATCH judges only values the request carries: stored times merged in
  are exempt, so a running exam (past starts_at) still takes renames and
  deadline extensions
- work-log check_in/check_out corrections stay free — records of past
  work, not schedules
- unit tests for check_not_past and check_time_range; OpenAPI field docs,
  400 descriptions, and schema examples updated (examples moved to a
  future instant)
✨ feat(attendance): course sessions, roll call, work log, reportsAhmet Kaan Gümüş · 5b6aac1
✨ feat(attendance): course sessions, roll call, work log, reports

- course_session: a course's lesson (teacher, topic, required starts_at,
  optional ends_at); managed under course rights like exams; explicit
  teacher_id must hold teacher+; lists ordered by starts_at (timetable)
- session_attendance roll call: one row per session+user by composite id,
  course denormalized so reports need no join; students never self-mark —
  the session's teacher or a course manager marks enrolled students, and
  the teacher's own presence row is manager+ only (no self-declared
  presence); session/course deletes cascade roll-call rows
- work_entry staff timesheet (teacher+): check-in/out stamped by the
  server clock only, so a client clock or crafted request can't forge
  presence; one open stint per user held atomically — INSERT IGNORE on
  the deterministic open_{user} id, check-out takes it via DELETE RETURN
  BEFORE and re-files under a ULID; manager+ reads any log, corrects
  closed stints (ordered instants), deletes entries
- attendance reports at /attendance/me and /attendance/{user} (teacher+),
  mirroring the marks report: event tallies + session tallies +
  per-course breakdown; rate = (present+late)/(present+absent+late) —
  late attends, excused counts against no one; unenrolling hides marks
  but never absences (attendance is a historical record)
- RequireManager extractor; check_time_range shared by events/sessions
✨ feat(exams): scheduled attempts, live monitor, questions, answers, exam roomAhmet Kaan Gümüş · ade4fed
✨ feat(exams): scheduled attempts, live monitor, questions, answers, exam room

- exam scheduling as one validated unit: mode sync|async + window
  (+ per-student duration_ms for async); unscheduled stays offline-graded
- exam_attempt: one row per exam+user by composite id; start = attendance
  signal, finish = submission; status/deadline recomputed from the current
  schedule on every read (mode frozen once attempts exist, times extend live)
- teacher live monitor: GET /exams/{id}/live snapshot + SSE /live/stream
- exam_question: choice|text authored per exam, kind bundle (choices+correct)
  validated as a unit, frozen once attempts start, ULID order
- exam_answer: upsert per question+user via composite id, kind-coherent,
  server-clock stamped; pure auto_score over choice questions as a grading
  suggestion — final mark stays human via /results
- student exam room WebSocket at /exams/{id}/attempt/ws: state ticks,
  autosave acks, finish/expire lifecycle, gates rejected pre-upgrade with
  proper HTTP statuses; shares the REST write path
- PersonRef embeds (id + username + display name) in people-bearing
  responses, plus teacher+ GET /users/search
- cascades: exam/course deletes sweep attempts, questions, answers, results

2026-07-11

✨ feat(web): axum handlers, DTOs, and auth extractorsAhmet Kaan Gümüş · 3c4822c
✨ feat(web): axum handlers, DTOs, and auth extractors

The HTTP layer over the domain. DTOs are plain strings on the wire;
handlers parse them into validated newtypes before touching the
database. Responses share one UserResponse shape (id, username, role).

Auth is a session cookie: login sets an HttpOnly, SameSite=Lax
`session` cookie (Secure when configured) backed by a server-side row;
logout is idempotent. Extractors encode access control by type —
CurrentUser for any logged-in caller, RequireTeacher / RequireAdmin
for role-gated routes — with the role re-read every request so a change
takes effect on the next call.

Routers: auth (register/login/logout/me), users (admin listing + role
changes), notes (per-user CRUD), events + attendance, and exams +
results. Ownership and role rules live in the handlers: event/exam
edits are creator-or-manager+, grading is teacher+ and never targets
oneself, and admins can't change their own role.