Skip to content

refactor(web): split large workflow pages and domain API contracts #59

Description

@TusanHomichi

Evidence

The 2026-09-05 continuation audit (PR #55, head 3d87379) found concentrated web ownership:

  • web/src/routes/drafts/[id]/+page.svelte: 1,585 lines, covering draft editing and the subsequent record workflow.
  • web/src/routes/enrollments/[id]/+page.svelte: 1,284 lines, covering enrollment and its related workflows.
  • web/src/lib/api.ts: 1,271 lines, containing the shared request/error boundary alongside program, user, enrollment, training-session, draft, finalized-record, signoff, and export contracts.

The audit's existing browser scenarios passed. This is a maintainability follow-up, not a claim of a demonstrated UI regression. No existing open or closed issue owns the decomposition.

Proposed ownership and scope

  • Extract cohesive workflow sections into domain components as each page next changes. Keep route loading/coordination in the page and give editing state/autosave one explicit owner; do not duplicate state across fragments.
  • Separate domain-specific API contracts/functions from the shared request, session, and typed-error transport. Preserve compatibility imports if needed; avoid generic schema-driven UI or new client-side authorization authority.
  • Start the implementation PR with a concrete move/new-owner/impact/test plan. Proposed section boundaries must be reviewed against current code, not treated as an approved design.
  • Coordinate with Draft workspace: keep the losing writer's text visible after a stale-save reload #34 (stale-save recovery) and Trainees cannot view their own task signoff history in the web interface #49 (trainee signoff UI). Those remain separate behavior fixes and are not closed by moving code.

Acceptance criteria and proof

  • Both pages and the API client have focused domain owners and no duplicated request/error policy or competing autosave state.
  • Preserve route URLs, HTTP payloads, typed refusal handling, role/capability behavior, accessibility, and persisted record behavior. No schema or server authorization change.
  • Preserve dirty edits, autosave/explicit-save behavior, and record/enrollment workflows through focused regression coverage appropriate to each extraction. Do not claim Draft workspace: keep the losing writer's text visible after a stale-save reload #34 repaired without its acceptance proof.
  • Run npm check/build, all browser scenarios, and the CONTRIBUTING.md repository gates; update docs/development.md to route to the new owners.

Refs #53, #55. Source: docs/audits/2026-09-05.md, “Web ownership is concentrated.” Deliver in focused linked slices when these owners next change; no whole-interface rewrite is requested.

Activity

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