forge
Explore
Log in

Don't you dare go Hollow

Commits

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

2026-09-25

🐛 fix(clippy): params structs for the d8dad92 list doorsAhmet Kaan Gümüş · 62f10ea
🐛 fix(clippy): params structs for the d8dad92 list doors

-d warnings gate red on main: too_many_arguments on the new filter list
functions (db/service appointment list_for_requester 8/7, db/service exam
list_windowed 9/7), type_complexity on the courses filter resolve,
extra_unused_lifetimes on pomodoro whole_log. RequesterListParams and
WindowedListParams params structs (SettingsParams precedent), the courses
tuple factored into ResolvedCourseFilter, every caller and test call site
migrated; no suppressions.
✨ 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/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.

2026-08-13

chore: rename ponytail: comment marker to corner-cut:Ahmet Kaan Gümüş · ed88733
chore: rename ponytail: comment marker to corner-cut:

Marker convention renamed after uninstalling the ponytail plugin;
semantics unchanged (deliberate corner-cut, known ceiling + upgrade path).
Token-only rename, 26 comment lines, no code change.

2026-08-05

🔒 fix: stop the review gate answering for an exam the caller cannot seeAhmet Kaan Gümüş · 73eb272
🔒 fix: stop the review gate answering for an exam the caller cannot see

`reviewable_exam` read `allow_review` before it had established the caller
has anything to review, so `GET /exams/{id}/review/*` answered 403 iff the
exam existed, was published, and had review off — and 404 otherwise. Any
authenticated caller, an unenrolled student or a parent, could read a flag
`GET /exams/{id}` refuses them outright (`can_view_course` answers 403 there
before `allow_review` is ever serialised).

The mark check moves ahead of the flag: an outsider now reads 404 whichever
way the flag is set, and only a caller the exam already marked — enrolled or
since dropped, who therefore sat it — ever sees the 403. Nothing is loosened;
the answer only gets narrower, and the 409 gates behind it are untouched.

Also documents, and pins with a test, the staff identity `GET
/appointments/slots` hands a parent: deliberate, since a conference cannot be
booked off an anonymous calendar.
📅 fix: withdraw the calendar a demotion used to leave unreachableAhmet Kaan Gümüş · e879fd3
📅 fix: withdraw the calendar a demotion used to leave unreachable

`set_role`'s below-teacher arm dropped course staffing and the homeroom
column and stopped there, so a demoted teacher's `appointment_slot` rows
outlived the role that published them — and no route could reach them
again: the teacher+ branch of `list_slots` lists the caller's OWN slots,
so no manager ever learns the id; the below-teacher branch filters out
slots whose owner is no longer staff, so neither students nor the demoted
owner see them; and both slot deletes are `RequireTeacher`. One
undeletable row per slot ever published, forever.

A live booking on one was worse. `approve`/`reject`/`reschedule` go
through `for_decision`, which needs `can_manage` AND `RequireTeacher`:
the demoted owner fails the extractor, and the manager who would pass
`can_manage` has no route that yields the id. The requester's `cancel` is
refused once the window opens. So the booking sat `pending` in their list
for good, pinning the slot's `occupied` at one — which also makes
`delete_free`'s `(occupied ?? 0) = 0` guard unsatisfiable.

The sweep now runs in the role write's own transaction, beside the other
arms: live bookings are flipped to `cancelled` with the ex-teacher on
`cancelled_by` and the reason on `cancel_reason`, then the slots go.

Cancelled rather than deleted, deliberately. Deleting them is what the
slot's own delete cascade does, but that path refuses while a booking is
live — precisely because someone is expecting the meeting — and a
demotion cannot refuse. This crate has no notification of any kind, so
the strongest defined end available to a requester is a settled row they
can still read, naming who dropped it and why; deleting it would make a
confirmed meeting vanish with no trace at all. The slot goes either way,
which is what releases the seat and keeps this convergent; the booking
then renders without a window, the shape `AppointmentResponse` already
documents for a vanished slot.

The race is closed at both ends. A booking landing mid-demotion claims
the slot row the sweep deletes, so the store settles it. A slot
*published* mid-demotion shared no key with anything the demotion wrote
and survived it, so `AppointmentSlot::create`/`publish_weekly` now claim
the publisher's own record (`cap::role_claim`, the enrollment/registration
pattern): either the sweep sees the slot, or the publish sees the new
role and answers 403.

Tests: the sweep and the refusal are unit-tested (both go RED on the
reverted fix), and the publish-vs-demotion race is a real-server test
held open with a DEFINE EVENT — 4/4 rounds strand a slot without the
claim, 0/4 with it.
fix: 📅 stop offering a slot booking will refuseAhmet Kaan Gümüş · 2202807
fix: 📅 stop offering a slot booking will refuse

