forge
Explore
Log in

Don't you dare go Hollow

Commits

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

2026-09-25

✨ 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-11

✨ feat: optional student label on pomodoro sessionsAhmet Kaan Gümüş · 54ec62d
✨ feat: optional student label on pomodoro sessions

POST /pomodoro/start accepts an optional {label} body (trimmed, blank
stored as absent, >100 chars rejected). The label rides the finish
re-file, is returned on start/finish and in both log endpoints, and is
published as pomodoro.max_label_len on GET /limits. SCHEMAFULL field
added; pre-feature rows read as no label.
Merge branch 'layer-split/comms'Ahmet Kaan Gümüş · 4ab90d9
Merge branch 'layer-split/comms'

# Conflicts:
#	src/db/mod.rs
#	src/domain/event.rs
#	src/domain/registration.rs
#	src/service/mod.rs
#	src/web/pomodoro.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

📝 feat: generate README endpoint table from the served OpenAPI specAhmet Kaan Gümüş · bf8046e
📝 feat: generate README endpoint table from the served OpenAPI spec

tests/doc_sync.rs renders the 275-row table from /api-docs/openapi.json
(auth floor from declared 403s, else the handler's Require* extractor,
asserting exactly one floor per operation), drift-gated in the suite;
UPDATE_DOCS=1 regenerates. Static rows are router-verified and plain
.route() registrations must reach the table or the suite fails.
Curated prose folded into handler doc comments; CLAUDE.md convention
updated (table generated; full suite = cargo nextest run).

2026-08-05

⏱️ fix: stop a start/finish loop buying the pomodoro badgesAhmet Kaan Gümüş · 37ee719
⏱️ fix: stop a start/finish loop buying the pomodoro badges

`PomodoroSession::finish` moved `pomodoro_finished_total` (and the focus-ms
total, and the study streak) once per call, with no minimum duration and no
per-day cap. Finishing is self-service: a stint is two requests, no second
person and no elapsed time, so 200 `POST /pomodoro` + `POST /pomodoro/finish`
pairs — about ninety seconds inside the 300/min default — drove the counter to
200 and minted `pomodoro_finished_10`, `_50` and `_200`. Those awards are
irrevocable: nothing anywhere deletes a `badge_award` row, and no route deletes
a `pomodoro_session`, so the phantom stints stood in the profile forever too.
This is the farm `PoolQuestion::approve` already reasons about from the other
end ("a bare insert is self-service … so a counter moved there is farmable");
`pomodoro_finished` was the one badge counter that rule was never applied to.

A stint now counts only if it ran at least `MIN_COUNTED_POMODORO_MS` (5 min)
and is within that UTC day's `MAX_COUNTED_POMODORO_PER_DAY` (16). Five minutes
is well under a conventional 25-minute pomodoro on purpose — a student who
breaks off early still focused, and the counter must not punish that — while
sitting four orders of magnitude above a scripted round-trip, which is the only
distance that matters: the cheat now costs the wall clock it claims. Sixteen a
day is above any honest school day (sixteen full pomodoros is over six hours of
pure focus) and caps the minimum-length farm at eighty minutes of real waiting
per day, so `pomodoro_finished_200` takes at least thirteen calendar days to buy
instead of ninety seconds. Both boundaries are inclusive on the counting side:
exactly the minimum counts, and the sixteenth of the day counts.

The verdict rides the same transaction that closes the stint (no read-then-
write) and is **stamped** on the row as `counted`, not re-derived: thresholds
are compiled in and will move, and any future debit must read the same value
the credit did. The day bucket (`pomodoro_counted_day` / `_today`, midnight UTC
via `Timestamp::day_number`) rolls in its own statement ahead of the verdict,
reading the day column it also sets — the pre-statement resolution rule that
already forces the streak pair apart. Both new user columns and the session's
`counted` are `option<>`, so no backfill is owed. A stint below the bar is
still recorded, still listed and still in `total_focus_ms`: the rule bounds
what counts, never what is kept.

Stale data: none to repair (the live volume carries no non-zero profile
counters), and an inflated counter could not be repaired anyway — lowering it
does not take back the badges it bought.

Tests: the farm repro (200 pairs move nothing and mint no badge), both sides of
the minimum, the day quota and its midnight-UTC roll, and the streak suite
re-pinned on stints that count. Mutation-proved: neutralising the two
thresholds turns four of them red, the farm one at (200, 132).

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-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(pomodoro): server-stamped student focus logAhmet Kaan Gümüş · 73d4367
✨ feat(pomodoro): server-stamped student focus log

Students start/finish pomodoro focus sessions; the server stamps both
instants, so recorded focus time is honest. Starting discards a dangling
unfinished session instead of conflicting — a crashed timer never blocks
the next one. Logs return the page envelope plus total_focus_ms (unpaged
sum of finished durations); teachers+ read any student's log. Breaks and
the work/break rhythm stay in the frontend — the backend stores no timing
policy.