Expand description
The credit registration ledger.
transition, and its batched twin transition_batch, are the only writers of state,
stamping state_entered_at, the lifecycle timestamps and the audit event in one transaction.
Which transition to make is the caller’s decision; whether it is one the machine has is decided
here, from CreditRegistrationState::allowed_targets.
Structs§
- Admin
Credit Registration - One ledger row as an admin sees it: every identifier support needs to answer “what happened to this student”, across courses.
- Admin
Credit Registration Filters - The narrowings the admin explorer applies, all of them in SQL.
- Attention
Registration - One row the Errors tab wants a human to look at, with the detectors that picked it.
- Batch
Move - One row’s move in a
transition_batch. - Credit
Registration - Credit
Registration Error Code Count - Live rows carrying an error code, split by whether the pipeline is still working on them.
- Credit
Registration Throughput Day - One day of terminal outcomes, for the throughput series.
- Module
Registration Totals - Live volumes per course module, for the Courses tab’s one row per module.
- NewCredit
Registration - Oldest
NonTerminal Registration - The row that has been waiting longest for the pipeline to do something with it.
- Payload
Snapshot - Frozen copy of what we are about to submit. Written once, before the row leaves
checking_enrolment: a later regrade must not alter a submitted row. - Registration
Latency - How long registration took, in seconds, for rows that reached
registeredin a window. - Registration
Scope - Which rows a phase iteration may touch. Empty means every row, which is what production runs; a narrowed scope lets a test drive the pipeline for its own course on a shared database.
- Stuck
Registration Count - Stuck
Thresholds - How long a row may sit in one state before it counts as stuck. Seconds, per state.
- Student
Credit Registration - One ledger row with the course, module and enrolment facts every student view needs, so a status page is one query rather than a fan-out per row.
- Student
Registration Filter - Narrows
get_student_facing_by_user_id; the default returns every row of the user’s. - Teacher
Credit Registration - One ledger row as a teacher sees it: the raw state, the student’s identity and the unmasked verified student number, but never the study registry’s own error text.
- Teacher
Credit Registration Filters - The optional narrowings a teacher surface applies, all of them in SQL.
- Terminal
Outcome Totals - What the pipeline finished in a window.
- Transition
Enums§
- Admin
Credit Registration Sort - How the explorer orders a page. Descending only: an ops table is read newest-worst first.
- Credit
Registration Error Code - Why a ledger row is where it is;
statesays what happens to it next. - Credit
Registration State - What the pipeline does next with a ledger row.
- Request
Purpose - Which call a request item id addresses a row for.
- Resubmission
Refusal - Why
CreditRegistrationState::resubmission_refusalwould not move a row. - Resubmission
Strictness - How far outside a failure
CreditRegistrationState::resubmission_refusalwill still allow a row to move back toready_to_submit. - Transition
Policy - Which (from → to) edges
transitionwill write.
Constants§
- ADMIN_
ONLY_ TARGETS - The edges only a hand transition may take, from any state [
admin_transition_refusal] does not refuse: putting a row back on the pipeline, and writing one off.
Functions§
- admin_
facing_ 🔒page - The one query behind both
get_admin_facingandcount_admin_facing, so a filter wired into one cannot be missed in the other.total_countis computed before the limit, which is whycount_admin_facingreads it withlimit = 1. - check_
edge 🔒 - Refuses an edge outside the policy. The one place (from → to) legality is decided, for the
single-row
transitionand the batchedtransition_batchalike. - claim_
due - Claims up to
limitdue rows in the given states for this worker. - count_
admin_ facing - How many rows
get_admin_facingwould return without a page limit. - count_
by_ error_ code - The error-code breakdown the Overview shows.
- count_
by_ module failed_countisfailed_permanentandmisregisteredonly, so the columns do not add up to the total by design.- count_
by_ module_ and_ state_ for_ course - Live rows of one course per module and state, for the teacher’s per-module summary, with how many of each need a human folded in: both counts are read off the same scan, since the summary always wants them together.
- count_
by_ state - Live rows per state, for the dashboard funnel. Superseded attempts are excluded, as in the per-course sibling, or a course that regrades counts every student twice.
- count_
entered_ state_ since - Live rows that entered one state within the window.
misregisteredis not terminal, soterminal_atcannot answer this. - count_
needing_ admin_ attention - count_
pending_ by_ reason - Live
pendingrows per blocker, for the surfaces that used to read the three collapsed states off the ledger. Derived fromcredit_registration_preconditions, so it cannot disagree with what the recompute is waiting for or with what the student is shown. - count_
stuck - Rows the pipeline should have moved by now, per state. Only the four states with a threshold count: the rest wait on a student or a human, where an alert would fire on normal operation.
- count_
submission_ uncertain_ by_ course_ id - How many of a course’s live rows a bulk retry has to refuse, all for the one remaining reason: the submission may have landed, so only a human may move that row.
- count_
teacher_ facing_ by_ course_ id - How many rows
get_teacher_facing_by_course_idwould return without a page limit. - count_
terminal_ outcomes_ since - dismiss_
enrolment_ banner - The student dismissed the in-course-material re-enrol banner for this registration.
- exists_
for_ user_ and_ course - Whether this account has any attempt, live or replaced, on this course.
- get_
admin_ facing - A page of the ledger for the admin explorer, cross-course.
- get_
attention_ items - Rows at least one attention detector picked, worst-waiting first.
- get_
by_ course_ id - get_
by_ id - get_
by_ ids_ for_ update - The named rows, locked until the caller’s transaction ends. Must be called inside one.
- get_
by_ user_ id - get_
live_ by_ states - Live rows in each of the given states, newest activity first within each state, for the
Reconciliation lists.
limit_per_statecaps every state independently, viaROW_NUMBER, so one state with many rows cannot crowd another out of a sharedLIMIT. - get_
oldest_ non_ terminal - get_
registration_ latency_ between - get_
retryable_ ids_ by_ course_ id - The course’s live rows a bulk retry can actually move: failed for good. Oldest first, capped by
limit. - get_
student_ facing_ by_ user_ id - The user’s registrations as the student surfaces show them, newest completion first. Superseded attempts are included: the student is entitled to see an earlier attempt Sisu may still hold.
- get_
teacher_ facing_ attempts_ for_ completion - Every attempt for the same completion as
row, that one included, newest attempt first. - get_
teacher_ facing_ by_ course_ id - The course’s ledger rows as the teacher surfaces show them, newest completion first.
- get_
teacher_ facing_ by_ id - One row for a teacher surface, by id.
Nonewhen no such live row exists. - get_
throughput_ by_ day - Daily terminal outcomes over the window. Withdrawn rows are in no column: they are neither a success nor a failure.
- import_
request_ item_ id - The item id Suotar sees for the import and resolve calls. Deterministic, so a Suotar log line maps to one ledger row without an id allocation table.
- increment_
submit_ retry_ count - increment_
verify_ attempt_ counts - Counts one verify poll for every row of a batch and returns each row’s new count. The count is part of the poll’s request item id, so it has to be taken before the request goes out.
- insert
- Creates a ledger row at
pendingwith acreatedevent. The id is allocated here becauserequest_item_idderives from it. - make_
due_ now_ batch - Makes rows claimable again now, whatever backoff parked them.
- mark_
improvement_ checked - Records that the grade-improvement scan looked at this accepted attempt against a completion in the given revision and found nothing better.
- mark_
superseded - Points an old attempt at the newer one that replaced it. The old row keeps its state and
terminal_at: it really was registered. - recheck_
no_ usable_ enrolment_ now - Brings forward the recheck of rows parked for want of an enrolment, for students the study registry now lists as enrolled.
- recovery_
request_ item_ id - The item id Suotar sees for one look through a student’s attainments for a submission we lost track of.
- request_
item_ id - What one registration is called in a request. The one place a sender picks an item id, so two calls about one row stay tellable apart in both logs.
- requeue_
retryable_ now - Makes every due-later
failed_retryablerow due now; returns how many. The button pressed once the study registry says an outage is over. - schedule_
next_ attempt - Defers when the pipeline may next claim this row; the delay is the caller’s policy.
- schedule_
next_ attempts schedule_next_attemptfor a whole batch, each row with its own time.- search_
pattern_ 🔒of - Lowercased and with metacharacters escaped, so a search for
%matches a literal one. - set_
first_ failed_ at_ for_ testing - Backdates
first_failed_atfor a registration, so a test can simulate a retry window that started long enough ago for its retry limit to have elapsed. - set_
needs_ admin_ attention - set_
payload_ snapshot - set_
sisu_ attainment_ if_ unclaimed - Records the attainment the study registry holds, unless another live row already claims it.
- set_
state_ entered_ at_ for_ testing - Backdates
state_entered_atfor a registration, so a test can simulate a row that has been sitting in its state long enough for a backoff or timeout to fire. - set_
submitted_ attainment - set_
test_ exclusive_ hold_ for_ testing - Excuses every one of a user’s rows (or, with
course_id, just that course’s) from unscopedclaim_duecalls untilheld_until; a scoped call ignores every hold regardless (seeclaim_due). Keyed on identity rather than a row id so a spec can hold before materialize creates the row it means to protect, closing the window a row-id hold could only ever narrow: the live background worker ticks every 10s regardless of any single test, so a hold applied after the row exists still races the worker’s own next tick. - teacher_
facing_ 🔒page - The one query behind every teacher-facing read, so a filter wired into a page cannot be missed
in its count.
total_countis computed before the limit, which is why the count reads it withlimit = 1. - transition
- Moves a ledger row to a new state and appends the matching audit event, atomically.
- transition_
batch transitionfor a whole batch: one lock, one update, one insert of events, whatever the size.- verify_
request_ item_ id - The item id Suotar sees for one verify poll.