forge
Explore
Log in

Don't you dare go Hollow

Commits

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

2026-09-24

✨ feat(schedule): holiday calendar, slot topics, and the weekly-plan materializer coreAhmet Kaan Gümüş · 7c481f7
✨ feat(schedule): holiday calendar, slot topics, and the weekly-plan materializer core

Schema (migrations/school/20260924000001_holidays_and_materialize.sql): a
school-wide `holiday` table over instant ranges, an optional `topic` on both
weekly-plan slot tables, and UNIQUE (class_course, starts_at) on
course_session so two lessons of one section cannot start together.

Domain: `holiday` (name/kind/range newtypes, inclusive `overlaps`) and
`calendar` (the school-zone day math hoisted out of web/attendance, which now
imports it). `WeeklySlot` carries an optional topic; `overlaps` is unchanged.

Db: `holiday` CRUD + overlap-paged list + the materializer's unpaged read;
`course_session::insert_many` (one unnest INSERT .. ON CONFLICT DO NOTHING
RETURNING, so the reported rows are the rows actually inserted) plus
`existing_starts`; a duplicate start on the single-session route now answers
409 session_time_taken instead of a 500.

Service: `holiday` pass-throughs and `course_session::materialize` — one
transaction, archived-year wall, row lock on the instance, refusals coded
instance_has_no_weekly_plan / instance_has_no_teacher, a range cap of 366 days
and a candidate cap of 500, holidays and already-scheduled starts skipped and
counted, nothing ever deleted. Dry run is side-effect free.

The HTTP surface, per-section course lists, and the integration suite follow in
later commits.
✨ feat(courses): grade-ladder course templates with per-class overridesAhmet Kaan Gümüş · 450bc8c
✨ feat(courses): grade-ladder course templates with per-class overrides

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

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

2026-09-17

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

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

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

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

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

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

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

2026-09-16

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

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

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

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

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

2026-09-12

2026-09-11

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

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-07-21

✨ feat(courses): manager-assigned course teachersAhmet Kaan Gümüş · 5ff771b
✨ feat(courses): manager-assigned course teachers

A course used to have exactly one manager: its creator. A teacher taking
over someone else's class needed manager+, which is the wrong bar for
ordinary staffing.

Courses now carry a `teachers` list alongside the (still immutable)
`creator`. Manager+ assigns and unassigns via POST/DELETE
/courses/{id}/teachers; the assignee must already hold teacher+, since
every gate behind the assignment re-checks that bar anyway.

The rights split in two:

- can_manage_course: creator, assigned teacher, or manager+. Everything
  inside the course — edit, enroll, exams, sessions, subjects, grading,
  roll call. Every existing gate routes through this one helper, so
  assignment reaches all of them at once.
- owns_course: creator or manager+ only. Deleting the course and changing
  who teaches it. An assigned teacher runs a course; they don't own it,
  and can't delete it out from under the person who made it.

Staffing is deliberately manager-only: a course's own creator cannot hand
management rights to their peers.

Stale data: rows written before the field decode as unassigned (a serde
default on the field) and the boot backfill fills them to []. DDL and
backfill stay in separate batches — sharing one silently strips keys on
SurrealDB 3. Verified against the real volume, not just the in-memory
tests: a legacy-shaped row backfilled, rendered, and took an assignment.

A demotion below teacher sweeps the user off every course they were
assigned to, mirroring how promotion drops enrollments.

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.
✨ feat(courses)!: embed the creator as a person refAhmet Kaan Gümüş · c996ce4
✨ feat(courses)!: embed the creator as a person ref

CourseResponse.creator was a bare user id, so the frontend catalog
resolved names by downloading users separately — a call that broke
with the blank-q rule and left students seeing raw ULIDs. Courses now
join the creator on like sessions and enrollments already do: one
person_map over the page's creators, PersonRef::resolve degrading to
the bare id if the row is gone.

BREAKING: course payloads return creator as {id, username,
display_name} instead of a string.

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(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