Activity Builder: create and manage activities (CRUD) #5

Closed
opened 2026-10-13 18:53:04 +00:00 by ben · 4 comments
Owner

Let admins author their own card-sort activities.

Scope

  • Create/edit/duplicate/archive/delete activities: title, instructions, ordered custom columns (name, colour, 2-7 columns), and cards (title + description), with bulk import (CSV/paste) and reorder.
  • Editing a live activity: define behaviour for cards/columns removed while clients have placements (versioning or soft-delete).
  • Preview as client.

Acceptance

  • An activity created in the builder can be assigned and played end to end; deleting is blocked or soft when sessions exist.

Depends on: activities split, RBAC.


Handoff context: the app is being prepared so a counselling practice can self-host it (see README and docs/self-hosting.md). Today the app has no auth by design, two hard-coded decks in shared/cards.json, three fixed columns, and Fastify + SQLite + SSE sync (docs/api.md).

Let admins author their own card-sort activities. **Scope** - Create/edit/duplicate/archive/delete activities: title, instructions, ordered custom columns (name, colour, 2-7 columns), and cards (title + description), with bulk import (CSV/paste) and reorder. - Editing a live activity: define behaviour for cards/columns removed while clients have placements (versioning or soft-delete). - Preview as client. **Acceptance** - An activity created in the builder can be assigned and played end to end; deleting is blocked or soft when sessions exist. Depends on: activities split, RBAC. --- Handoff context: the app is being prepared so a counselling practice can self-host it (see README and docs/self-hosting.md). Today the app has no auth by design, two hard-coded decks in `shared/cards.json`, three fixed columns, and Fastify + SQLite + SSE sync (docs/api.md).
Author
Owner

Deferred from the #2 code review (delta round 2, codex/gpt-6-astra), to resolve when the builder can archive cards:

  • Medium: an archived card that is unplaced but has a note (no flag) becomes inaccessible: it is excluded from drawing, chips need a placement, and summaries list only placed or flagged cards. Add a read-only "historical cards" section showing archived references and their notes, without allowing new placement (web/src/main.ts remaining(), summary ~L647/669/724).
  • Low: the Summary "Not yet sorted" count uses deckCards(), which includes archived referenced cards. It should exclude archived cards, matching remaining() (web/src/main.ts ~L679/719).
Deferred from the #2 code review (delta round 2, codex/gpt-6-astra), to resolve when the builder can archive cards: - **Medium**: an archived card that is unplaced but has a note (no flag) becomes inaccessible: it is excluded from drawing, chips need a placement, and summaries list only placed or flagged cards. Add a read-only "historical cards" section showing archived references and their notes, without allowing new placement (`web/src/main.ts` remaining(), summary ~L647/669/724). - **Low**: the Summary "Not yet sorted" count uses deckCards(), which includes archived referenced cards. It should exclude archived cards, matching remaining() (`web/src/main.ts` ~L679/719).
Author
Owner

Slices 1–5 are implemented. 568d5e9 is deployed; 478d3e7 (tests and docs) is not yet deployed.

  • 0ddfd88: read-only historical cards, and Summary counts now exclude archived cards. This resolves the deferred review comment.
  • 6b9a2d5: builder create.
  • c5ada02: edit, archive, duplicate and delete. Staff edit only unassigned activities; once assigned, only the owner edits. Removed items are soft-archived. Clients that hit a removed item get a machine-readable error and keep the note recoverable.
  • 568d5e9: CSV and paste import, plus an in-memory client preview.
  • 478d3e7: Playwright builder journey.
  • Decisions by the maintainer: staff edit unassigned activities only (so no creator column and no migration); edits reach clients the next time they open the session, with no live refresh.
  • Open: four should-fix follow-ups (archive token handling, the stopped-draft indicator, multiline imported titles, the preview focus trap) are fixed on feat/followups, waiting on one review finding and merge.
