Repository navigation
Description
Existing issue check
- I searched open and closed issues for this work.
Problem or outcome
Slices 1 (#14/#15) and 2 (#16/#17) delivered versioned program configuration and its authoring interface. The milestone exit — "a complete invented training program can be published, enrolled, exported, and reproduced" — still lacks enrollment, and enrolling needs trainees to exist: Milestone 1 only creates administrators, and full user administration is Milestone 3. This issue is the work record for the last Milestone 2 slice, with the owner-approved scoping: enrollment pinning plus a deliberately minimal user-creation path, leaving user administration proper to Milestone 3.
After merge, an administrator creates a trainee (username and display name; the initial credential is a one-time reset code through the existing, tested reset mechanism — no new secret paths), and anyone holding assign_training enrolls that trainee in a published program version. The database itself refuses enrollment in a draft.
Scope
In scope:
- migration
0005:enrollment(trainee user, pinnedprogram_version, enrolled_at/by), with a database trigger refusing enrollment in an unpublished version and a uniqueness constraint per (user, version) — re-enrollment semantics arrive with Milestone 3 lifecycle history, which may relax it; enrollmentsdomain service gated onassign_training, appending attributable audit events (trainee as the user subject, the enrollment row as the domain subject);- minimal user creation gated on
manage_users: create the user with an unusable random credential, then issue a standard administrator-origin reset code — sign-in happens through the existing reset flow; - API: create/list users, create/list enrollments per version, stable refusal codes (
not_published,already_enrolled,username_taken, plus the existing vocabulary); - interface: a create-user card on the status page (existing
manage_userssection) showing the one-time code; an Enrollments panel on published version pages with a roster picker; - tests: service and API refusals, the draft-enrollment raw-SQL trigger proof, and the Milestone 2 exit test — a complete invented program published, a trainee enrolled, the version exported, reproduced byte-identically on a clean installation, published and enrolled there too; the browser e2e extends to create a trainee and enroll them.
Out of scope:
- enrollment lifecycle: phase history, version changes with reason, withdrawal, concurrent-enrollment policy (Milestone 3);
- user administration beyond creation: editing, capability grant UI, deactivation (Milestone 3);
- assignment-scoped record access (Milestone 3).
Acceptance criteria
- An administrator can create a trainee from the interface and hand them a one-time reset code; the trainee's first sign-in goes through the existing reset flow.
-
assign_trainingholders can enroll a trainee in a published version and see the version's enrollees; others are refused withcapability_required. - Enrolling in a draft fails at the service (
not_published) and, via raw SQL, at the database. - Duplicate enrollment refuses with
already_enrolled. - Enrollment appends an attributable audit event.
- The Milestone 2 exit test passes: published → enrolled → exported → reproduced on a clean installation.
- All repository gates pass (fmt, clippy pedantic, workspace tests,
npm run check/build, e2e where Chromium is available).
Expected proof
cargo test --workspace(withweb/built first)npm run check,npm run build,npm run e2einweb/
Related roadmap, decisions, or issues
docs/roadmap.mdMilestone 2 (final item + exit);docs/domain-model.mdEnrollment; ADR 0007- Builds on Milestone 2 slice 1: program-version schema, domain services, and export/import #14/programs(config): program versions, publish freeze, and export/import #15 and Milestone 2 slice 2: program authoring API and web interface #16/programs(web): authoring API and embedded interface #17
- Design record: Milestone 2 design: versioned program configuration schema (owner decisions needed) #12 — this slice completes its expected proof, so the closing PR may close both.
Activity
enrollments(pin): enrollment pinning and minimal user creation