Skip to content

Milestone 2 slice 2: program authoring API and web interface #16

Closed

Description

@TusanHomichi

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.rs remaining 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 check and npm run build stay green; an e2e flow through the compiled binary when the environment can run it.

Out of scope:

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_content with problems, incomplete with problems, unsupported_format).
  • Unauthenticated requests to program endpoints receive 401; authenticated users without manage_programs can 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, and npm run check / npm run build in web/ all pass.

Expected proof

  • cargo test --workspace (with web/ built first so the embedded-asset paths are exercised)
  • npm run check and npm run build in web/
  • npm run e2e in web/ where the environment provides a Chromium

Related roadmap, decisions, or issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions