Repository navigation
programs(web): authoring API and embedded interface - #17
Merged
Merged
Conversation
Add the Milestone 2 authoring slice over the slice-1 services: program HTTP endpoints in their own handler module with http.rs as the hub and stable refusal codes (itemized problems included in the error envelope), plus the embedded interface — programs list with create/import, version management with publish, discard, export, and import-as-next-version, a structured content editor over the typed document (draft editable, published read-only), and a section-level compare view. Proven by API integration tests and a browser e2e that authors, publishes, and compares a version. Refs #16
This was referenced Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Primary Issue
Closes #16
Problem And Outcome
Slice 1 (#15) delivered the schema, services, and export/import with no way for a person to use them. After merge, a signed-in coordinator holding
manage_programsbuilds a complete program version in the browser — phases, transitions, competencies with tasks, all three rating-scale kinds, modifiers, forms, and standards citations — publishes it (with an explicit irreversibility confirmation), sees it render read-only, compares any two versions section by section, exports the documented JSON, and imports one, without hand-writing JSON.Changes
Server
src/programs_http.rs: the program endpoints — list/create programs, list/create versions, get version (summary + content), replace draft content, publish, discard, export (as a download withContent-Disposition), import as new program or next version. Handlers only translate refusal enums into stable codes (capability_required,no_such_program,no_such_version,already_published,name_taken,name_empty,invalid_content,incomplete,unsupported_format); policy stays in the services. Reads need a session; mutations are refused by the services withoutmanage_programs.src/http.rsstays the hub (router,ApiError,CurrentUser) and now documents that boundary; the error envelope gains an optionalproblemsarray so validation and completeness refusals arrive itemized.src/programs.rs:Serializeon the summaries plusget_program/version_summarylookups.tests/programs_api.rs: five integration tests — authentication gates, the full authoring flow over HTTP, every refusal's stable code (problems array included), read-vs-mutate capability split, and export/import over the wire.Interface
mainwidened for authoring tables (existing form cards keep their 44rem measure), and shared tokens for tables, panels, status pills, rows, selects/textareas, and problem lists — alllight-dark()aware./programs: list, create, import./programs/{id}: version table with publish/discard/export/new-draft-from-version, import-as-next-version, and a compare picker./programs/{id}/versions/{vid}: the structured editor over the typed content document — wholesale draft replacement per ADR 0007, published versions read-only, refusal problems listed inline./programs/{id}/compare?a&b: section-level structural diff.$lib/editor/(phases+transitions, competencies+tasks, scales+anchors+modifiers, forms+bindings+narratives, and a citations editor reused at program, competency, and task level). Scale-kind changes keep shapes coherent (pass/fail fixes anchors 0/1, narrative-only clears them).$lib/api.tsgrows the typed program client andApiError.problems;$lib/format.tsdedupes theinstant()helper the status page previously declared locally.web/e2e/programs.spec.ts: a browser proof that creates a program, authors a version in the editor, publishes through the confirmation, verifies the frozen read-only state, branches a new draft from it, and reads the compare view.Scope
Verification
Web built before cargo, so the embedded-asset paths were exercised.
Review And Merge Notes
programs_http.rsagainst the service enums, and the editor's read-only discipline on published versions (disabledderives frompublished_atand capability).Generated by Claude Code