Commits
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
🧹 chore: drop keepalive-era telemetry instruments + tighten claim-fn visibility; Postgres docs (README/CLAUDE.md); ship migrations/ in the imageAhmet Kaan Gümüş · a2a344c
🧹 chore: drop keepalive-era telemetry instruments + tighten claim-fn visibility; Postgres docs (README/CLAUDE.md); ship migrations/ in the image
🧪 test: finish src-side suite port + persistence re-expressionAhmet Kaan Gümüş · cfa11b2Browse files
🚧 wip: class-pump/meals/homework production fixes + T5 test-port continuationAhmet Kaan Gümüş · 35683acBrowse files
🗃️ fix: macro-legal binds/decodes + Send-general closures (repair round, 1564→0)Ahmet Kaan Gümüş · 83c3ce5Browse files
🗃️ feat!: port exams domain to sqlx/PostgresAhmet Kaan Gümüş · 381e16c
🗃️ feat!: port exams domain to sqlx/Postgres
- db/{exam,exam_question,exam_attempt,exam_answer,exam_result,question_image,answer_image}:
SurrealQL -> static query!/query_as! (PagedList exemption kept for
exam_question listing); composite natural PKs (exam,user,seq) everywhere;
sitting scoping via key.rs wire helpers unchanged.
- Freeze gate: write_unfrozen/IndexedResults/FROZEN_SLOT deleted; freeze is
a shared in-tx freeze_gate() (exam row FOR UPDATE + EXISTS(attempts)) run
inside each question/image write's own tx_with_retry.
- EXAM_LOCK deleted: sitting create re-judges sittable/window gates on the
locked exam row (guard_start) then claims exam_sat_total in one CTE;
exam delete locks the exam row before its ordered cascade and collects
blob keys inside the tx; answer/answer-image saves lock the exam row
ahead of their upserts (bump-and-restore touch tricks deleted).
- PRESENCE_LOCK deleted: join = unconditional left_at clear; last-out =
single conditional stamp_left_if_running (left_at IS NULL AND
finished_at IS NULL AND live-schedule in-progress); ExamPresence map
mutex stays for counts.
- Grade tx: exam row FOR UPDATE, draft gate in-tx, kind_ref claim
(retired=false), 4-counter first-vs-regrade precedence preserved exactly;
remove() refunds via data-modifying CTE.
- THROW markers -> early returns: exam_redraft, questions_frozen, no_exam,
question_subject_gone, question_row_gone, question_stale_move,
exam_missing, exam_draft, kind_retired.
- cfg(test) mods left for wave 3.2026-09-11
Merge branch 'layer-split/exam_artifacts'Ahmet Kaan Gümüş · 312f795
Merge branch 'layer-split/exam_artifacts' # Conflicts: # src/db/exam_attempt.rs # src/db/mod.rs # src/domain/attendance.rs # src/domain/chatbot_thread.rs # src/domain/homework_submission.rs # src/domain/session_attendance.rs # src/service/course.rs # src/service/mod.rs # src/web/exams/mod.rs
🧹 chore: split exam_answer/exam_result/answer_image/question_image into domain/db/service layersAhmet Kaan Gümüş · 61990deBrowse files
Merge branch 'layer-split/meal'Ahmet Kaan Gümüş · b0e9ab8
Merge branch 'layer-split/meal' # Conflicts: # src/db/mod.rs # src/service/mod.rs
🧹 chore: split meal_attendance, meal_ledger, menu, menu_dish, dietary_profile into domain/db/service layersAhmet Kaan Gümüş · d548120
🧹 chore: split meal_attendance, meal_ledger, menu, menu_dish, dietary_profile into domain/db/service layers - db/: menu (publish/read/find/list/CAS cap update/cascading delete + bump_menu_and_write), menu_dish (create/read/listings/count/patch/delete), meal_attendance (mark/list_for_menu/list_for_student), meal_ledger (append/read/price_snapshot/list_for_student/balance_of + KindTotal), dietary_profile (read/tags_of/save). Bodies byte-identical; entity fields pub(crate) for cross-layer construction (exam precedent). - service/: menu owns MENU_LOCK (multi-call count-then-write span) and every dish write (add_dish with the MAX_DISHES_PER_MENU gate, update_dish/delete_dish) plus menu/dish read pass-throughs; meal_ledger owns charge_booking/reverse_booking/credit orchestration; meal_attendance and dietary_profile are read-through pass-throughs. - domain/: pure remnants only — ids, newtypes, getters, sign convention, charge_for/reversal_for row builders, conflicts; ULID IDS minters stay; persistence tests ride with their fns into db/. - web/meals.rs: handlers call service::* only; MENU_LOCK leases and the dish-cap gate moved out; validation order preserved. - re-pointed merged callers (service/meal_booking, db/meal_booking, db/exam_attempt doc link) and test imports (integration, regress_meals). cargo check --all-targets clean; cargo test --lib 577 passed 0 failed; cargo test --test regress_meals 18 passed 0 failed.
🧹 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
Merge branch 'layer-split/exam'Ahmet Kaan Gümüş · e0fb40e
Merge branch 'layer-split/exam' # Conflicts: # src/db/mod.rs # src/domain/course_session.rs # src/domain/exam.rs # src/domain/exam_question.rs # src/service/mod.rs # tests/regress_course_child_orphans.rs
🧹 chore: re-point C1 cross-lane call sites after exam_attempt/course mergesAhmet Kaan Gümüş · ad1326cBrowse files
🧹 chore: split exam_attempt into domain/db/service layersAhmet Kaan Gümüş · c13b51d
🧹 chore: split exam_attempt into domain/db/service layers
src/domain/exam_attempt.rs keeps the pure core (ExamAttemptId, AttemptStatus,
the entity + getters, deadline/status arithmetic); fields went pub(crate) so
the layers can mint and target rows.
src/db/exam_attempt.rs takes every query: finish/set_left (the two
field-scoped writes), the reads (read, read_latest_for_user, list_*,
any_for_exam), and the write_unfrozen[_with] freeze-gate transaction gateway
with FROZEN_SLOT and the THROW markers.
src/service/exam_attempt.rs owns the workflows and the cross-call state:
EXAM_LOCK moves here from web/exams/mod.rs (it spans multi-call workflows —
start's writer lease, saves' reader leases), the sitting gates
(ensure_sittable/ensure_student/ensure_student_now/ensure_enrolled/
check_rejoin/writable_attempt) move out of the handlers, as do course_of
(web may not be imported from service) and question_of_exam (the answer
funnel's lookup). start keeps its name from the domain; start_attempt /
finish_attempt / save_answer_checked are the handler workflows extracted
whole, windows and term gates and all, in the original gate order.
web/exams/attempts.rs keeps authz extractors, DTOs, and response assembly
only; exam_ws.rs, exams/{mod,questions,images,review}.rs and courses.rs
re-point to the service paths; domain/exam_question.rs and
question_image.rs call the db-layer write_unfrozen* directly. Doc links to
moved items re-pointed. Tests ride with their layer: persistence
(field-scoped write) tests in db, workflow (start/retake/race) tests in
service; assertions unchanged, only paths and call shapes.