forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on ebffd41acbeb31d10b21d6eeb70a9dbaaaa29b10Filtered to tests/partial_patch_terms.rsClear filter

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

🧪 test: port T4 regress/partial-patch suites to the Postgres harnessAhmet Kaan Gümüş · f553d14
🧪 test: port T4 regress/partial-patch suites to the Postgres harness

- fixture SQL → runtime sqlx (kind_ref/slot_ref upserts, settings JSONB,
  point-row UPDATEs, count/scalar helpers); ULID idioms re-pointed
- SurrealDB DEFINE EVENT injections → PG-native: RAISE triggers (roles/
  classes/blueprints pending), pg_sleep window trigger (exam delete),
  lock-queueing probe (attendance), row-snapshot probe (badge awards)
- EXTRA: drop DB_KEEPALIVE_INTERVAL_SECS/DB_PING_TIMEOUT_SECS + their
  /limits EXCLUDED pins; drop stale BOARD_OPEN_GUARD pin (wave-2 leftover)
- production fixes pinned by these suites: exam_result grade claim mints
  an absent kind_ref (absent = in service); field_update run() emitted a
  double WHERE (every guarded PATCH 500'd); attendance event mark now
  locks the event row (orphan race); admin floor takes the admin-set row
  locks (cross-target demotions raced); profile focus sum cast to BIGINT
- delete the two appointment store-property tests: their subject was the
  SurrealDB engine's write-skew; Postgres closes it by constraint
- .sqlx refreshed for the changed query macros

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

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