Scrum4Me/docs/adr
Janpeter Visser ff22196714
Sprint: Stories en taken krijgen één voorspelbare volgorde gekoppeld aan hun code; drag-and-drop herordening voor stories/taken verdwijnt, priority wordt puur label. (#201)
* feat(code): add parseCodeNumber helper to lib/code.ts

Pure helper that extracts the trailing numeric sequence from a code string
(ST-007 → 7, T-42 → 42). Non-conforming codes fall back to Number.MAX_SAFE_INTEGER
so they sort to the end. Includes 5 unit tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(tasks): add code field to BacklogTask type and all task selects

Adds `code: string | null` to BacklogTask interface and includes it in
all Prisma task.findMany selects (backlog API, stories tasks API, page
hydration routes). Updates coerceTaskPayload and test fixtures to match.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(sort-order): derive story/task sort_order from parseCodeNumber(code)

All create paths (createStoryAction, saveTask, createTaskAction,
materializeIdeaPlanAction) and code-edit paths (updateStoryAction, saveTask
update) now set sort_order = parseCodeNumber(code) instead of last+1.
Removes stale last-record queries from create paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(sort-order): decouple sprint membership actions from sort_order

createSprintAction and addStoryToSprintAction no longer write sort_order
when adding stories to a sprint. sort_order is derived from code via
parseCodeNumber, so membership should only set sprint_id + status.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(ordering): remove priority from all story/task orderBy

Story- en taak-ordering is nu puur sort_order asc (created_at als
tiebreaker). PBI-ordering (priority + sort_order) blijft ongewijzigd.

Gewijzigd: backlog/route, pbis/stories/route, claude-context/route,
next-story/route, workspace/route, tasks/route, sprint-runs (query +
in-memory sort), solo-workspace-server, page.tsx (app + mobile + sprint),
store compareStory, actions/sprints story-query, next-story test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(dnd): remove drag-and-drop reorder for stories and tasks

- Remove reorderStoriesAction, reorderTasksAction, reorderSprintStoriesAction
- Delete REST route app/api/stories/[id]/tasks/reorder/route.ts
- Remove DnD from backlog story-panel and task-panel (flat list)
- Remove reorder-within-sprint branch from sprint-board-client handleDragEnd
- Switch SortableSprintRow to plain SprintRow using useDraggable (membership drag kept)
- Remove all DnD from task-list (status toggle + edit kept)
- Remove story-order/task-order/sprint-story-order/sprint-task-order mutation types and store handlers
- Remove related tests for deleted reorder route; fix sprint store tests

* feat(backlog): toon code-badge op backlog-taakkaarten

Geeft code={task.code} door aan <BacklogCard> in TaskCard (task-panel.tsx).
BacklogCard rendert de CodeBadge al conditionally — alleen de prop ontbrak.

* feat(migration): backfill story/task sort_order from code numeric suffix

One-time Prisma migration that sets sort_order = trailing numeric part
of code for all existing stories and tasks, consistent with
parseCodeNumber (fallback = Number.MAX_SAFE_INTEGER for non-conforming
codes). PBIs are intentionally excluded.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs+tests(sort-order): update for code-binding order on stories/tasks

- Rewrite docs/patterns/sort-order.md: float-insertion PBI only; story/task
  sort_order = parseCodeNumber(code), never drag/membership mutated
- Update plan-to-pbi-flow.md: sort_order auto, sprint_id param, priority=label
- Update make-plan.md: priority=label, array order = execution order
- Update rest-contract.md: fix sprint-tasks ordering, remove reorder endpoint
- Add ADR-0011: code is bindende volgordesleutel voor stories/taken
- Regenerate docs/INDEX.md via npm run docs
- Remove reorderStoriesAction/reorderTasksAction mocks from backlog tests
- Remove dnd-kit mocks from task-panel test (panel no longer uses dnd)
- Extend materializeIdeaPlanAction test: assert sort_order=parseCodeNumber(code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 19:02:36 +02:00
..
templates docs: AI-optimized docs restructure (Phases 1–8) (#61) 2026-05-03 03:21:59 +02:00
0000-record-architecture-decisions.md fix(ci): docs:check-links groen — exclude docs/old/ + archiveer stale plans (#193) 2026-05-11 21:33:47 +02:00
0001-base-ui-over-radix.md docs: AI-optimized docs restructure (Phases 1–8) (#61) 2026-05-03 03:21:59 +02:00
0002-float-sort-order.md docs: AI-optimized docs restructure (Phases 1–8) (#61) 2026-05-03 03:21:59 +02:00
0003-one-branch-per-milestone.md docs: AI-optimized docs restructure (Phases 1–8) (#61) 2026-05-03 03:21:59 +02:00
0004-status-enum-mapping.md docs: AI-optimized docs restructure (Phases 1–8) (#61) 2026-05-03 03:21:59 +02:00
0005-iron-session-over-nextauth.md docs: AI-optimized docs restructure (Phases 1–8) (#61) 2026-05-03 03:21:59 +02:00
0006-demo-user-three-layer-policy.md feat(PBI-80): demo-user mag eigen UI-voorkeuren wijzigen (#194) 2026-05-12 20:03:40 +02:00
0007-claude-question-channel-design.md docs: AI-optimized docs restructure (Phases 1–8) (#61) 2026-05-03 03:21:59 +02:00
0008-agent-instructions-in-claude-md.md docs: AI-optimized docs restructure (Phases 1–8) (#61) 2026-05-03 03:21:59 +02:00
0010-product-per-repo-cross-product-planning.md docs(adr): ADR-0010 — één product = één repo, cross-product planning later via Initiative-laag 2026-05-03 14:44:14 +02:00
0011-code-volgordesleutel-stories-taken.md Sprint: Stories en taken krijgen één voorspelbare volgorde gekoppeld aan hun code; drag-and-drop herordening voor stories/taken verdwijnt, priority wordt puur label. (#201) 2026-05-14 19:02:36 +02:00
README.md docs: AI-optimized docs restructure (Phases 1–8) (#61) 2026-05-03 03:21:59 +02:00

title status audience language last_updated
Architecture Decision Records active ai-agent, maintainer, contributor en 2026-05-02

Architecture Decision Records

This directory contains the Architecture Decision Records (ADRs) for Scrum4Me.

What is an ADR

An ADR is a short document that captures a single significant architectural decision: the context that forced the decision, the choice we made, and the consequences of that choice. ADRs are immutable once accepted — if a later decision changes course, we write a new ADR that supersedes the old one.

We use ADRs because the project mixes several non-obvious choices (Next.js 16 specifics, @base-ui/react over Radix, float sort_order for drag-and-drop, iron-session over NextAuth, demo-user three-layer policy, MCP integration patterns) and an AI agent reading the codebase six months from now needs to find the why without spelunking through commit history.

File naming

NNNN-kebab-case-title.md
  • NNNN — four-digit zero-padded sequential number, starting at 0001 (0000 is reserved for the meta-ADR that introduces the practice).
  • kebab-case-title — lowercase, hyphen-separated, short noun phrase echoing the decision (base-ui-over-radix, not decided-to-use-baseui).
  • Always .md.

Choosing a template

Two templates live in templates/. Default to Nygard.

Nygard (default — templates/nygard.md)

Use Nygard for the common case: a decision that is essentially a one-way door with a clear motivating context and one obvious choice. Four sections: Title, Status, Context, Decision, Consequences (Positive / Negative).

Aim: ≤60 lines. Reads in under a minute.

MADR v4 (when alternatives matter — templates/madr.md)

Use MADR when the decision involves weighing multiple alternatives that a future reader would otherwise re-litigate. Triggers:

  • Authentication / session strategy (NextAuth vs iron-session vs Clerk).
  • Queue / messaging mechanics (LISTEN/NOTIFY vs Redis vs SQS).
  • Agent integration patterns (REST polling vs MCP vs SSE channel).
  • Schema or data-model choices with non-trivial migration cost.
  • Any decision where you want to record the rejected options so future contributors don't propose them again.

MADR adds: YAML front-matter (status, date, decision-makers, consulted, informed), explicit Decision Drivers, Considered Options, Pros and Cons of each option, Confirmation, and More Information.

Status lifecycle

proposed  →  accepted  →  (optionally) superseded by NNNN
                       ↘  (optionally) deprecated
  • proposed — drafted, awaiting decision-maker sign-off.
  • accepted — current binding decision; the codebase reflects this.
  • superseded by ADR-NNNN — replaced. Keep the file; never edit the Decision section. Add a one-line "Superseded by …" note at the top of the Status section and link to the new ADR.
  • deprecated — still current but no longer recommended; usually a precursor to a future supersession.

Once an ADR is accepted, it is immutable except for the Status field and typo fixes. Course corrections always create a new ADR.

Index of ADRs

# Title Status Template
0000 Record architecture decisions accepted Nygard
0001 @base-ui/react over Radix UI accepted Nygard
0002 Float sort_order for drag-and-drop reorder accepted Nygard
0003 One branch per milestone (Hobby plan) accepted MADR
0004 Status enum mapping via lib/task-status.ts accepted Nygard
0005 iron-session over NextAuth/Clerk accepted MADR
0006 Demo-user three-layer write guard accepted Nygard
0007 Agent ↔ user question channel via persistent table + LISTEN/NOTIFY accepted MADR
0008 Agent instructions in CLAUDE.md + topical runbooks accepted Nygard

When new ADRs are added, the docs index generator (npm run docs:index) will list them in ../INDEX.md. Update this table by hand when you add or supersede an ADR — the script aggregates across the whole docs tree, this README is the canonical ADR-only roster.