forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to src/db/course_note_file.rsClear filter

2026-09-23

✨ feat(podcast): dispatch every attachment as sources, not just the newest PDFAhmet Kaan Gümüş · 979d53f
✨ feat(podcast): dispatch every attachment as sources, not just the newest PDF

The submit door now lists all of the note's attachments (id ASC), stats each
blob, and dispatches the present ones as `sources` — `source_key` rides on as
the first source's key, one-release compat. A blob that is gone is skipped with
a log line; `409 source_missing` now means zero attachments or zero present
blobs, and a note id with any single attachment is a valid job.

`podcast.report` gains additive `sources` (`{key, name, status}`, `ok` or
`skipped:<code>`), stored verbatim into the job row's new JSONB `sources`
column and replayed by `GET /podcast/jobs/{id}/result`. `newest_pdf` is
deleted with its service wrapper — clean cutover.
Local-Gate: fe26c0cd12b31b6a48cacff9a3a6119bd241d89e (1518 passed, 459s)

2026-09-17

🎧 feat(podcast): the submit door resolves the note's PDF and hands the service its blob keyAhmet Kaan Gümüş · 5f9e97c
🎧 feat(podcast): the submit door resolves the note's PDF and hands the service its blob key

`podcast.submit` now carries `source_key` — the blob key of the note's newest
`application/pdf` attachment, resolved by the backend before the job row is
written. The service extracts the source with pymupdf, so it needs the file
itself: a note id alone names nothing it can open.

- `db::course_note_file::newest_pdf` reads the note's newest PDF (UUIDv7 id
  order is mint order), and the key it hands on is the row's own id — the same
  key the attachment's blob is stored under in the school's blob directory.
- `POST /podcast/jobs` refuses `409 source_missing` before anything is written
  when the note has no PDF attachment, or when that attachment's blob is not
  present on this host — instead of queueing a job the service can only fail
  later in its `kaynak` stage.
- The payload keeps `source_id` for the record and the report echo; a report
  now matches the row's note id, never a fixed literal.
- `tests/podcast.rs`: the submitting tests mint a real course note with a PDF
  (teacher cookie, real doors) and witness the dispatch's `source_key`, both
  refusal shapes (no row written, nothing dispatched), and that the newest PDF
  — not the newest file — is the source. Pre-fix those four witnesses fail
  with `202` + a queued row, which is the behaviour this change removes.
- `.sqlx`: one new query entry, regenerated on a scratch prepare DB.
Local-Gate: 5d93323e202eaafb074ee46e3eaa1c0b38229725 (1473 passed, 443s)
✨ 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-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

🗃️ feat!: port boards, notes and rag to sqlx/PostgresAhmet Kaan Gümüş · c928ecf
🗃️ feat!: port boards, notes and rag to sqlx/Postgres

- board/note/course_note/rag_output db layers: static query!/query_as! against
  the union-schema prepare DB; PagedList/FieldUpdate for the runtime builders
- file caps via the cap claim CTE at each call site; board create claims
  app_user.board_count, delete releases it in the same tx
- BOARD_ROSTER_LOCK deleted: invite is one guarded atomic-array union
  (coalesce(array_agg(DISTINCT unnest(participants || $n))) with a
  cardinality cap on the row version the UPDATE acts on)
- stroke dual-counter claim: one UPDATE bumps both counters, lifetime cap +
  open guard + epoch in the WHERE; zero rows re-read via cap::full_kind
- board clear: pre-image read under SELECT ... FOR UPDATE, refusal precedence
  preserved (closed > not-creator > locked > blank), guarded epoch bump,
  marker insert, one tx (CLEAR_REFUSED THROW now Rust-level refusals)
- rag_output.payload JSONB (sqlx::types::Json), sources uuid[] cascade via
  $n = ANY(sources); note/course_note delete cascades sweep rag_output
  in-tx (real FKs refuse dangling derived rows)
- board rosters: uuid[] + GIN, membership reads $n = ANY(participants)
- dead SurrealQL-shaped constants removed (BOARD_OPEN_GUARD, BOARD_STROKE_TABLE,
  counter/file-count field constants); uuid::Uuid imports for my domain files

2026-09-11