forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to service/tests/test_model.pyClear filter

2026-09-18

fix(compute): 🔎 unanchored marks get their own reason and a drop countAhmet Kaan Gümüş · b38d070
fix(compute): 🔎 unanchored marks get their own reason and a drop count

P2 on the trend-anchor fix: a series whose exam ids cannot be time-anchored
still answered `available=false, n=0, "eğilim için en az 6 not gerekir"` —
indistinguishable from a student who really has fewer than 6 marks, i.e. the
same user-visible failure for any future id shape. A mixed series computed on
a silently filtered subset with no signal that rows were dropped.

`_ordered_marks()` now returns `(pairs, unanchored)` — the count of rows that
carry a mark but whose id could not be decoded. `course_trend()` puts that
count in every result:

* `n_total` — rows carrying a mark (the series the reader expects);
* `n_unanchored` — among them, rows whose anchor could not be decoded;

and when the trend cannot run while `unanchored > 0`, the reason names the
actual cause: "N notun zaman damgası çözümlenemedi; M not kaldı (en az 6
gerekir)" — the too-few-marks sentence is kept for anchorable short series
only. When the trend runs over a subset, `n` of `n_total` plus
`n_unanchored` make the filter visible.

Never-guess rule unchanged: an unparsable id contributes no anchor and is
never assigned a guessed stamp.

Tests (`tests/test_model.py` +3): all-unparsable 8-mark series gets the
distinct reason with `n_total=8, n_unanchored=8` (any mark-less row does not
count toward `n_total`); a 5-mark anchorable series keeps the gate sentence
with `n_unanchored=0`; a filtered 6-of-8 subset runs (`available=true`,
`delta=-20`) and reports `n=6, n_total=8, n_unanchored=2`.
fix(compute): 🕒 trend time anchor reads uuid v7 exam ids too, not only ULIDsAhmet Kaan Gümüş · 0d9d992
fix(compute): 🕒 trend time anchor reads uuid v7 exam ids too, not only ULIDs

`course_trend()` ordered a course's marks by decoding each exam id as a
26-char ULID (`model.ulid_ms`). The backend mints uuid v7, so every id failed
to parse, every row was dropped as "time unknown", and a course with 8 graded
marks answered `available=false`, `n=0`,
"eğilim için en az 6 not gerekir" — the live symptom in
`GET /api/insights/students/{id}` (Matematik: n_marks=8 while trend n=0).

Replace the anchor with `model.id_ms()`: uuid v7 (canonical 36-char form,
version nibble pinned to 7, first 48 bits = unix-ms) or ULID (26-char
Crockford base32, first 10 chars). An unparseable id still falls back to
`None` — no invented timestamps, and the caller skips the row as before. The
≥6-mark threshold is untouched: the bug was the anchor, not the gate.

Tests (`tests/test_model.py`, new): the live uuid v7 sample, a real fixture
ULID, the seeder's own ULID→uuid-v7 pair (`ids.ulid_to_uuid7`) agreeing on
the same stamp, malformed/None inputs returning `None` without raising, and
`course_trend` over 8 uuid v7 marks (`available=true`, `n=8`) plus a mixed
ULID/uuid-v7 series ordering correctly.

Sweep of the same class ("assume the id is an X"):
* `attention.py` evidence token `exam_ulid_created_at` → `exam_id_created_at`
  (no consumer matches the old value) and its stale docstring.
* `marks._ordered_marks` docstring and `docs/HESAP-DOGRULAMA.md` §1 updated.
* Left as-is: `protocol.new_trace_id()` stays ULID (backend `protocol.rs`
  documents the frame trace id as ULID and never correlates on it);
  `ids.py` is the generation-side ULID→uuid-v7 migration record;
  `spec/schema.json` `id_rules` is the pre-Postgres snapshot.