Skip to content

Milestone 2 design: versioned program configuration schema (owner decisions needed) #12

Closed

Description

@TusanHomichi

Problem or outcome

Milestone 1 (the operable shell) is complete: #2, #4, #6, #8, #10 all closed. The next milestone is versioned program configuration — the most consequential schema in the product, because finalized records pin to exact program versions forever (PRINCIPLES.md 5) and ADR 0001 named configuration-version tooling as a cost to design early. Implementation should not start until the owner settles the questions below; this issue is the design work record.

Proposed shape (for reaction, not a fait accompli)

  • Program / ProgramVersion split: program is the stable identity; program_version is an immutable, publishable unit. Drafts are mutable until published; publishing freezes the version and everything it references. Enrollments pin a program_version, never a program.
  • Version contents as owned rows, not JSON blobs: phases (with non-linear transitions), competencies, tasks, forms, and rating scales as typed tables keyed to the owning program_version. Database invariant 5 from the domain model (all referenced configuration belongs to the pinned version) becomes enforceable foreign keys instead of application discipline.
  • Immutability enforcement: published versions get the same trigger-enforced protection as audit_event — UPDATE/DELETE rejected at the database once published_at is set.
  • Export/import: a documented, versioned JSON format for whole program versions (PRINCIPLES.md 9), round-trip tested; the canonical record-bytes design (Milestone 0 exit) informs its normalization.
  • Vertical slice order: schema + domain services + export/import first with API; authoring UI in the same milestone but a following slice, per the architecture's "web interface is part of every vertical slice" applied at milestone granularity.

Decisions that need the owner

  1. Rating scale semantics: fixed per-program-version numeric scales with anchors (e.g. 1–7 with definitions), or fully agency-defined shapes (pass/fail, narrative-only, mixed per competency)? This drives the evaluation schema for every later milestone.
  2. Phase transition model: is a directed graph with explicit allowed transitions enough (covering remediation loops and skips), or do centers need conditional/rule-based transitions in v1?
  3. Form model: how structured is a Daily Observation Report form — fixed sections owned by the product with agency-configurable competency lists and labels (my recommendation, per the anti-form-builder principle), or does the form itself need configurable sections?
  4. Draft collaboration: does program authoring need multiple concurrent editors in Milestone 2, or is single-editor with last-write honesty acceptable until proven needed?
  5. Version numbering: agency-visible version labels (free text like "2026 CTO Program rev B") alongside internal monotonic version numbers — acceptable?

Expected proof (once design is settled)

  • ADR for the program-version model
  • Migration + domain services + export/import round-trip tests
  • A complete invented training program published, enrolled, exported, and reproduced (Milestone 2 exit)

Related roadmap, decisions, or issues

