Repository navigation
Description
Existing issue check
- I searched open and closed issues for this work.
Problem or outcome
Slice 1 (#14, merged in #15) delivered the schema, domain services, and export/import. Nothing yet lets a training coordinator use them: there is no HTTP surface and no interface. This issue is the work record for the authoring slice — the /api endpoints over the existing domain services and the embedded web interface for authoring, comparing, publishing, and importing/exporting program versions (roadmap Milestone 2; the vertical-slice order recorded on #12).
After merge, a signed-in coordinator holding manage_programs can build a complete program version in the browser — phases, transitions, competencies with tasks, all three rating-scale kinds, modifiers, forms, and standards citations — publish it, see it frozen, compare any two versions, export the documented JSON, and import one, without ever hand-writing JSON.
Scope
In scope:
- HTTP endpoints over the slice-1 services: list/create programs, list/create versions, get version content, replace draft content, publish, discard draft, export, import (new program and next-version); handlers translate refusal enums to stable error codes, policy stays in the services;
- reads gated on a signed-in session; mutations additionally gated on
manage_programs(the services already enforce it; handlers surface the 403); - program handlers live in their own module with
http.rsremaining the thin hub (router,ApiError,CurrentUser), preserving that ownership boundary; - web interface: programs list with create and import; program page with version list, publish, discard, export, and import-as-next-version; a structured version editor over the typed content document (draft editable, published read-only); a compare view rendering a legible structural diff between two versions of a program;
- Rust integration tests for every endpoint's happy path, refusal mapping, and authentication/capability gates;
npm run checkandnpm run buildstay green; an e2e flow through the compiled binary when the environment can run it.
Out of scope:
- enrollment and enrollment pinning (next slice under Milestone 2 design: versioned program configuration schema (owner decisions needed) #12);
- record types that consume this configuration (Milestone 3+);
- fine-grained per-row editing endpoints (the draft model is wholesale replacement per ADR 0007; revisit only with evidence it fails coordinators).
Acceptance criteria
- Every endpoint above exists, is integration-tested, and returns the documented stable error codes for each refusal (
capability_required,no_such_program,no_such_version,already_published,name_taken,invalid_contentwith problems,incompletewith problems,unsupported_format). - Unauthenticated requests to program endpoints receive 401; authenticated users without
manage_programscan read but not mutate. - A coordinator can author the full invented fixture program through the interface without writing JSON, publish it, and the interface then presents it read-only.
- Two versions of a program can be compared with differences legible at section level.
- Export from the interface produces the documented format; importing that document works for both targets.
-
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace, andnpm run check/npm run buildinweb/all pass.
Expected proof
cargo test --workspace(withweb/built first so the embedded-asset paths are exercised)npm run checkandnpm run buildinweb/npm run e2einweb/where the environment provides a Chromium
Related roadmap, decisions, or issues
docs/roadmap.mdMilestone 2; ADR 0005 (embedded web interface); 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
- Design record: Milestone 2 design: versioned program configuration schema (owner decisions needed) #12 (stays open; enrollment pinning remains after this slice)
Activity
programs(web): authoring API and embedded interface