`GET /appointments/slots` listed every slot whose `ends_at` was still
ahead, but `Appointment::book` refuses any slot whose `starts_at` has
passed. The two windows disagreed, so a slot already underway sat on the
student's bookable calendar as an entry that could only answer 409 —
either published inside `check_not_past`'s 60-second grace, or simply
started while the page was open.

The listing moves to `book`'s bound: `starts_at > $from`. `book`'s rule
is the real constraint, so the calendar stops advertising what booking
refuses rather than booking loosening to match. The 60-second publish
skew grace deliberately does not reach the listing either — `book` does
not grant it, and a slot published a moment after its own start is
unbookable from birth.

Two source claims were false and are corrected with it: `book`'s comment
said `list_upcoming` hid these slots, and the route doc called them
"every slot still open in the future".

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.
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-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.
docs: 📝 make the docs match what appointments and the bank actually doAhmet Kaan Gümüş · 25747d8
docs: 📝 make the docs match what appointments and the bank actually do

Three appointment commits changed behaviour and moved none of the three
doc surfaces this repo keeps in step.

- a2613cd made cancel requester-only, but README (intro, route table,
  section), both lib.rs mentions, the cancel operation's own OpenAPI
  description and the domain rustdoc all still said "either side, the
  requester or the teacher". Swagger UI was documenting a call that is
  now a guaranteed 403. All corrected, and each says what the teacher
  does instead — reject while pending, or reschedule then reject
- 6dd0c0e's overlap 409 was missing from `publish_slots`' responses, the
  README slot section and the tag; documented, including that touching
  boundaries are legal and the guard is per-teacher
- d0d2883's `cancelled_by`/`decided_by`/`cancel_reason`/`reject_reason`
  appeared nowhere in README; documented with their audience (requester
  and the slot's teacher) and that legacy rows read null

Also: the choice-image routes were not missing from the endpoint table,
they were stale — spelled `/choices/{index}/image` since dde4896 made
choices id-keyed. Renamed to `{choice_id}`, and the rustdoc that still
called it a zero-based position corrected. `refresh-from-bank` added, and
`## Layout` gained `field_update`, `monotonic_id`, `text_fold` and
`etag`. The register section now records that the uniform 201 is a
deliberate anti-enumeration measure, so nobody restores the 409.

2026-07-24

feat: ✨ appointments — only the requester may cancel - tighten the cancel guard to requester-only: a slot-owning teacher or a manager/admin can no longer cancel a booking (403); they end it by rejecting while pending or by rescheduling instead - drop the now-dead slot read the can_manage check needed - tests: teacher_cannot_cancel, manager_cannot_cancel, student_cannot_reject, and only_the_requester_cancels (reworked from either_side_cancels)Ahmet Kaan Gümüş · f1a8cf3
feat: ✨ appointments — only the requester may cancel
- tighten the cancel guard to requester-only: a slot-owning teacher or a
  manager/admin can no longer cancel a booking (403); they end it by
  rejecting while pending or by rescheduling instead
- drop the now-dead slot read the can_manage check needed
- tests: teacher_cannot_cancel, manager_cannot_cancel, student_cannot_reject,
  and only_the_requester_cancels (reworked from either_side_cancels)
✨ feat(appointments): record who cancelled or rejected and whyAhmet Kaan Gümüş · 5d48a8d
✨ feat(appointments): record who cancelled or rejected and why

Reject and cancel now take an optional free-text reason and stamp the
actor: bookings gain cancelled_by, cancel_reason, and reject_reason, all
#[surreal(default)] so rows written before these existed still read back
as None. The reason is validated (400 if over-long) before it touches the
row; a blank or absent one records nothing. AppointmentResponse exposes
the new fields, and decline_reschedule cancels with no reason.

2026-07-23

✨ feat(appointments): teachers publish slots, students book themAhmet Kaan Gümüş · 771936e
✨ feat(appointments): teachers publish slots, students book them

Teachers keep a calendar of availability windows; students and parents
book one with a reason. Publishing a window is not consent to a specific
person and topic, so a booking lands pending until the teacher approves,
rejects, or counter-proposes another time — a counter-proposal returns it
to pending for the requester to accept or decline.

A slot holds one live booking, with occupancy derived under
APPOINTMENT_LOCK rather than stored, so rejecting or cancelling frees the
slot for someone else. No two approved meetings may overlap for the
teacher or the requester.

Cancelling refuses a meeting whose window has opened, so every path that
could land a booking on a past window is closed at the source: booking a
started slot, approving a started window, and proposing a started time
all refuse. Otherwise a booking could exist that nobody was able to
cancel.

Weekly repetition expands eagerly into concrete rows sharing a series id,
capped at 52, so cancelling one occurrence is an ordinary delete.