Activity

  1. TusanHomichi commented on Aug 28, 2026

    @TusanHomichi
    MemberAuthor

    Recording design input and owner direction from design discussion, ahead of the ADR.

    Design input: external standards traceability

    Centers align training programs to published external standards. CALEA's public-safety communications accreditation program is a driving example — its training standards cover new-hire, CTO-style, and annual in-service requirements, and assessors periodically ask agencies for proofs of compliance — alongside APCO ANS training standards and state POST/continuing-education requirements. Two consequences for this schema:

    1. Standards citations are versioned configuration. A competency, task, or program version can carry agency-entered citations to external standards (body, edition, clause, optional note). The product never embeds standard text (copyrighted, access-controlled reference material) and never grows standards-body-specific code paths (PRINCIPLES.md 1). Citations freeze with the published program version (PRINCIPLES.md 5): when a standards body revises an edition, existing records keep the citations they were created under. Coverage reporting — "every finalized record supporting clause X in this accreditation cycle" — belongs with Milestone 5 exports, but the citation fields exist from the first configuration migration so that report is a query, not a retrofit.

    2. Phases are optional on a program version. Annual/in-service training is a real program shape with no phase progression — topics and hours per cycle rather than a graph. Continuing-education tracking itself can wait for a later milestone, but the schema must not structurally assume phased programs, or annual training becomes a schema break instead of a feature.

    Owner direction on the five decisions

    Settled frame: agencies configure the vocabulary; the product owns the grammar. Configurability lives in content — terminology, scales, competency lists, labels, citations, phase graphs — not in structure. Two reasons: under PRINCIPLES.md 5 every published configuration shape is a permanent reproduction obligation (deterministic exports must render it for the life of every record pinned to it), and a recognizably consistent record structure is part of what makes a record defensible to a third party such as an accreditation assessor, arbitrator, or counsel.

    1. Rating scale semantics: a small set of product-defined scale kinds — anchored numeric, pass/fail, narrative-only — each fully agency-defined in content (range, anchor definitions, labels) and assignable per competency, mixed within one program version. No freeform scale semantics the product cannot reason about.
    2. Phase transition model: an explicit directed graph of allowed transitions, which already expresses remediation loops and skips. No conditional or rule-based transitions in v1; revisit only on demonstrated need from a real center.
    3. Form model: product-owned form skeleton with agency-configurable competency lists, labels, scales, and standards citations. No agency-configurable form sections; the anti-form-builder principle holds.
    4. Draft collaboration: single editor with honest last-write behavior for program authoring in this milestone. Real concurrent editing remains Milestone 3's concern, where session drafts already plan contributor and ownership-transfer history.
    5. Version numbering: internal monotonic version number for identity and ordering, plus a free-text agency-visible label (e.g. "2026 CTO Program rev B"). Accepted.

    Decisions 1 and 5 are where agency customization fully lands; 2–4 are where structure stays product-owned. That boundary is the pattern to hold through implementation.

    Next

    ADR for the program-version model encoding the above, then the schema + domain services + export/import slice with round-trip tests, per the expected proof in this issue.


    Generated by Claude Code

  2. TusanHomichi commented on Aug 28, 2026

    @TusanHomichi
    MemberAuthor

    Slice 1 is merged: #15 (closes #14) implements ADR 0007 — migration 0004 with composite-FK enforcement of invariant 5, trigger-enforced publish freeze proven by raw-SQL tests, phase-optional versions, authoring/publish services gated on manage_programs, attributable lifecycle audit events, and the versioned JSON export/import with a byte-identical round trip onto a clean installation (docs/formats/program-version-export.md).

    Remaining under this issue, per the vertical-slice order:

    1. Authoring interface slice — HTTP endpoints plus the web UI for authoring, comparing, publishing, and importing/exporting program versions.
    2. Enrollment pinning slice — enrollments connecting a trainee to a published program_version, never a program.

    This issue stays open as the Milestone 2 design record until the milestone exit — a complete invented training program published, enrolled, exported, and reproduced — is demonstrated end to end.


    Generated by Claude Code

  3. TusanHomichi commented on Aug 28, 2026

    @TusanHomichi
    MemberAuthor

    Slice 2 is merged: #17 (closes #16) adds the program HTTP API (stable refusal codes, itemized problems in the error envelope) and the embedded authoring interface — programs list with create/import, version management with publish/discard/export/import-as-next-version, the structured content editor (drafts wholesale-replaced per ADR 0007, published versions read-only), and a section-level compare view. Proven by five API integration tests and a browser e2e that authors, publishes, and compares a version through the real binary.

    Remaining under this issue: enrollment pinning — enrollments connecting a trainee to a published program_version, never a program — and then the Milestone 2 exit demonstration (a complete invented program published, enrolled, exported, and reproduced).


    Generated by Claude Code

  4. TusanHomichi commented on Aug 28, 2026

    @TusanHomichi
    MemberAuthor

    Milestone 2 is complete. Three slices, each merged green:

    1. programs(config): program versions, publish freeze, and export/import #15 (closes Milestone 2 slice 1: program-version schema, domain services, and export/import #14) — schema, domain services, and export/import: composite-FK enforcement of invariant 5, trigger-enforced publish freeze, phase-optional versions, and the documented byte-stable export format.
    2. programs(web): authoring API and embedded interface #17 (closes Milestone 2 slice 2: program authoring API and web interface #16) — the authoring API and embedded interface: structured editor, publish/discard/export/import, and section-level version compare.
    3. enrollments(pin): enrollment pinning and minimal user creation #20 (closes Milestone 2 slice 3: enrollment pinning and minimal user creation #19 and this issue) — enrollment pinning with minimal user creation: enrollments pin published versions with the database refusing drafts and silent repointing, and first credentials flow through the existing reset mechanism.

    The exit criterion — a complete invented training program can be published, enrolled, exported, and reproduced — is a passing test (milestone_two_exit_publish_enroll_export_reproduce in tests/enrollments.rs): published on one installation, a trainee enrolled, exported, reproduced byte-identically on a clean installation, then published and enrolled there as well. The browser e2e drives the same authoring, publish, enrollment, and compare flows through the compiled binary.

    Every owner decision recorded above is encoded in ADR 0007 and implemented as decided. Next per the roadmap: Milestone 3 — sessions and drafts.


    Generated by Claude Code

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