Server-side FTE decimals and activation lock (#2464)¶
Problem¶
- The Headcount form caps FTE at one decimal (#2318), but the DTO validators
only checked
0 ≤ fte ≤ 1and the HR import storedfloat(raw)unrounded. An imported0.753was valid server-side and unsubmittable in the edit form. - The Configurator greys the activation toggles out once
is_startedis true (#2146), butPATCH /year-configuration/{year}never read the stored flag.
Shipped¶
backend/app/modules/headcount/data_entries.py:FTE_DECIMALSreads the existingmodule_input_decimals(headcount)constant (the same value the frontend'smaxDecimalsis generated from). All fourvalidate_ftevalidators reject more decimals than that.headcount_members_api_provider.py: the HR feed is rounded toFTE_DECIMALSat transform time — rounding rather than rejecting, because the source legitimately carries more precision than the module models.backend/app/api/v1/year_configuration.py: the PATCH answers 409 when the stored yearis_startedand the payload touches a module or submoduleenabledkey. Other keys (uncertainty, thresholds, inputs/csv deactivation) stay editable, matching the #2146 decision.- Random seed generator rounds FTE to one decimal.
- Frontend untouched: it already derives the lock from
is_started; the backend is now the one that enforces it.
Tests¶
tests/unit/modules/test_headcount_schemas.py: two-decimal FTE rejected on member/student create and update.tests/unit/services/data_ingestion/test_headcount_members_api_provider.py:0.753→0.8at transform.tests/integration/backoffice/test_module_activation.py: module and submoduleenabledPATCH on a started year → 409 and config unchanged;uncertainty_tagPATCH still 200.
Follow-up (2026-09-24): the rejected row was invisible on the module page¶
Validation testing uploaded a member CSV with fte=0.888 from the module
page: the row was skipped as designed, but the toast read "CSV sync
completed" with no reason. The job stream, the pipeline console and the
back-office upload card all showed the warning; only the module-page
notifier missed it.
Every ingestion provider persists row errors under meta.stats.row_errors
and strips row_errors from the meta root, while ModuleTable.vue read
payload.meta.row_errors off the SSE payload — always undefined, so
formatRowErrorLines returned no lines and the success branch fired.
frontend/src/utils/rowErrors.ts:formatJobRowErrors(meta, t)reads thestatsblock and returns the caption and count; the module page uses it.JobUpdatePayload.metano longer declaresrow_errorsat the root.frontend/tests/unit/csv-row-errors-sse.spec.ts: a backend-shaped partial import yields a caption with the row and reason, a clean one yields none.