Slices 1–5 are implemented. 568d5e9 is deployed; 478d3e7 (tests and docs) is not yet deployed. - **0ddfd88:** read-only historical cards, and Summary counts now exclude archived cards. This resolves the deferred review comment. - **6b9a2d5:** builder create. - **c5ada02:** edit, archive, duplicate and delete. Staff edit only unassigned activities; once assigned, only the owner edits. Removed items are soft-archived. Clients that hit a removed item get a machine-readable error and keep the note recoverable. - **568d5e9:** CSV and paste import, plus an in-memory client preview. - **478d3e7:** Playwright builder journey. - **Decisions by the maintainer:** staff edit unassigned activities only (so no creator column and no migration); edits reach clients the next time they open the session, with no live refresh. - **Open:** four should-fix follow-ups (archive token handling, the stopped-draft indicator, multiline imported titles, the preview focus trap) are fixed on feat/followups, waiting on one review finding and merge.
Author
Owner

The four should-fix follow-ups landed in 654bca2 and are deployed (live at 8db0a97):

  • Archive: archiving keeps unsaved editor changes. It adopts the new update token only when the saved definition is otherwise unchanged; if not, the draft is kept and flagged as conflicted.
  • Imported titles: titles that contain line breaks use textareas, so nothing is silently flattened.
  • Preview dialog: traps Tab and Shift+Tab and returns focus to the deck or card that opened it, including after Escape or a backdrop click.
  • Stale requests: builder list, read and reload requests drop stale responses before the global auth side effects. A failed list refresh after a successful save, archive or delete shows as a list error, not an edit conflict.

The builder journey (web/e2e/builder.spec.ts) passes: create, then import, preview, assign and play. README screenshots now include the builder (8db0a97).

Left: the plan's status line still says draft. Move it to in-progress, close the plan, then close this issue after checking its acceptance against the live app.

The four should-fix follow-ups landed in 654bca2 and are deployed (live at 8db0a97): - **Archive:** archiving keeps unsaved editor changes. It adopts the new update token only when the saved definition is otherwise unchanged; if not, the draft is kept and flagged as conflicted. - **Imported titles:** titles that contain line breaks use textareas, so nothing is silently flattened. - **Preview dialog:** traps Tab and Shift+Tab and returns focus to the deck or card that opened it, including after Escape or a backdrop click. - **Stale requests:** builder list, read and reload requests drop stale responses before the global auth side effects. A failed list refresh after a successful save, archive or delete shows as a list error, not an edit conflict. The builder journey (`web/e2e/builder.spec.ts`) passes: create, then import, preview, assign and play. README screenshots now include the builder (8db0a97). Left: the plan's status line still says `draft`. Move it to in-progress, close the plan, then close this issue after checking its acceptance against the live app.
Author
Owner

Acceptance verified, closing.

  • A builder-created activity can be assigned and played end to end: web/e2e/builder.spec.ts creates an activity with a CSV import, previews it and assigns it. The client then draws, sorts, adds notes and flags, and opens the Summary. The server test in activities.test.js does the same through the API.
  • Delete is blocked when sessions exist: server/activities.js returns 409 for an assigned or referenced activity, and admins get 403. The soft path is archive: removed cards and columns are soft-archived once the activity is assigned. Tests:
    • activities.test.js "authorizes before stale-token conflicts…";
    • the "defensively blocks delete" cases;
    • in the UI, Delete is hidden when canDelete is false (builder.test.ts).

The plan docs/plans/2026-10-14-15-11_activity-builder-crud.md is closed (Status: done).

  • Minor gap: the e2e spec has no archive or delete journey; server and web unit tests cover both.
  • Follow-up: add a retry button after a failed builder list refresh (STATUS.md).
Acceptance verified, closing. - **A builder-created activity can be assigned and played end to end:** `web/e2e/builder.spec.ts` creates an activity with a CSV import, previews it and assigns it. The client then draws, sorts, adds notes and flags, and opens the Summary. The server test in `activities.test.js` does the same through the API. - **Delete is blocked when sessions exist:** `server/activities.js` returns 409 for an assigned or referenced activity, and admins get 403. The soft path is archive: removed cards and columns are soft-archived once the activity is assigned. Tests: - `activities.test.js` "authorizes before stale-token conflicts…"; - the "defensively blocks delete" cases; - in the UI, Delete is hidden when `canDelete` is false (`builder.test.ts`). The plan `docs/plans/2026-10-14-15-11_activity-builder-crud.md` is closed (`Status: done`). - **Minor gap:** the e2e spec has no archive or delete journey; server and web unit tests cover both. - **Follow-up:** add a retry button after a failed builder list refresh (`STATUS.md`).
ben closed this issue 2026-10-15 03:20:03 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ben/career-values-cards#5
No description provided.