Repository navigation
Closed
Description
Existing issue check
- I searched open and closed issues for this work.
Problem or outcome
#12 recorded the Milestone 2 design direction and ADR 0007 (#13) encodes it. This issue is the work record for the first implementation slice: the configuration schema, the domain services that author and publish program versions, and the versioned JSON export/import — the foundation every later Milestone 2 slice (authoring interface, enrollment pinning) builds on.
After merge, an operator-less test can create a program, author a draft version (phases, transitions, competencies, tasks, rating scales, forms, standards citations), publish it, prove the database rejects mutation of the published version, and round-trip it through export/import losslessly.
Scope
In scope:
- migration adding
program,program_version, and owned typed rows: phases, allowed phase transitions, competencies, tasks, rating scales with anchors and modifiers, evaluation forms with per-competency scale bindings, and external standards citations — STRICT tables, UTC unix-second instants, CHECK-constrained enums, per ADR 0007 and the 0002 idiom; - publish freeze enforced by database triggers (INSERT/UPDATE/DELETE rejected on the version and its owned rows once
published_atis set), theaudit_eventenforcement class; - phases optional: a version with zero phases is valid (annual/in-service shape);
- domain services for draft authoring, publish-time validation (transition endpoints, scale bindings, and citations all belong to the version; monotonic version numbering), and publish;
- documented, versioned JSON export of a whole program version and import that round-trips losslessly, normalization per
docs/records-integrity.mdcanonical-bytes semantics; - audit events for program and version lifecycle actions; and
- integration tests proving each of the above, invented fixtures only.
Out of scope:
- authoring web interface (following slice under Milestone 2 design: versioned program configuration schema (owner decisions needed) #12);
- enrollment and enrollment pinning (following slice under Milestone 2 design: versioned program configuration schema (owner decisions needed) #12);
- HTTP API surface beyond what the authoring interface slice needs (decided there);
- record types that consume this configuration (Milestone 3+).
Acceptance criteria
- A draft program version can be created, populated, validated, and published through domain services.
- Once published, UPDATE and DELETE on the version and INSERT/UPDATE/DELETE on its owned rows fail at the database with explicit errors, proven by tests that attempt raw SQL mutation.
- A version with zero phases publishes successfully.
- Publish-time validation rejects transitions, scale bindings, or citations referencing rows outside the version.
- Export produces the documented versioned JSON; import reproduces an identical version (round-trip test compares canonical forms).
- Rating scales cover all three kinds (anchored numeric, pass/fail, narrative-only) in fixtures and tests.
- Standards citations attach at version, competency, and task level and survive the round trip.
- Lifecycle actions append audit events.
Expected proof
cargo fmt --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspace
Related roadmap, decisions, or issues
docs/roadmap.mdMilestone 2;docs/domain-model.mdConfiguration;docs/records-integrity.mdCanonical bytes- ADR 0001, ADR 0007 (docs(decisions): adopt program-version configuration model #13)
- Design record: Milestone 2 design: versioned program configuration schema (owner decisions needed) #12 (stays open across Milestone 2 slices)
Metadata
Metadata
Assignees
Labels
No labels
Activity
programs(config): program versions, publish freeze, and export/import