Commits
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-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
🐛 fix: junction-era test pins and homework audience recheckAhmet Kaan Gümüş · fa1529a
🐛 fix: junction-era test pins and homework audience recheck class_course.source and board_participant are uuids, not grade text / participants[]. Submission upsert locks homework then re-reads assignment, so a narrowing PATCH cannot land a 201 for a dropped student. Local: cargo nextest run --no-fail-fast → 1373 passed.
✨ feat: compose-stack deploy plus in-tree schema workAhmet Kaan Gümüş · 57fad2c
✨ feat: compose-stack deploy plus in-tree schema work Production deploy is podman compose (postgres + backend + openobserve) instead of a systemd binary. CI stays a throwaway postgres sidecar. Operator credentials live in ~/hezarfen_backend/hezarfen_backend.env (0600); the deploy never writes that file. Also lands the working-tree schema/junction and .sqlx updates that were already sitting next to this change.
🗃️ 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
2026-09-05
🗄️ 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.
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: 🔍 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.
2026-08-02
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.